This page will document how to build the game's Windows dependencies, useful for updating them to newer versions.

This is a work in progress and incomplete. It can also include libraries that are not (yet) dependencies.

boost

Note: bcp will be used to generate a subset of Boost libs from the game's source code.

Note: This works as well with VS 2015 and 2017, just start the correct Tools Command Prompt and replace the toolset version by 14.0_xp or 14.1_xp.

  • Command line MSVC build:
    • Download Boost Windows source archive and extract somewhere (X:\path\to\boost_x_xx_x)
    • Run VS2013 x86 Native Tools Command Prompt from the start menu (under Visual Studio 2013 > Visual Studio Tools)
    • Change directory to Boost source location
      cd X:\path\to\boost_x_xx_x
      md minimal
      
    • Run bootstrapper to build Boost.Build
      bootstrap.bat
      
    • Build bcp tool
      b2.exe tools/bcp
      
    • Run bcp on game's source code (from X:\path\to\source) to generate subset of Boost libs in minimal\:
      SET 0ad_source=X:\path\to\source
      FOR /f "tokens=*" %i IN ('dir /s /b %0ad_source%\*.cpp %0ad_source%\*.h %0ad_source%\*.hpp') DO dist\bin\bcp.exe --scan --boost=X:\path\to\boost_x_xx_x %i minimal >> bcp.log 2>&1
      
    • Copy these files to minimal\ (bcp can be used to do this, if desired):
      • b2.exe
      • bjam.exe
      • boostcpp.jam
      • boost-build.jam
      • project-config.jam
      }}}
    • Copy tools to minimal\tools
    • Copy libs\config to minimal\libs\config
    • Build filesystem and system libs into minimal\stage directory with the XP support toolset
      cd minimal
      b2.exe --with-filesystem --with-system --toolset=msvc-12.0_xp variant=debug,release link=static runtime-link=shared threading=multi stage
      
    • stage\lib contains debug and release multithreaded static libs to copy into libraries\win32\boost\lib:
      • libboost_system-vc120-mt-x_xx.lib
      • libboost_system-vc120-mt-gd-x_xx.lib
      • libboost_filesystem-vc120-mt-x_xx.lib
      • libboost_filesystem-vc120-mt-gd-x_xx.lib
    • minimal\boost contains headers to copy into libraries\win32\boost\include

enet

  • Download the latest source code from http://enet.bespin.org/Downloads.html.
  • Follow the instructions at http://enet.bespin.org/Installation.html:
    • Open enet.dsp and upgrade the project.
    • In the project properties:
      • For all configurations, add ws2_32.lib and winmm.lib to the list of linked libraries.
      • For the Debug configuration, add the d suffix to the Target name so it becomes $(ProjectName)d.
    • Build the Debug and Release versions.
    • In the project properties, for all configurations, change the target type to a DLL. Add ENET_DLL to the list of preprocessor definitions.
    • Build the Debug and Release versions once more.
  • Copy Debug/enetd.lib and Release/enet.lib to libraries/win32/enet/lib/
  • Copy Debug/enetd.dll and Release/enet.dll to binaries/system/
  • Copy include/enet to libraries/win32/enet/include/

FCollada

  • Open libraries/source/fcollada/src/FCollada/FCollada.sln in VS. Let it upgrade the project.
  • Switch to v120_xp toolset for compatibility with WinXP:
    • Open the properties for the FCollada project
    • Change the Configuration to All Configurations
    • Change Platform Toolset to Visual Studio 2013 - Windows XP (v120_xp)
  • Build Debug DLL Win32 and Release DLL Win32. Ignore the Unicode and Retail configurations.
  • In both configurations, FColladaTest will fail to link. This is not an issue. You can delete the FColladaTest project if you want to feel better about the build output.
  • Next to FCollada.sln, there is now an Output directory.
    • Copy Output/FColladaD.lib and Output/FCollada.lib to libraries/source/fcollada/lib/.
    • Copy Output/Debug DLL Win32/FColladaD.dll and Output/Release DLL Win32/FCollada.dll.
    • If you need the debug symbols, they are in Output/Debug DLL Win32/FCollada/FCollada.pdb.

