Hi Stefan,

I can probably help you out here as I’ve been down this road a few times!

Main points are:
1) Always use the same compiler to build all the dependencies (I used VS 2015 
x64)
2) Command line stuff should be from the compilers version (e.g., VS2015 x64 
Native Tools Command Prompt)
3) Have an idea how you want all the dependencies to end up (what I call the 
deploy area)
   ie, We have a libs folder that all dependencies end up in. Everything links 
to these resources.
4) Make sure that as you build dependencies, you pull in the correct 
pre-compiled inter-dependency versions.

What follows are my build notes. They are for each dependency and the version I 
used. I aimed to build both debug and release of the main tier libraries, and 
just release of the others. Things like pdb’s complicate matters but you can 
get them from debwithrelinfo builds, or just use the release one and change the 
linker flags to include /DEBUG

Your milage may vary, but should be pretty similar. Let me know if you get 
stuck anywhere along the line and I will try to help you out.
It takes quite a while to get everything ready to compile OpenImageIO, but once 
there new versions of OCIO are easier to do as the dependencies tend not to 
change much.

I’m not saying this is the on;y or best way, but it’s my way and it works for 
me ;)


BOOST (1.62.0) DEBUG AND RELEASE
 - I build debug and release, with fully decorated names using 4 processors 
(but miss out python bindings)
  - bootstrap.bat --prefix=D:/lightmap/libs-2015/boost_1_62_0
  - b2 --layout=versioned -j 4 --without-python variant=release 
address-model=64 link=shared toolset=msvc-14.0 install
  - b2 --layout=versioned -j 4 --without-python variant=debug address-model=64 
link=shared toolset=msvc-14.0 install
 - This may install to C:\ even though I have stated an install prefix!
         
GLEW (1.10.0) RELEASE-ONLY *** Only need this for OIIO Tools.
  - Open the SLN under \build\vc10\ (it will upgrade for us to vs2015)
  - Edit glew.rc (line 59) to truncate the VALUE "Comments" line (it's too long 
for visual studio!)
  - Change the C/C++->Code Generation->Runtime Libraries to Multi-Threaded DLL 
(/MD) for all projects.
  - Build release x64
  - Copy to deployment area
 
JPEG (9b) RELEASE-ONLY [STATIC LIBRARY VERSION] (Note that these instruction 
could be for 6b or the newer 9b version, but I think they would be the same)
 - Ensure you use the ZIP version of the source files
 - Go to VS command line and run:
  - INCLUDE=%INCLUDE%;C:\Program Files (x86)\Microsoft 
SDKs\Windows\v7.1A\Include;
 - nmake /f makefile.vc setup-v10
 - Open SLN.
 - Create a new x64 solution option (and projects) to target x64.
 - Build release version.
 - Copy libs and headers to deployment area

ZLIB (1.2.8) RELEASE-ONLY
 - Load contrib\vstudio\vc11\zlibvc.sln
 - Comment out VERSION line in the top of the zlibvc project zlibvc.def file
 - Build x64 release
 - Copy libs and headers to deployment area
 
LPNG (1.6.26) RELEASE-ONLY
 - Use CMake-GUI
 - Set up CMAKE_INSTALL_PREFIX to get libs in right place.
 - Set ZLIB_INCLUDE_DIR and ZLIB_LIBRARY_DEBUG/RELEASE to our lib file built 
versions.
 - Click Configure
 - Untick
  - PNG_STATIC
  - PNG_TESTS
 - Click Configure
 - Generate
 - Run SLN
  - Select x64 release
  - Build All
  - Build INSTALL project to do install step.
 
TIFF (4.0.7) RELEASE-ONLY
 - Use CMake-GUI
 - Set up CMAKE_INSTALL_PREFIX to get libs in right place.
 - Set JPEG_INCLUDE_DIR and JPEG_LIB to our built versions.
 - Set ZLIB_INCLUDE_DIR and ZLIB_LIBRARY_DEBUG/RELEASE to our lib file built 
