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. [[TOC(inline)]] == boost == '''Note:''' [http://www.boost.org/doc/libs/1_60_0/tools/bcp/doc/html/index.html bcp] will be used to generate a subset of Boost libs from the game's source code. * Command line MSVC build: * [http://www.boost.org/users/download/ 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 {{{ #!application/x-dos-batch cd X:\path\to\boost_x_xx_x md minimal }}} * Run bootstrapper to build Boost.Build {{{ #!application/x-dos-batch bootstrap.bat }}} * Build '''bcp''' tool {{{ #!application/x-dos-batch b2.exe tools/bcp }}} * Run '''bcp''' on game's source code (from `X:\path\to\source`) to generate subset of Boost libs in `minimal\`: {{{ #!application/x-dos-batch 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 {{{ #!application/x-dos-batch cd minimal b2.exe --with-filesystem --with-system --toolset=msvc 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/` == 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: * [http://curl.haxx.se/download.html 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''' and '''DLL Release''' configurations * 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: * [https://cygwin.com/install.html Install Cygwin] with bash, GNU make, ar, ranlib, man * [http://site.icu-project.org/download Download libicu] .zip source and extract somewhere * Open Windows command prompt * Create build and install directories for organization: {{{ #!application/x-dos-batch cd icu md install cd source md build cd build }}} * Set MSVC build environment by running {{{ #!application/x-dos-batch "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat" }}} * Add Cygwin bin directory to path (e.g. `X:\cygwin64\bin`) {{{ #!application/x-dos-batch SET path=%path%;X:\cygwin64\bin }}} * Set recommended ICU build flags (see build documentation) {{{ #!application/x-dos-batch 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 [http://blogs.msdn.com/b/vcblog/archive/2012/10/08/10357555.aspx Windows XP Targeting with C++ in Visual Studio 2012]) {{{ #!application/x-dos-batch 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!) {{{ #!sh 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. * CMake GUI-based build: * [http://www.libpng.org/pub/png/libpng.html Download libpng] source .zip and extract somewhere (`X:\path\to\lpng1xxx`) * Open cmake-gui (v3.2 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, then Finish * There should be an error because it can't find zlib yet * Set `ZLIB_INCLUDE_DIR` to the path to the zlib headers (in SVN, that is `libraries\win32\zlib\include`) * Set `ZLIB_LIBRARY` to the path to the zlib static lib (in SVN, that is `libraries\win32\zlib\lib\zlib1.lib`) * '''Note:''' this is only for the release build, we'll fix that later * 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\lpng1xxx\install` * Press '''Configure''' until there are no errors or red entries * Press '''Generate''' * In `lpng1xxx\build`, there should be a `libpng.sln` solution you can open in Visual Studio 2013. Open it * Open '''png1x''' project properties, select '''Debug''' configuration. Under '''Configuration Properties > Linker > Input > Additional Dependencies''', add a "d" onto the end of the zlib .lib filename (so it uses the zlib debug build in this case) * Optional DLL version info: add `lpng1xxx\scripts\pngwin.rc` as a source file in the png1x project * 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\install` should contain the newly built libs == libxml2 == '''Note:''' Depends on iconv, so if you're building it too, do that first. * Command line MSVC build: * [ftp://xmlsoft.org/libxml2/ 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) {{{ #!application/x-dos-batch 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 {{{ #!application/x-dos-batch "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat" }}} * Configure XP-compatible platform toolset (based on [http://blogs.msdn.com/b/vcblog/archive/2012/10/08/10357555.aspx Windows XP Targeting with C++ in Visual Studio 2012]) {{{ #!application/x-dos-batch 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 {{{ #!application/x-dos-batch nmake /f Makefile.msvc nmake /f Makefile.msvc install }}} == OpenAL Soft == * CMake GUI-based build: * [https://www.microsoft.com/en-us/download/details.aspx?id=6812 Download] and install Microsoft DirectX SDK (June 2010) * [http://kcat.strangesoft.net/openal.html 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: * [http://www.zlib.net/ Download zlib source] .zip and extract somewhere (`X:\path\to\zlib-x.x.x`) * 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 * Rename the static libs to add the `1` to the file names.