Hugin Compiling Windows

From PanoTools.org Wiki
(Difference between revisions)
Jump to: navigation, search
m (Deciding on the toolchain)
(Fix formating, minor clarifications)
Line 33: Line 33:
 
=== Build all required dependencies from scratch ===
 
=== Build all required dependencies from scratch ===
  
Download the packages. Newer versions might work, too.
+
Download the source packages. Newer versions might work, too.
  
 
1. Download wxWidgets from http://www.wxwidgets.org, I used 2.6.0
 
1. Download wxWidgets from http://www.wxwidgets.org, I used 2.6.0
 +
 
2. Download boost from http://www.boost.org, I used 1.33
 
2. Download boost from http://www.boost.org, I used 1.33
 +
 
3. Download OpenEXR source (IlmBase and OpenEXR) from http://www.openexr.com/
 
3. Download OpenEXR source (IlmBase and OpenEXR) from http://www.openexr.com/
4. Download panorama tools source (pano13), from http://panotools.sf.net
+
 
  Version 2.9.6 or later is required, latest SVN is recommended.
+
4. Download panorama tools source (pano13), from http://panotools.sf.net. Use version 2.9.12 or later. Latest SVN is even better.
 +
 
 
5. Download and install gettext installer package from http://gnuwin32.sf.net
 
5. Download and install gettext installer package from http://gnuwin32.sf.net
  
Unpack the packages.
+
Unpack the source packages.
  
Building wxWidgets:
+
==== Building wxWidgets ====
  
1. Prepare wxWidgets source code,
+
1. Open libs/wxWidgets/src/tiff/tiffconf.h in your favorite editor, and add
. Open libs/wxWidgets/src/tiff/tiffconf.h in your favorite editor, and add
+
  
 
   #define ZIP_SUPPORT
 
   #define ZIP_SUPPORT
Line 54: Line 56:
 
newer version of wxWidgets.
 
newer version of wxWidgets.
  
2. build wxWidgets: start the MSVC command line shell (from the startmenu)
+
2. build wxWidgets: start the MSVC command line shell (from the startmenu) and cd to the wxWidgets/build/msw. To build ANSI debug and Unicode release libraries, execute the following commands:
  and cd to the wxWidgets/build/msw. To build ANSI debug and Unicode release
+
  libraries, execute the following commands
+
  
 
   nmake -f makefile.vc BUILD=debug UNICODE=0 SHARED=0 RUNTIME_LIBS=static
 
   nmake -f makefile.vc BUILD=debug UNICODE=0 SHARED=0 RUNTIME_LIBS=static
Line 62: Line 62:
  
  
Building boost:
+
==== Building boost ====
  
 
Refer to the boost documentation for details. Here is a short overview:
 
Refer to the boost documentation for details. Here is a short overview:
 
Download bjam exectable from http://www.boost.org/tools/build/v1/build_system.htm
 
Download bjam exectable from http://www.boost.org/tools/build/v1/build_system.htm
 
and place it in the boost directory. Open the MSVC Command line prompt and
 
and place it in the boost directory. Open the MSVC Command line prompt and
change directory to the boost dir and issue:
+
change directory to the boost dir and issue
  
 
   bjam stage
 
   bjam stage
  
 +
This will build all boost library, and take several hours. Hugin only needs the boost thread library, if possible try to
 +
build only that one.
  
Building OpenEXR:
+
==== Building OpenEXR ====
  
This is a tricky one, because the MSVC project files have been set up for DLL builds with the \MD runtime, and a custom program is used to prepare the DLLs.
+
This is a tricky one, because the MSVC project files have been set up for DLL builds with the \MD runtime, and a custom program is used to prepare the DLLs. For the all static windows binaries, quite some changes to the MSVC project files are needed.
  
 
Build according to README_win in ilmbase-1.0.0 but changed the runtime of all projects to MT.  
 
Build according to README_win in ilmbase-1.0.0 but changed the runtime of all projects to MT.  
Line 83: Line 85:
 
* set runtime to MT
 
* set runtime to MT
 
* disable SSE2, to generate binaries that run on all platforms
 
* disable SSE2, to generate binaries that run on all platforms
* remove the createDLL part of the post-build command, but keep the
+
* remove the createDLL part of the post-build command, but keep the call to '''install*.cmd''', such as '''..\..\..\installIlmImf.cmd $(IntDir)'''
call to install*.cmd, such as "..\..\..\installIlmImf.cmd $(IntDir)"
+
  
Apply the same procedure to the IlmImf and IlmImfTest project of the OpenEXR source code.
+
Apply the same procedure to the openexr-1.6 source code. Here only the IlmImf and IlmImfTest projects are needed by Hugin.
 
Follow the same process as for IlmBase, but additionally, but additionally add include path for the zlib library (inside the wxWidget/src/zlib) to the IlmImf project, and wxWidget/libs/_vc/wxzlib.lib to the IlmImfTest linker options. The tests should run without errors.
 
Follow the same process as for IlmBase, but additionally, but additionally add include path for the zlib library (inside the wxWidget/src/zlib) to the IlmImf project, and wxWidget/libs/_vc/wxzlib.lib to the IlmImfTest linker options. The tests should run without errors.
  
 +
==== Building Panotools ====
  
 
[[Build_pano12_from_sourcecode_MSVC|Building Pano13 with MSVC]] is described on a separate page.
 
[[Build_pano12_from_sourcecode_MSVC|Building Pano13 with MSVC]] is described on a separate page.

Revision as of 11:24, 28 October 2007

NOTE: this is work in progress and not finished yet.

Contents

Why do I want to compile hugin?