versions.
 - Click Configure
 - Generate
 - Run SLN
  - Select x64 release
  - Build just TIF library (we don't need the rest!)
  - INSTALL didn’t work so manually copy headers and libs.
  
ILMBASE (2.2.0) DEBUG AND RELEASE
 - Use CMake-GUI
 - Click Configure
 - Run SLN
 - For each release & debug do the following:
  - Select x64 <config>
  - multi-select half, iex, iexmath, ilmthread & imath and use context menu to 
Build Selected
  - Build INSTALL project to copy files out to installprefix
  - At install prefix, create our <config> output directory and copy include 
and lib folders into it.
  
OPENEXR (2.2.0) DEBUG AND RELEASE
 - Use CMake-GUI.
 - Set ZLIB_INCLUDE_DIR and ZLIB_LIBRARY_DEBUG/RELEASE to our lib file built 
versions.
 - Generate and build for each of the Debug & Release:
  - Ensure CMAKE_INSTALL_PREFIX is correct
  - Ensure ILMBASE_PACKAGE_PREFIX is pointing to the correct built type sub 
directory  - Select x64 <config>
  - Generate and open SLN for x64 release
   - Select release x64 and select b44explogtables & dwalookups and (on context 
menu) build selected.
   - Go to your built/ilmimf/relese folder and copy all ilmbase dll's into it 
next to the exe's just built.
   - Build all (or just select ilmimf and build selected if you only want the 
libs)
   - Build INSTALL project to copy files out to our install prefix location.
  - The above process should be repeated for debug with debug ilmbase dll's 
copied.
   
TINYXML (2.6.2) *** You must use this version for use with OpenColorIO 1.0.9 
*** [RELEASE ONLY]
 - Extract archive and open SLN
 - Change tinyxmlSTL c/c++->Code Generation->Runtime Library to /MD and /MDD 
for release/debug to dynamically link to c-runtime.
 - Create an x64 build configuration
 - Build all (debug and release)
 - Copy libs and headers to deployment area
 
YAML (0.3.0) *** You must use this version for use with OpenColorIO 1.0.9 *** 
[yaml-cpp-release-0.3.0] [RELEASE ONLY]
 - Use CMake-GUI.
 - Ensure CMAKE_INSTALL_PREFIX points to deployment directory as normal 
 - Build for release and debug 
  - Change c/c++ Code generation to /MD and /MDd for release/debug to 
dynamically link to c-runtime.
  - Copy libs and headers to deployment area

OPENCOLORIO (1.0.9) DEBUG AND RELEASE
 - OpenColorIO doesn't get includes for tr1 properly so we need to fix it :(
  - Open OpenColorABI.h
   - Go to line 67 where is issues an error (trying to include tr1 stuff)
   - replace the error with the following:
    - #include <memory>
    - #define OCIO_SHARED_PTR std::tr1::shared_ptr
    - #define OCIO_DYNAMIC_POINTER_CAST std::tr1::dynamic_pointer_cast 
  - Go to MathUtils.h, FileFormatIridasltx.cpp, OpOptimizers.cpp
   - #include <algorithm>
 - Use CMake-GUI.
 - Turn OFF:
  - OCIO_BUILD_APPS
  - OCIO_BUILD_NUKE
  - OCIO_BUILD_PYGLUE
  - OCIO_BUILD_STATIC
  - OCIO_BUILD_TRUELIGHT
  - OCIO_STATIC_JNIGLUE
 - Generate, open sln, and tweak as follows - repeating for both debug and 
release.
  - Ensure CMAKE_INSTALL_PREFIX is correct
  - Set CMAKE_BUILD_TYPE capitalised
  - Generate and open SLN
   - Remove TinyXML and Yaml projects.
   - OpenColorIO project properties changes
    - Change C/C++ Additional Include Directories to include the yaml and 
tinyxml includes we have built for current x64 project
    - Update Linker->Input->Additional Dependencies to the newly build xaml and 
tinyxmlSTL libs for current x64 project
     - Watch that YAML built with the name ending md in release and mdd in 
debug!
   - The 2nd time you run cmake you will need to apply the OpenColorABI.h 
changes again.
   - Build all
   - Build INSTALL project to copy files out to our install prefix location.
        
OPENIMAGEIO (1.7.10) DEBUG AND RELEASE
 - Use CMake-GUI.
 - Turn OFF:
  - OIIO_BUILD_TESTS
  - OIIO_BUILD_TOOLS (We can turn this on, but will have to fix up sln after if 
not using Qt4)
  - BUILD_TESTING
  - BUILD_STATIC
  - USE_PYTON
 - Turn ON:
  - USE_OPENSSL (If you have openssl compiled and want faster sha1 
calculations).
 - Set up paths to:
  - TIFF_INCLUDE_LIBRARY_DEBUG/RELEASE (point both to release as that is all we 
built).
  - LIB_EAY/SSL_EAY folders to our compiled ones.
  - Click Configure  
  - ZLIB_INCLUDE_LIBRARY_DEBUG/RELEASE (point both to release as that is all we 
built).
  - Click Configure
  - PNG_INCLUDE_LIBRARY_DEBUG/RELEASE (point both to release as that is all we 
built).
  - Click Configure
  - Set ILMBASE_INCLUDE_PATH
  - Set OPENEXR_INCLUDE_PATH
  - Set OPENEXR_XXX_LIBRARY files (HALF, IEX, ILMIMF, ILMTHREAD, IMATH) to 
build type
  - Click Configure
  - Set BOOST_INCLUDE_DIR
  - Click Configure
  - Set JPEG include and lib paths (just the one and point to release as that 
is all we built).
  - Set OCIO include paths to build type (libs need build type - see below)
 - Generate and build for each of the Debug and Release:
  - Note that it's just the libraries that need changing, not the includes.
  - Ensure CMAKE_INSTALL_PREFIX is correct
  - Set CMAKE_BUILD_TYPE capitalised
  - Set OPENEXR_XXX_LIBRARY files (HALF, IEX, ILMIMF, ILMTHREAD, IMATH) to 
build type
  - Set OPENEXR_LIBRARIES are updated for all references in the entry to the 
correct build type.
  - Set ILMBASE_LIBRARIES are updated for all references in the entry to the 
correct build type.
  - Set OCIO_LIBRARIES paths are updated to the correct build type.
  - Copy libs and headers to deployment area
 
 - To get IV to generate from CMake (for use with Qt5)
  - Toggle on OIIO_BUILD_TOOLS for release build. 
  - Open the \src\iv\CMakeLists.txt
   - Remove the if (QT4_FOUND AND OPENGL_FOUND AND GLEW_FOUND) statement (and 
else part at the end).
   - This will make CMake create a base IV project in the tools section.
  - Open the SLN, switch to Release x64
  - Select "iv" and context->project only->build
  - You will get build errors relating to includes. For me these were (because 
using Qt5 and not Qt4)
    - Add your include path for Qt
        - Ensure/Add the following libs to the Linker->General->Additional 
Library Directories:
      - Qt libs directory
          - Glew libs directory
          - WinSDK libs directory (eg C:\Program Files (x86)\Microsoft 
SDKs\Windows\v7.1A\Lib\x64)
        - Under the Linker->Input add the following libs
          - Qt5Core.lib
          - Qt5Gui.lib
          - Qt5Widgets.lib
          - Qt5OpenGL.lib
          - Qt5PrintSupport.lib
          - glew32.lib
          - OpenGL32.lib
        - The following headers are now under QtWidgets and not QtGui:
          - QApplication, QAction, QCheckBox, QComboBox, QDialog, QMainWindow, 
QDesktopWidget, QFileDialog, QLabel, QMenu, QMenuBar, QMessageBox, 
QProgressBar, QSpinBox, QStatusBar, QPushButton, QScrollArea, QVBoxLayout
        - The following are now under QtPrintSupport and not QtGui:
          - QPrinter
        - I had to update the custom command for compiling the iv/CMake 
Rules/moc_*.rule files
         - Bring up the properties for each of these 2 files
         - Go to Configuration Properties -> Custom Build Tool -> General
         - I had to add <xxx>\bin\moc.exe to the start of the 2nd line (before 
the  ..\..\..\src\iv\ivgl.h -o bit)
           - <xxx> is the path to your Qt root directory to pick up the moc.exe 
program.
    - Build the release x64 and copy the /src/iv/Release iv.exe to deployment 
area.



Best Regards,
   Simon

---
Simon C Smith
Co-Founder & CTO
www.lightmap.co.uk

Email confidentiality notice:
This message is private and confidential. If you have received this message in 
error, please notify us and remove it from your system.

> On 24 Feb 2017, at 08:54, Stefan Achmüller <[email protected]> 
> wrote:
> 
> Hi,
> 
> I'm trying to build OpenImageIO on a windows-machine, but till now, without 
> success! Is somebody on the mailinglist, that has a description on how to 
> build it? Or is someone here, who is also trying to run it on windows?
> 
> I managed to build all the 3rd-party libraries, but if I want to build 
> OpenImageIO with cmake, i get some linker-errors (seems like some of the 3rd 
> party libs where build wrong ...)
> 
> best regards,
> stefan
> _______________________________________________
> Oiio-dev mailing list
> [email protected] <mailto:[email protected]>
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org 
> <http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org>
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to