Difference between revisions of "Hugin SDK (MSVC 2013)"

From PanoTools.org Wiki
Jump to: navigation, search
(The CMake way)
(libtiff)
Line 120: Line 120:
 
=== libtiff ===
 
=== libtiff ===
  
 +
* Download libtiff from [http://www.remotesensing.org/libtiff/] and extract source.
 +
* Edit file <tt>nmake.opt</tt> 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 ===
 
=== IlmBase ===

Revision as of 19:50, 18 May 2015

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). In 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 instruction 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

vigra

expat

exiv2

glut

glew

fftw3

lcms2

sqlite3

  • Download the sqlite-amalgamation and sqlite-dll-win32 from [14] 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

exiftool

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

panotools

Build Hugin