If you want to fiddle with the hugin code, test new features or help squashing bugs, and do all that on Windows, this is the guide for you. Be warned that building hugin on Windows is not a piece of cake, so only try if you know the dark sides with all the development tools involved.

For normal testers it is better to use the binary snapshots we will offer during the preparation period for hugin 0.7. This guide is designed to be a help for people who have expressed interest in build Windows version of the current hugin code on a regular basis.

This guide will describe two ways of building the latest trunk. It does not apply to the hugin code prior to 2007/10/27.

Deciding on the toolchain

Currently, there are two methods for building hugin. Both are based on the CMake build system.

1. Compilation with Microsoft Visual Studio .NET. MSVC 2003 or later is required. The free express edition will probably also work, but is probably even harder to setup.

2. Compilation with MinGW32. This does not require the Microsoft compiler and even allows cross compilation of binaries for windows on a linux machine. Until now, only the cross compilation approach has been tried, but a building on a native system should also be possible.

For both approaches, the hardest task is the compilation of the libraries required by hugin. This mainly includes wxWidgets, boost, libpano13 and OpenEXR.

Building with Microsoft Visual Studio .Net 2003 (or later)

For simpler installation I have build everything against the older, multithreaded runtime libraries (\MT option).

Getting the dependencies

It is tempting to download precompiled libraries from the different projects, and use those. Be prepared that they might have been created with different compiler setting (Especially with a different runtime libraries). This can lead to hard to find and nasty problems and amount to days of depressing work (I speak from experience).

Downloading precompiled dependencies

Easy way, download the libraries I (Pablo d'Angelo) have used. They have been used for the creation of most hugin releases and should work reliably, even if they are not the latest versions. They can soon be downloaded from hugin.panotools.org/sdk/msvc I'm currently cleaning up the packages, please be patient. I have uses MSVC 2003 to create these, the might not work on other compilers. I'm sure at least boost will only work with the compiler it has been build with.

Build all required dependencies from scratch

Download the source packages. Newer versions might work, too.

1. Download wxWidgets from http://www.wxwidgets.org, I used 2.6.0

2. Download boost from http://www.boost.org, I used 1.33

3. Download OpenEXR source (IlmBase and OpenEXR) from http://www.openexr.com/

4. Download panorama tools source (pano13), from http://panotools.sf.net. Use version 2.9.12 or later. Latest SVN is even better.

5. Download and install gettext installer package from http://gnuwin32.sf.net

Unpack the source packages.

Building wxWidgets

1. Open libs/wxWidgets/src/tiff/tiffconf.h in your favorite editor, and add

  #define ZIP_SUPPORT

near line 90 to support ZIP compressed tiff files. This might not be needed in newer version of wxWidgets.

2. build wxWidgets: start the MSVC command line shell (from the startmenu) and cd to the wxWidgets/build/msw. To build ANSI debug and Unicode release libraries, execute the following commands:

 nmake -f makefile.vc BUILD=debug UNICODE=0 SHARED=0 RUNTIME_LIBS=static
 nmake -f makefile.vc BUILD=release UNICODE=1 SHARED=0 RUNTIME_LIBS=static


Building boost

Refer to the boost documentation for details. Here is a short overview: Download bjam exectable from http://www.boost.org/tools/build/v1/build_system.htm and place it in the boost directory. Open the MSVC Command line prompt and change directory to the boost dir and issue

  bjam stage

This will build all boost library, and take several hours. Hugin only needs the boost thread library, if possible try to build only that one.

Building OpenEXR

This is a tricky one, because the MSVC project files have been set up for DLL builds with the \MD runtime, and a custom program is used to prepare the DLLs. For the all static windows binaries, quite some changes to the MSVC project files are needed.

Build according to README_win in ilmbase-1.0.0 but changed the runtime of all projects to MT.

For all projects do:

  • set each project to static lib
  • remove OPENEXR_DLL, _USEDLL and *_EXPORTS defines
  • set runtime to MT
  • disable SSE2, to generate binaries that run on all platforms
  • remove the createDLL part of the post-build command, but keep the call to install*.cmd, such as ..\..\..\installIlmImf.cmd $(IntDir)

Apply the same procedure to the openexr-1.6 source code. Here only the IlmImf and IlmImfTest projects are needed by Hugin. Follow the same process as for IlmBase, but additionally, but additionally add include path for the zlib library (inside the wxWidget/src/zlib) to the IlmImf project, and wxWidget/libs/_vc/wxzlib.lib to the IlmImfTest linker options. The tests should run without errors.

Building Panotools

Building Pano13 with MSVC is described on a separate page.

Compiling Hugin

Use SVN to retrieve the latest hugin sourcecode, run CMakeSetup and use this procedure:

1. Run cmake, tick show advanced, select hugin source and build directories Do not choose the same directories for both source and build. 2. Press Configure 3. fill out red fields, select appropriate library and include paths, if required. The msgfmt program is in the gettext package installed earlier. 4. Press Configure 5. If more warnings and red lines appear, goto 3. 6. Adjust some compiler settings in the CMAKE_C*_FLAGS entries

 * Change C runtime library from \MD to \MT
 * Reduce debug level from \Zl to \Zd (otherwise the debug files become bigger than MSVC can handle)

Once all fields have been filled out, the "Ok" button should be available. Press it, and open the generated hugin.sln file. Switch to Release and start the build.

By building the "INSTALL" project, hugin will be installed into your usual "Program Files" directory.

--pablo 03:12, 27 October 2007 (CEST)

Personal tools
Namespaces

Variants
Actions
Navigation
tools
Tools