Hugin SDK (MSVC 2013)

From PanoTools.org Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

This side contains some notes to compile Hugin with MS Visual Studio Community Edition 2013.

This instructions applies to build all libs as shared libraries (aka dll). All instructions refers to 32 and 64 bit except otherwise noted.

Prerequisites

First install the following prerequisites:

  • Visual Studio 2013 Community Edition: [1] (Please don't use the 2015 version. Not all needed libraries are updated for the new compiler generation.)
  • CMake [2] (select win32 installer )
  • Tortoise HG, to get code from repository [3] (select 32 or 64 bit, which one is appropriate for your system, not for the architecture you are building)
  • MS HTML Help Workshop, for creating the help file [4]
  • 7-zip, to extract some downloads [5]

Dependencies

General notes

  • First create a directory, where we build all libraries and program. This directory is called SDKROOT in the following steps. It's best to use a directory without white spaces or other special characters, e.g. c:\huginSDK would be a good point. Replace SDKROOT with your real path in all places.
  • There are mainly 2 build ways, depending on the library
    • The CMake way
    • The nmake way

In the following we will give only short instructions, and mention where differences to the general way are.

The CMake way

  1. Open the CMake (CMake-gui) from the start menu
  2. Browse to the path where you extracted the source
  3. Specify a path where the library is build. Normally use SDKROOT\build_lib (Replace lib with the name of the corresponding library.)
  4. Now select Configure, confirm directory creation, select Visual Studio 12 2013 for building 32 bit version or Visual Studio 12 2013 Win64 for the 64 bit version
  5. Tick option Advanced and Grouped to see all possible variables.
  6. When configure finished with error, edit some variables as described in the individual section. (If the variables does not exists after configure, create it Add entry.) Then press configure again.
  7. Repeat until CMake reports Configuring done and there are no red keys in the GUI.
  8. Now select Generate
  9. Open the generated project file (xxx.sln) in the build folder
  10. In Visual Studio check that on the top there is selected Release and Win32 (for 32 bit Hugin) or x64 (for 64 bit Hugin).
  11. Select the project INSTALL, open context menu (right menu button) and select Build
  12. Now VS builds the lib and copies all necessary files to the install destination.

The nmake way

  1. Open Start>Visual Studio 2013>Visual Studio Tools
  2. Start VS2013 x86 Native Tools Command Prompt (for 32 bit) or VS2013 x64 Native Tools Command Prompt (for 64 bit)
  3. Switch to the path where you extracted the source
   cd SDKROOT\lib
  1. Now build the library. The exact instructions are given in the approbate section.

Boost

  • Download from [6] (.7z version is fine)
  • Extract to SDKROOT\boost_1_58_0
  • Now via the nmake way
    cd SDKROOT\boost_1_58_0
    bootstrap.bat
  • Now build for 32 bit with
    b2 --with-system --with-filesystem toolset=msvc variant=debug variant=release link=shared threading=multi runtime-link=shared stage

or for 64 bit

    b2 --with-system --with-filesystem toolset=msvc variant=debug variant=release link=shared threading=multi runtime-link=shared address-model=64 stage

wxWidgets

  • Download from [7] Windows Source and extract source to SDKROOT\wxWidgets-3.0.2
  • Also via the nmake way
    cd SDKROOT\wxWidgets-3.0.2\build\msw
  • Now build for 32 bit
    nmake -f makefile.vc BUILD=debug SHARED=1 USE_OPENGL=1 RUNTIME_LIBS=dynamic
    nmake -f makefile.vc BUILD=release SHARED=1 USE_OPENGL=1 RUNTIME_LIBS=dynamic

or for 64 bit

    nmake -f makefile.vc BUILD=debug TARGET_CPU=AMD64 SHARED=1 USE_OPENGL=1 RUNTIME_LIBS=dynamic
    nmake -f makefile.vc BUILD=release TARGET_CPU=AMD64 SHARED=1 USE_OPENGL=1 RUNTIME_LIBS=dynamic

zlib

  • Download zlib 1.2.8 from [8] and extract source to SDKROOT\zlib-1.2.8
  • Now via the CMake way
  • After configure change key
   CMAKE_INSTALL_PREFIX = SDKROOT\zlib
  • Now configure, generate, open project file and build INSTALL project (as described on top).

libpng

  • Download libpng from [9] (e.g. zip version) and extract source
  • Also via CMake
  • Change the following keys:
   CMAKE_INSTALL_PREFIX = SDKROOT\libpng
   PNG_SHARED [x] (selected)
   PNG_STATIC [ ] (not selected)
   ZLIB_INCLUDE_DIR = SDKROOT\zlib\include
   ZLIB_LIBRARY = SDKROOT\zlib\lib\zlib.lib
  • Finish CMake steps.

libjpeg

  • Download libjpeg from [10] and extract source.
  • Open file makefile.vc in notepad and change the line
   # Pull in standard variable definitions
   !include <win32.mak>

to

   # Pull in standard variable definitions
   #include <win32.mak>

and save. Now open file jmorecfg.h and change the lines

   /* a function referenced thru EXTERNs: */
   #define GLOBAL(type)		type
   /* a reference to a GLOBAL function: */
   #define EXTERN(type)		extern type

to

   /* a function referenced thru EXTERNs: */
   #define GLOBAL(type)		__declspec(dllexport) type
   /* a reference to a GLOBAL function: */
   #define EXTERN(type)		extern __declspec(dllexport) type

and save again.

  • Now open a Visual studio command prompt (as in the nmake way) and
   cd SDKROOT\jpeg-9a
   nmake /f makefile.vc setup-v10
  • Now open project file jpeg.sln in SDKROOT\jpeg-9a and confirm update of project files.
  • For 64 bit only: Open combo box with Win32 and select Configuration Manager. Under active platform select New.. and choose then new Platform x64 and copy from Win32. (When build 32 bit version, this is not necessary.)
  • Open context menu on jpeg project, select Properties. Under Properties, Configuration type switch from Static lib (.lib) to Dynamic lib (.dll). Close dialog.
  • Open context menu on jpeg project again, now select Build.

libtiff

  • Download libtiff from [11] and extract source.
  • Edit file nmake.opt in notepad. Change the lines
       #
       # Uncomment and edit following lines to enable JPEG support.
       #
       #JPEG_SUPPORT   = 1
       #JPEGDIR        = d:/projects/jpeg-6b
       #JPEG_INCLUDE   = -I$(JPEGDIR)
       #JPEG_LIB       = $(JPEGDIR)/Release/jpeg.lib
       
       #
       # Uncomment and edit following lines to enable ZIP support
       # (required for Deflate compression and Pixar log-format)
       #
       #ZIP_SUPPORT    = 1
       #ZLIBDIR        = d:/projects/zlib-1.2.1
       #ZLIB_INCLUDE   = -I$(ZLIBDIR)
       #ZLIB_LIB       = $(ZLIBDIR)/zlib.lib

to

       #
       # Uncomment and edit following lines to enable JPEG support.
       #
       JPEG_SUPPORT	= 1
       JPEGDIR 	= SDKROOT/jpeg-9a
       JPEG_INCLUDE	= -I$(JPEGDIR)
       JPEG_LIB        = $(JPEGDIR)/Release/jpeg.lib  # for 32 bit
       JPEG_LIB        = $(JPEGDIR)/x64/Release/jpeg.lib  # for 64 bit
       
       #
       # Uncomment and edit following lines to enable ZIP support
       # (required for Deflate compression and Pixar log-format)
       #
       ZIP_SUPPORT	= 1
       ZLIBDIR 	= SDKROOT/zlib/include
       ZLIB_INCLUDE	= -I$(ZLIBDIR)
       ZLIB_LIB 	= SDKROOT/zlib/lib/zlib.lib

Keep in mind to replace SDKROOT with your full path (use normal slash / instead of backslash \). Also for JPEG_LIB leave only one entry (depending on architecture). Save.

  • Now via the nmake way:
     cd SDKROOT\libtiff-4.0.3
     nmake Makefile.vc

IlmBase

  • Download IlmBase from [12] and extract source.
  • Via the CMake way, change the following keys
  BUILD_SHARED_LIBS [x] (selected)
  CMAKE_INSTALL_PREFIX = SDKROOT\Deploy
  • Finish CMake steps.

OpenEXR

  • Download OpenEXR from [13] and extract file.
  • Via the CMake way, change the following keys
   BUILD_SHARED_LIB [x] 
   ILMBASE_PACKAGE_PREFIX = SDKROOT\Deploy
   CMAKE_INSTALL_PREFIX = SDKROOT\Deploy
   ZLIB_INCLUDE_DIR = SDKROOT\zlib\include
   ZLIB_LIBRARY = SDKROOT\zlib\lib\zlib.lib
  • Open the project file and select build from the context menu of the IlmImf project. This will fail with an error message. Now copy all dll files from SDKROOT\Deploy\lib to build-OpenEXR\IlmImf\Release. Now try to build IlmImf again. Then build the INSTALL project.

vigra

  • Download vigra from [14] and extract source
  • Via the CMake way. Set the following keys
    WITH_HDF5        [ ]
    WITH_OPENEXR     [x]
    WITH_VALGRIND    [ ]
    WITH_VIGRANUMPY  [ ]
    CMAKE_INSTALL_PREFIX = SDKROOT\vigra

and set the following paths (you need to do it sequential, otherwise not all are displayed by default

    ZLIB_INCLUDE_DIR = SDKROOT\zlib\include
    ZLIB_LIBRARY = SDKROOT\zlib\lib\zlib.lib

Press configure again. And now the second part

    JPEG_INCLUDE_DIR = SDKROOT\jpeg-9a
    JPEG_LIBRARY = SDKROOT\jpeg-9a\Release\jpeg.lib (32 bit)
    JPEG_LIBRARY = SDKROOT\jpeg-9a\x64\Release\jpeg.lib (64 bit)
    PNG_PNG_INCLUDE_DIR = SDKROOT\libpng\include
    PNG_LIBRARY_RELEASE = SDKROOT\libpng\lib\libpng16.lib
    TIFF_INCLUDE_DIR = SDKROOT\tiff-4.0.3\libtiff
    TIFF_LIBRARY = SDKROOT\tiff-4.0.3\libtiff\libtiff_i.lib
    OPENEXR_INCLUDE_DIR = SDKROOT\Deploy\include

and for all OpenExr libraries (Half, IEx, IlmImf, Ilmthread, Imath) do the same (replace ? with the real names, some lib can contain an additional version number like -2_2)

    OPENEXR_?_LIBRARY = SDKROOT\Deploy\lib\?.lib
  • Configure, Generate, open project file and build INSTALL project.

expat

  • Load expat 2.1.0 source from [15] and extract.
  • The expat library is build with the exiv2 library. So no additional steps are needed.

exiv2

  • Download exiv2 source package from [16] and extract.
  • Open project file SDK\exiv-0.24\msvc2012\exiv2.sln and confirm upgrade.
  • Switch to ReleaseDLL and Win32 or x64.
  • Delete zlib1 project (from the context menu). We have already build the zlib library and are using our compiled version.
  • Open context menu on exiv2lib, select properties, go to Configuration properties. Under C/C++ > General > Additional Include directories change (drop down the box and select edit)
   ../../../zlib-1.2.7 

to

   ../../../zlib/include

Under Linker > Input > Additional dependencies change

   ..\zlib\$(Platform)\$(Configuration)\zlib1.lib

to

   ..\..\..\zlib\lib\zlib.lib

And a last change under Build event > Prebuild event > Command Line remove the last part

   copy/y "$(SolutionDir)zlib\$(Platform)\$(Configuration)\*.dll" "$(OutDir)"

and close dialog.

  • Then build the exiv2lib project.

glut

glew

  • Download GLEW source from [17] and extract to SDKROOT\glew (no version number!)
  • Then open project file glew\build\vc12\glew.sln, select Release and Win32 or x64. Then build glew_shared project.
  • Then move
    • for 32 bit
      • glew32.dll from SDKROOT\glew\bin\Release\Win32 to SDKROOT\glew\bin and
      • glew32.lib from SDKROOT\glew\lib\Release\Win32 to SDKROOT\glew\lib
    • or for 64 bit
      • glew32.dll from SDKROOT\glew\bin\Release\x64 to SDKROOT\glew\bin and
      • glew32.lib from SDKROOT\glew\lib\Release\x64 to SDKROOT\glew\lib

fftw3

lcms2

  • Download lcms2 from [18] and extract.
  • Open project file SDKROOT\lcms2-2.7\Projects\VC2013\lcms2.sln, select Release and Win32 or x64.
  • Then build project lcms2_DLL.

sqlite3

  • Download the sqlite-amalgamation and sqlite-dll-win32 from [19] and extract both files to SDKROOT\sqlite3
  • Via the nmake way. For 32 bit version use
    cl /D_USRDLL /D_WINDLL /MD /D_MBCS /DSQLITE_ENABLE_COLUMN_METADATA /D"SQLITE_API=extern __declspec(dllexport)" sqlite3.c /link /DLL /OUT:sqlite3.dll 
    lib /def:sqlite3.def

or for the 64 bit version

    cl /D_USRDLL /D_WINDLL /MD /D_MBCS /DSQLITE_ENABLE_COLUMN_METADATA /D"SQLITE_API=extern __declspec(dllexport)" sqlite3.c /link /DLL /OUT:sqlite3.dll 
    lib /def:sqlite3.def /machine:x64

gettext

  • Download gettext Binaries and Dependencies from [20] (The same version can be used for 32 and 64 bit version. We need only the binaries during building of Hugin.)
  • Create the directory SDKROOT\gettext and extract both files to this folder.

exiftool

  • Download exiftool [21] (select Windows Executable)
  • Create the directory SDKROOT\exiftool
  • Decompress the file to this folder and rename exiftool(-k).exe to exiftool.exe

panotools

enblend/enfuse

  • Download enblend/enfuse (32 or 64 bit version, should be match with Hugin architecture) from [22] and extract the archive (e.g. SDKROOT\enblend-enfuse-4.1.3-Win32 or SDKROOT\enblend-enfuse-4.1.3-Win64)

Build Hugin