Revision as of 08:46, 14 June 2010

Hugin depends on different components like libraries and tools, which are not available on a common Windows system. All these components can be combined to a Hugin Software Developmant Kit (SDK). This article gives step-by-step instructions to build such SDK for Hugin using Microsoft Visual C++ 2008 (MSVC 2008) Express Edition and precompiled dependencies.

While this article is designed for developing a native 32-bit version, adidtional instructions are provided so that a 64-bit version of the Hugin SDK can be compiled. When appropriate, steps that only apply to the 32-bit or 64-bit versions will be noted as (32-bit) or (64-bit), and you can safely ignore them if you are not targeting that particular version. In order to compile a 64-bit version of the Hugin SDK, one does not need a 64-bit computer. However, if they wish to test or debug the binaries, or for some projects (such as OpenEXR) which execute compiled binaries as part of their build step, this will not necessarily be possible on Win32.

First of all an overview is given over the contents of the SDK and the tools that are necessary to build the SDK.

The build steps for each component are written like a walkthrough and annotated on the end of each section.

Maybe some of the described tools and packages, especially those fetched from Subversion (SVN) repository, will change over time and/or become obsolete. Hence it is likely that some steps will become invalid or won't work any more.

The SDK is structured, that each component resides in its own subdirectory. This approach is different to other platforms like Linux, where some common directories are available to store include files, libraries and applications. The files of a component are spread over all these directories. Both approaches to structure the files in a file system have its assets and drawbacks.

The base directory of the SDK is denoted as <SDKHOME> in this article. Replace <SDKHOME> by directory name where you store the SDK on your system. In the examples <SDKHOME> is replaced by the directory name D:\usr\src\SDK.

Prerequisites

To build the SDK some tools are required that are listed in the table below. Download the tools and install them. The destination directory of each tool is arbitrary. If you are uncertain, choose the default given in the setup dialog of each tool.

x64 Compiler, Libraries, and HeadersVisit [1] When installing, make sure to include the Visual C++ compilers for x64 (under Developer Tools) and the Header Files and x64 libraries (under Windows Headers and Libraries). Optionally consider installing all of the SDK, as it makes compiling generally easier.

In the following subsections each component is discussed in detail. The order of the subsections seems random, but I applied the approach to describe the precompiled packages first, followed by the big packages, where some of the small packages depend on.

The decompress step of each component contains seemingly inconsistent namings of destination directories, because in some components a subdirectory is specified as destination directory and in some steps only the base directory. This is due to the fact that some package archives contain a base directory and some not. To check the right locations each result section of every component's description contains a summary of the expected files.

The SDK is currently outdated. The following changes are necessary to build Hugin:

Diff Files

In order to make compilation simple, a series of patch files are included below that contain all the necessary changes, not only to compile the SDK, but to optionally compile an x64 version of the SDK. When directed, you will need to apply the patch file specified. If you are compiling for x64, there may be additional patches you need to apply.

On the command prompt, enter the following commands without any line breaks and press the Return/Enter key, substituting <SDKHOME> where appropriate:

set PATH=%PATH%;<SDKHOME>\UnxUtils\usr\local\wbin

On the command prompt, enter the following commands without any line breaks and press the Return/Enter key, substituting <PATCHFILE> with the name of the patch file to apply:

patch -p 0 -i <PATCHFILE>

NOTE: On Vista and later systems, the filename "patch.exe" is a protected file name which will always result in a UAC prompt if the file does not include a manifest (which UnxUtils version does not). This can be worked around by copying the file <SDKHOME>\UnxUtils\usr\local\wbin\patch.exe to another file not containing the name, such as <SDKHOME>\UnxUtils\usr\local\wbin\apply_diff.exe. Then substitute the command 'patch' in the above command with 'apply_diff'

Result

If everything worked, you should see a list of filenames that were patched.
Example

After bjam.exe finished a statement like the following should be printed in the command prompt window

...updated 26 targets...

Close the Windows command prompt window

Result

The include files reside in
<SDKHOME>\boost_1_39_0 and its subdirectory boost

The libraries reside in
<SDKHOME>\boost_1_39_0\stage\lib

Notes

During build process temporary files are generated in <SDKHOME>\boost_1_39_0\bin.v2. This directory may be deleted to save disk space.

Hugin needs only the two Boost libraries date_time and thread, thus only these two libraries have to be built.
If you want to build all Boost libraries enter following command on the Windows command prompt instead of the command described above and press Return key.

bjam -–build-type=complete toolset=msvc stage

There are about 7GB disc space needed during build of all libraries (3.5GB for libraries and the same amount for the temporary files).

The Boost include files are typically included by a statement like#include "boost/whatever.hpp"
Therefore the base directory of the Boost include files is <SDKHOME>\boost_1_39_0

Only the following libraries are needed to build a release version of Hugin:

libboost_date_time-vc90-mt-s-1_39.lib

libboost_thread-vc90-mt-s-1_39.lib

The files with "gd" in the filename, e.g. libboost_thread-vc90-mt-sgd-1_39.lib, are the debug libraries.
The library files without "-1_39" suffix are automatically generated copies of the libraries with version suffix. They are used by CMake to detect the library directory.

OpenEXR

OpenEXR depends on following SDK component:

wxWidgets

Prepare this component before OpenEXR.

Create the directory <SDKHOME>\OpenEXR

Decompress the file ilmbase-1.0.1.tar.gz to created directory <SDKHOME>\OpenEXR

Decompress the file openexr-1.6.1.tar.gz to the same directory <SDKHOME>\OpenEXR
After decompress there should only exist the two directories ilmbase-1.0.1 and openexr-1.6.1 in <SDKHOME>\OpenEXR