gloox

  • Download the latest 1.0.x source code from https://camaya.net/gloox/download/.
  • Decompress and open gloox.vcproj in VS. Let it upgrade the project.
  • Fix the Debug configuration:
    • Right-click the gloox-1.0 project and click Properties
    • Copy-paste the Output directory value from the Release project (it should be $(SolutionDir)$(Configuration)\ instead of some hardcoded thing)
    • Add the d suffix to the Target name so it becomes $(ProjectName)d
  • Fix the compilation failure by adding iodata.h and iodata.cpp to the project (see http://stackoverflow.com/questions/28319149/)
  • Build the Release and Debug configurations
  • Copy Debug/gloox-1.0d.lib and Release/gloox-1.0.lib to libraries/win32/gloox/lib/
  • Copy Debug/gloox-1.0d.dll and Release/gloox-1.0.dll to binaries/system/
  • Copy all the header files from src to libraries/win32/gloox/include/gloox

Now we need to rebuild the glooxwrapper project. Just run update-workspaces.bat with the argument --build-shared-glooxwrapper and build the Release and Debug configurations of the game.

libcurl

Note: the included CMake scripts are outdated, but there are also untested makefiles for a command line build

  • Bundled MSVC project:
    • Download libcurl source and extract somewhere
    • Open projects\Windows\VC12\curl-all.sln
    • Switch to v120_xp toolset for compatibility with WinXP:
      • Open the properties for the libcurl project
      • Change the Configuration to All Configurations
      • Change Platform Toolset to Visual Studio 2013 - Windows XP (v120_xp)
    • Build both DLL Debug - DLL Windows SSPI and DLL Release - DLL Windows SSPI configurations (in order to enable native SSL support).
    • Binaries are located in build\Win32\VC12\DLL Debug\ and build\Win32\VC12\DLL Release\
      • Copy the *.dll files to binaries\system, *.lib files to libraries\win32\libcurl\lib
    • Copy the *.h files from include\curl to libraries\win32\libcurl\include\curl

libiconv

Note: iconv doesn't support MSVC anymore, only mingw and cygwin

  • Create Visual Studio project:

http://www.codeproject.com/Articles/302012/How-to-Build-libiconv-with-Microsoft-Visual-Studio

libicu

Note: Visual Studio projects are included for VS2010, building with a newer version requires the following procedure

  • Cygwin-based MSVC build:
    • Install Cygwin with bash, GNU make, ar, ranlib, man
    • Download libicu .zip source and extract somewhere
    • Open Windows command prompt
    • Create build and install directories for organization:
      cd icu
      md install
      cd source
      md build
      cd build
      
    • Set MSVC build environment by running
      "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat"
      
    • Add Cygwin bin directory to path (e.g. X:\cygwin64\bin)
      SET path=%path%;X:\cygwin64\bin
      
    • Set recommended ICU build flags (see build documentation)
      SET CPPFLAGS=-DU_USING_ICU_NAMESPACE=0 -DUNISTR_FROM_CHAR_EXPLICIT=explicit -DUNISTR_FROM_STRING_EXPLICIT=explicit -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1
      
    • Configure XP-compatible platform toolset (based on Windows XP Targeting with C++ in Visual Studio 2012)
      SET INCLUDE=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Include;%INCLUDE%
      SET PATH=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Bin;%PATH%
      SET LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Lib;%LIB%
      SET CL=/D_USING_V110_SDK71_
      SET LINK=/SUBSYSTEM:WINDOWS,5.01
      
    • Build and install to X:/path/to/install (note forward slashes -- this runs in Bash!)
      bash ../runConfigureICU Cygwin/MSVC --prefix=X:/path/to/install
      make
      make check
      make install
      
    • X:\path\to\install\lib will contain the .dlls and .libs
    • X:\path\to\install\include will contain the header files

libpng

Note: Depends on zlib, so if you're building it too, do that first. Note down the install path where CMake installed the zlib build output.

  • CMake GUI-based build:
    • Download libpng source .zip and extract somewhere (X:\path\to\lpng1xxx)
    • Open cmake-gui (v3.8 in this example)
    • Set source location to the X:\path\to\lpng1xxx
    • Set build location to X:\path\to\lpng1xxx\build (so the build files will be separate from the source)
    • Press Configure
      • Choose Yes to create the build directory if it doesn't exist
    • Choose Visual Studio 12 2013 default native compiler as generator. Set the value of Optional toolset to use to v120_xp (to use the XP compatible toolset), then Finish
    • There should be an error because it can't find zlib yet
    • Set ZLIB_ROOT to the install path of the zlib build output
    • Change CMAKE_INSTALL_PREFIX to X:\path\to\lpng1xxx\installdir (install is not possible because of the existing INSTALL file)
    • Press Configure until there are no errors or red entries
    • Press Generate
    • Press Open project
    • Open png project properties, select Debug configuration. Under Configuration Properties > Linker > Input > Additional Dependencies, add a "d" onto the end of the zlib1 .lib filename (so it uses the zlib debug build in this case)
    • Optional DLL version info: Right-click on the png project, click Add > Existing element and select lpng1xxx\scripts\pngwin.rc
    • Build solution for Debug configuration, there should be no errors. Build the INSTALL project to copy files to the install folders set up earlier
    • Repeat for Release configuration
    • lpng1xxx\installdir should contain the newly built libs

libsodium

Download the latest source from https://download.libsodium.org/libsodium/releases/.

It contains a folder builds/msvc/ with all the solutions for recent and old versions of Visual Studio. Pick yours.

Open Project > Properties.

  • Select All configurations and change the toolset to support target XP.
  • Select all Debug configurations (either one by one or with the multiple selection tool) and change Target Name so that d is added to the filename base (for instance $(TargetName)d instead of $(TargetName)).
  • Build both Dynamic configurations.
  • Copy bin/Win32/{Debug,Release}/[toolset]/dynamic/libsodium{d,}.dll to binaries/system/.
  • Copy bin/Win32/{Debug,Release}/[toolset]/dynamic/libsodium{d,}.lib to libraries/win32/libsodium/lib/.
  • Copy headers to libraries/win32/libsodium/include/. It looks like the build doesn't create a minimal folder of headers, so my advice is downloading the zip with prebuilt libs for msvc from the download page and using the include folder from that.

libxml2

Note: Depends on iconv, so if you're building it too, do that first.

  • Command line MSVC build:
    • Download libxml2 source tarball and extract somewhere (X:\path\to\libxml2-x.x.x)
    • Open Windows command prompt in the libxml2-x.x.x\win32 subdirectory
    • Run configure script to install in X:\path\to\install and pull in iconv lib from X:\path\to\iconv (for SVN, this is libraries\win32\iconv)
      cscript configure.js compiler=msvc prefix=X:\path\to\install include=X:\path\to\iconv\include lib=X:\path\to\iconv\lib
      
      Note: spaces are NOT allowed in these paths!
    • There should be no errors if it completed successfully
    • Set MSVC build environment
      "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat"
      
    • Configure XP-compatible platform toolset (based on Windows XP Targeting with C++ in Visual Studio 2012)
      SET INCLUDE=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Include;%INCLUDE%
      SET PATH=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Bin;%PATH%
      SET LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Lib;%LIB%
      SET CL=/D_USING_V110_SDK71_
      SET LINK=/SUBSYSTEM:WINDOWS,5.01
      
    • Modify Makefile.msvc to search for correct libiconv lib:
      !if "$(WITH_ICONV)" == "1"
      LIBS = $(LIBS) libiconv.lib
      !endif
      
    • Build and install
      nmake /f Makefile.msvc
      nmake /f Makefile.msvc install
      

OpenAL Soft

  • CMake GUI-based build:
    • Download and install Microsoft DirectX SDK (June 2010)
    • Download OpenAL-Soft source and extract somewhere (X:\path\to\openal-soft-x.xx.x)
    • Open cmake-gui (v3.2 in this example)
    • Set source location to the X:\path\to\openal-soft-x.xx.x folder
    • Set build location to X:\path\to\openal-soft-x.xx.x\build (this way the build files will be separate from the source)
    • Press Configure
      • Choose Yes to create the build directory if it doesn't exist
    • Choose Visual Studio 12 2013 default native compiler as generator, then Finish
    • Add Entry, CMAKE_GENERATOR_TOOLSET as a String, and set the value to v120_xp (to use the XP compatible toolset)
    • Change CMAKE_INSTALL_PREFIX to X:\path\to\openal-soft-x.xx.x\install
    • Uncheck/turn off ALSOFT_UTILS
    • Press Configure until there are no errors or red entries (warnings are OK)
    • Press Generate
    • In X:\path\to\openal-soft-x.xx.x\build, there should be an OpenAL.sln solution you can open in Visual Studio 2013. Open it
    • Build solution for Release configuration
      • Build the INSTALL project by right-clicking on it (to copy files to the install folders set up earlier)
    • openal-soft-x.xx.x\install should contain all the newly built libs

zlib

  • CMake GUI-based build:
    • Download zlib source .zip and extract somewhere (X:\path\to\zlib-x.x.x)
    • We will start by fixing the target name for the built library. In X:\path\to\zlib-x.x.x\CMakeLists.txt, find the line that adds the 1 to the DLL name.
      Replace:
      set_target_properties(zlib PROPERTIES SUFFIX "1.dll")
      by:
      set_target_properties(zlib PROPERTIES OUTPUT_NAME "zlib1")
      
      That way, the debug DLL will be called zlib1d.dll and not zlibd1.dll. See https://github.com/madler/zlib/issues/273.
    • Open cmake-gui (v3.8 in this example)
    • Set source location to the X:\path\to\zlib-x.x.x folder
    • Set build location to X:\path\to\zlib-x.x.x\build (this way the build files will be separate from the source)
    • Press Configure
      • Choose Yes to create the build directory if it doesn't exist
    • Choose Visual Studio 12 2013 default native compiler as generator. Set the value of Optional toolset to use to v120_xp (to use the XP compatible toolset), then Finish
    • Change CMAKE_INSTALL_PREFIX to X:\path\to\zlib-x.x.x\install
    • Delete all the INSTALL_* group entries and press Configure again. They should now all follow the path you specified during the previous step
    • Add a new BUILD_SHARED_LIBS entry and set its value to TRUE
    • Press Configure until there are no errors or red entries
    • Press Generate
    • Press Open project
    • Build solution for Debug configuration, there should be no errors
      • Build the INSTALL project by right-clicking on it (to copy files to the install folders set up earlier)
    • Repeat for Release configuration
    • zlib-x.x.x\install should contain all the newly built libs
Last modified 5 months ago Last modified on Aug 31, 2018, 5:27:00 PM