Building Windows VS2017 External Dependencies - acidrainstudios/TrueReality GitHub Wiki

Building External Dependencies

True Reality v0.2-Dev Dependencies List

For best results, build the dependencies in the order they are listed. Some of them depend on the ones that were build before them.

First, Setup all the TR Environmental Variables

Note:
Our Ext folder is on D:/Development/TrueReality/Ext Yours will be somewhere else, so you will need to adjust accordingly.
We suggest placing the Ext folder in your TR directory, the same place where you are pointing with %TR_ROOT%. This document will assume you placed the Ext folder in %TR_ROOT%\Ext

Windows

    1. GLEW 2.1.0
      • Download GLEW 2.1.0
      • Run CMake with CmakeLists.txt in the build\cmake folder.
      • Press Configure
      • Select Visual Studio 15 2017 Win64, press Finish
      • In CMAKE change CMAKE_CONFIGURATION_TYPES to Debug;Release
      • Change CMAKE_INSTALL_PREFIX to D:/Development/TrueReality/Ext (This is where my Ext folder is, you need to point your path to yours.)
      • Press Configure, Press Generate.
      • Open The Visual Studio Solution that is generated in VS.
      • Go to BUILD>Batch Build, select ALL_BUILD Debug and Release, and click Build
      • Go to BUILD>Batch Build, click Deselect All, select INSTALL Debug and Release, and click Build
    1. Boost 1.70.0
      • If you prefer to use a prepped version of this dependency, it can be downloaded on the release page.
      • If you prefer to build this from scratch:
      • Download the Boost source files, we are using v1.70.0 (boost_1_70_0.zip)
      • Open VS2017 x64 Native Tools Command Prompt as Administrator, and maneuver to the Boost folder.
      • Type in >bootsrap.bat, and press enter.
      • Type in >b2 tools/bcp and press enter.
      • Type in >dist\bin\bcp.exe --namespace=bID --scan --boost=. %TR_ROOT%\include\trBase\UniqueIdBoost.h %TR_ROOT%\Ext\include and press enter.
      • Rename the boost folder that was created in the Ext folder to bID
      • In your favorite text editor (We use Visual Studio) open the bID folder and do a search and replace in all files for boost/ and change it to bID/
      • Next, do a replace on all files searching for BOOST_ and changing it to BID_
    1. JSONCpp 1.8.4
      • Open CmakeLists.txt. After all the OPTION settings, after line 14, add SET (CMAKE_DEBUG_POSTFIX "d")
      • Run CMake
      • Press Configure
      • Select Visual Studio 15 2017 Win64, press Finish
      • In CMAKE change CMAKE_CONFIGURATION_TYPES to Debug;Release
      • Change CMAKE_INSTALL_PREFIX to D:/Development/TrueReality/Ext (This is where my Ext folder is, you need to point your path to yours.)
      • In BUILD, select BUILD_SHARED_LIBS and deselect BUILD_STATIC_LIBS
      • In JSONCPP deselect JSONCPP_WITH_TESTS, JSONCPP_WITH_POST_BUILD_UNITTEST, JSONCPP_WITH_PKGCONFIG_SUPPORT, and select JSONCPP_WITH_CMAKE_PACKAGE
      • Press Configure, Press Generate.
      • Open The Visual Studio Solution that is generated in VS.
      • Go to BUILD>Batch Build, select ALL_BUILD Debug and Release, and click Build
      • Go to BUILD>Batch Build, click Deselect All, select INSTALL Debug and Release, and click Build
    1. Google Test 1.8.1
      • Open CMakeLists.txt and add #Sets the postfix on libraries. set (CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Set Debug library postfix" FORCE)
        on the line after project( googletest-distribution ) command.
      • Run CMake
      • Press Configure
      • Select Visual Studio 15 2017 Win64, press Finish
      • In BUILD select BUILD_SHARED_LIBS
      • In CMAKE change CMAKE_CONFIGURATION_TYPES to Debug;Release
      • Change CMAKE_INSTALL_PREFIX to D:/Development/TrueReality/Ext (This is where my Ext folder is, you need to point your path to yours.)
      • Press Configure, Press Generate.
      • Open The Visual Studio Solution that is generated in VS.
      • Go to BUILD>Batch Build, select ALL_BUILD Debug and Release, and click Build
      • Go to BUILD>Batch Build, click Deselect All, select INSTALL Debug and Release, and click Build
    1. Zlib 1.2.11
      • Run CMake
      • Press Configure
      • Select Visual Studio 15 2017 Win64, press Finish
      • In CMAKE change CMAKE_CONFIGURATION_TYPES to Debug;Release
      • Change CMAKE_INSTALL_PREFIX to D:/Development/TrueReality/Ext (This is where my Ext folder is, you need to point your path to yours.)
      • In INSTALL change all paths to point to your Ext folder. C:\Program Files\Zlib\bin to D:/Development/TrueReality/Ext/bin, etc etc
      • Press Configure, Press Generate.
      • Open The Visual Studio Solution that is generated in VS.
      • Go to BUILD>Batch Build, select ALL_BUILD Debug and Release, and click Build
      • Go to BUILD>Batch Build, click Deselect All, select INSTALL Debug and Release, and click Build
      • Delete the share folder that is created in Ext
    1. FFMpeg 3.4.4
      • MSYS2

        • Download and run the installer at ​http://msys2.github.io.
        • Follow the instructions and install it in C:\workspace\windows\msys64
        • Run MSys after installation
        • Install required tools by typing in: pacman -S make gcc diffutils
        • Rename C:\workspace\windows\msys64\usr\bin\link.exe to C:\workspace\windows\msys64\usr\bin\link_orig.exe, in order to use MSVC link.exe (naming conflict)
      • YASM

        • Download yasm--win64.exe and move it to C:\workspace\windows
        • Rename yasm--win64.exe to yasm.exe
        • Add C:\workspace\windows to PATH environment variable (setx PATH "%PATH%;C:\workspace\windows)
      • Launch msys2 shell from Visual Studio Code shell

        • Run VS2017 x64 Native Tools Command Prompt in ADMIN mode
        • Run C:\workspace\windows\msys64\msys2_shell.cmd -use-full-path :will open msys2 shell inheriting %PATH% from VS2017 prompt
        • Check path in MSYS by running: printenv PATH
        • Ensure that the cl and link point to MSVC in MSYS window by typing in: which cl and which link
        • cd /c/path/to/ffmpeg (or where ever it is installed)
        • ./configure --toolchain=msvc --arch=x86_64 --enable-shared --enable-yasm --enable-asm --disable-static --prefix=/D/Development/TrueReality/Ext
        • make -jxx (Where xx is the number of cores you have)
        • make install
        • Delete the share folder that was created in D:/Development/TrueReality/Ext folder.
    1. LibJpeg 9c
      • Copy Win32.Mak from C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include to jpeg-9c folder
      • Run VS2017 x64 Native Tools Command Prompt in Admin mode
      • Navigate to the jpeg-9c folder
      • nmake -f makefile.vc setup-v15
      • Open the created jpeg.sln in VS2017, update the project
      • In the Configuration Manager, create a x64 profile, and set up an additional Debug build with file output that has a "d" "Target Name" $(ProjectName)d suffix.
      • Remove NDEBUG from the Processor line in the debug profile
      • Go to BUILD>Batch Build, select Debug and Release, and click Build
      • Copy jpeg.lib and jpegd.lib to the D:\Development\TrueReality\Ext\lib folder
      • Copy jconfig.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h jpegint.h jpeglib.h jversion.h to the D:\Development\TrueReality\Ext\include folder
    1. LibTiff 4.0.9
      • Run CMake
      • Press Configure
      • Select Visual Studio 15 2017 Win64, press Finish
      • In CMAKE change CMAKE_CONFIGURATION_TYPES to Debug;Release
      • Add /MP on the end of CMAKE_CXX_FLAGS
      • Change CMAKE_INSTALL_PREFIX to D:/Development/TrueReality/Ext (This is where my Ext folder is, you need to point your path to yours.)
      • Press Configure
      • Fix the ZLib paths
      • Press Configure, Press Generate.
      • Open The Visual Studio Solution that is generated in VS.
      • Go to BUILD>Batch Build, select ALL_BUILD Debug and Release, and click Build
      • Go to BUILD>Batch Build, click Deselect All, select INSTALL Debug and Release, and click Build
      • Delete the share folder that is created in Ext
    1. LibPng 1.6.32
      • Run CMake
      • Press Configure
      • Select Visual Studio 15 2017 Win64, press Finish
      • Fix the ZLib paths
      • Press Configure
      • In CMAKE Add /MP on the end of CMAKE_C_FLAGS
      • Change CMAKE_INSTALL_PREFIX to D:/Development/TrueReality/Ext (This is where my Ext folder is, you need to point your path to yours.)
      • In PNG uncheck PNG_TESTS
      • Press Configure, Press Generate.
      • Open The Visual Studio Solution that is generated in VS.
      • Go to BUILD>Batch Build, select ALL_BUILD Debug and Release, and click Build
      • Go to BUILD>Batch Build, click Deselect All, select INSTALL Debug and Release, and click Build
      • Delete the share folder that is created in Ext
    1. GDAL 2.2.4
      • Download GDAL 2.2.4
      • Run VS2017 x64 Native Tools Command Prompt in Admin mode
      • Navigate to the GDAL folder
      • Open nmake.opt and edit GDAL_HOME to say: GDAL_HOME = "C:\MyMainData\Development\TrueReality\Ext" (but with your Ext path)
      • Type in: generate_vcxproj.bat 15.0 64 gdal_vs2017
      • Type in: nmake -f makefile.vc MSVC_VER=1910 WIN64=1 devinstall
      • Delete the data and html folders that are created in Ext
    1. FreeType 2.9
      • Run CMake
      • Press Configure
      • Select Visual Studio 15 2017 Win64, press Finish
      • In CMAKE change CMAKE_CONFIGURATION_TYPES to Debug;Release
      • Change CMAKE_INSTALL_PREFIX to D:/Development/TrueReality/Ext (This is where my Ext folder is, you need to point your path to yours.)
      • Delete PNG_LIBRARY_DEBUG, PNG_LIBRARY_RELEASE, PNG_PNG_INCLUDE_DIR. OSG will not build with freetype png support.
      • Press Configure, Press Generate.
      • Open The Visual Studio Solution that is generated in VS.
      • Go to BUILD>Batch Build, select ALL_BUILD Debug and Release, and click Build
      • Go to BUILD>Batch Build, click Deselect All, select INSTALL Debug and Release, and click Build
    1. OpenSceneGraph 3.6.4
      • Run CMake
      • Press Configure
      • Select Visual Studio 15 2017 Win64, press Finish
      • In CMAKE change CMAKE_CONFIGURATION_TYPES to Debug;Release
      • Change CMAKE_INSTALL_PREFIX to D:/Development/TrueReality/Ext (This is where my Ext folder is, you need to point your path to yours.)
      • Turn off OSG_USE_FLOAT_BOUNDINGBOX and OSG_USE_FLOAT_BOUNDINGSPHERE
      • In WIN32 turn on WIN32_USE_MP
      • Fix ZLib paths if needed
      • Fix TIFF paths if needed
      • Fix JPeg paths if needed
      • Fix GDAL paths if needed
      • Fix FFMpeg paths if needed
      • Press Configure, Press Generate.
      • Open The Visual Studio Solution that is generated in VS.
      • Go to BUILD>Batch Build, select ALL_BUILD Debug and Release, and click Build
      • Go to BUILD>Batch Build, click Deselect All, select INSTALL Debug and Release, and click Build
    1. Final Edits
      • Some projects place their .lib files in the Bin folder instead of Lib, we want to move them all to the Lib.
      • Find and Move all *.lib files from D:/Development/TrueReality/Ext/bin to D:/Development/TrueReality/Ext/lib
⚠️ **GitHub.com Fallback** ⚠️