Changes between Initial Version and Version 1 of BuildingWindowsDependencies


Ignore:
Timestamp:
Jan 24, 2016, 3:54:47 AM (8 years ago)
Author:
historic_bruno
Comment:

Initial version

Legend:

Unmodified
Added
Removed
Modified
  • BuildingWindowsDependencies

    v1 v1  
     1This page will document how to build the game's Windows dependencies, useful for updating them to newer versions.
     2
     3This is a work in progress and incomplete.
     4
     5[[TOC(inline)]]
     6
     7== boost ==
     8
     9'''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.
     10
     11* Command line MSVC build:
     12        * [http://www.boost.org/users/download/ Download Boost] Windows source archive and extract somewhere (`X:\path\to\boost_x_xx_x`)
     13        * Run '''VS2013 x86 Native Tools Command Prompt''' from the start menu (under Visual Studio 2013 > Visual Studio Tools)
     14        * Change directory to Boost source location
     15        {{{
     16        #!application/x-dos-batch
     17        cd X:\path\to\boost_x_xx_x
     18        md minimal
     19        }}}
     20        * Run bootstrapper to build Boost.Build
     21        {{{
     22        #!application/x-dos-batch
     23        bootstrap.bat
     24        }}}
     25        * Build '''bcp''' tool
     26        {{{
     27        #!application/x-dos-batch
     28        b2.exe tools/bcp
     29        }}}
     30        * Run '''bcp''' on game's source code (from `X:\path\to\source`) to generate subset of Boost libs in `minimal\`:
     31        {{{
     32        #!application/x-dos-batch
     33        SET 0ad_source=X:\path\to\source
     34        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
     35        }}}
     36        * Copy these files to `minimal\` ('''bcp''' can be used to do this, if desired):
     37          * `b2.exe`
     38          * `bjam.exe`
     39          * `boostcpp.jam`
     40          * `boost-build.jam`
     41          * `project-config.jam`
     42        }}}
     43        * Copy `tools` to `minimal\tools`
     44        * Copy `libs\config` to `minimal\libs\config`
     45        * Build filesystem and system libs into `minimal\stage` directory
     46        {{{
     47        #!application/x-dos-batch
     48        cd minimal
     49        b2.exe --with-filesystem --with-system --toolset=msvc variant=debug,release link=static runtime-link=shared threading=multi stage
     50        }}}
     51        * `stage\lib` contains debug and release multithreaded static libs to copy into `libraries\win32\boost\lib`:
     52          * `libboost_system-vc120-mt-x_xx.lib`
     53          * `libboost_system-vc120-mt-gd-x_xx.lib`
     54          * `libboost_filesystem-vc120-mt-x_xx.lib`
     55          * `libboost_filesystem-vc120-mt-gd-x_xx.lib`
     56        * `minimal\boost` contains headers to copy into `libraries\win32\boost\include`
     57
     58== libcurl ==
     59
     60'''Note:''' the included CMake scripts are outdated, but there are also untested makefiles for a command line build
     61
     62* Bundled MSVC project:
     63        * [http://curl.haxx.se/download.html Download libcurl] source and extract somewhere
     64        * Open `projects\Windows\VC12\curl-all.sln`
     65        * Switch to '''v120_xp''' toolset for compatibility with WinXP:
     66          * Open the properties for the libcurl project
     67          * Change the '''Configuration''' to '''All Configurations'''
     68          * Change '''Platform Toolset''' to '''Visual Studio 2013 - Windows XP (v120_xp)'''
     69        * Build both '''DLL Debug''' and '''DLL Release''' configurations
     70        * Binaries are located in `build\Win32\VC12\DLL Debug\` and `build\Win32\VC12\DLL Release\`
     71          * Copy the *.dll files to `binaries\system`, *.lib files to `libraries\win32\libcurl\lib`
     72        * Copy the *.h files from `include\curl` to `libraries\win32\libcurl\include\curl`
     73
     74
     75== libiconv ==
     76
     77'''Note:''' iconv doesn't support MSVC anymore, only mingw and cygwin
     78* Create Visual Studio project:
     79http://www.codeproject.com/Articles/302012/How-to-Build-libiconv-with-Microsoft-Visual-Studio
     80
     81== libicu ==
     82
     83'''Note:''' Visual Studio projects are included for VS2010, building with a newer version requires the following procedure
     84
     85* Cygwin-based MSVC build:
     86        * [https://cygwin.com/install.html Install Cygwin] with bash, GNU make, ar, ranlib, man
     87        * [http://site.icu-project.org/download Download libicu] .zip source and extract somewhere
     88        * Open Windows command prompt
     89        * Create build and install directories for organization:
     90        {{{
     91        #!application/x-dos-batch
     92        cd icu
     93        md install
     94        cd source
     95        md build
     96        cd build
     97        }}}
     98        * Set MSVC build environment by running
     99        {{{
     100        #!application/x-dos-batch
     101        "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat"
     102        }}}
     103        * Add Cygwin bin directory to path (e.g. `X:\cygwin64\bin`)
     104        {{{
     105        #!application/x-dos-batch
     106        SET path=%path%;X:\cygwin64\bin
     107        }}}
     108        * Set recommended ICU build flags (see build documentation)
     109        {{{
     110        #!application/x-dos-batch
     111        SET CPPFLAGS=-DU_USING_ICU_NAMESPACE=0 -DUNISTR_FROM_CHAR_EXPLICIT=explicit -DUNISTR_FROM_STRING_EXPLICIT=explicit -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1
     112        }}}
     113        * 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])
     114        {{{
     115        #!application/x-dos-batch
     116        SET INCLUDE=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Include;%INCLUDE%
     117        SET PATH=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Bin;%PATH%
     118        SET LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Lib;%LIB%
     119        SET CL=/D_USING_V110_SDK71_
     120        SET LINK=/SUBSYSTEM:WINDOWS,5.01
     121        }}}
     122        * Build and install to `X:/path/to/install` (note forward slashes -- this runs in Bash!)
     123        {{{
     124        #!sh
     125        bash ../runConfigureICU Cygwin/MSVC --prefix=X:/path/to/install
     126        make
     127        make check
     128        make install
     129        }}}
     130        * `X:\path\to\install\lib` will contain the .dlls and .libs
     131        * `X:\path\to\install\include` will contain the header files
     132
     133== libpng ==
     134
     135'''Note:''' Depends on zlib, so if you're building it too, do that first.
     136
     137* CMake GUI-based build:
     138        * [http://www.libpng.org/pub/png/libpng.html Download libpng] source .zip and extract somewhere (`X:\path\to\lpng1xxx`)
     139        * Open cmake-gui (v3.2 in this example)
     140        * Set source location to the `X:\path\to\lpng1xxx`
     141        * Set build location to `X:\path\to\lpng1xxx\build` (so the build files will be separate from the source)
     142        * Press '''Configure'''
     143          * Choose '''Yes''' to create the build directory if it doesn't exist
     144        * Choose '''Visual Studio 2013''' default native compiler as generator, then Finish
     145        * There should be an error because it can't find zlib yet
     146        * Set `ZLIB_INCLUDE_DIR` to the path to the zlib headers (in SVN, that is `libraries\win32\zlib\include`)
     147        * Set `ZLIB_LIBRARY` to the path to the zlib static lib (in SVN, that is `libraries\win32\zlib\lib\zlib1.lib`)
     148          * '''Note:''' this is only for the release build, we'll fix that later
     149        * Add Entry, `CMAKE_GENERATOR_TOOLSET` as a String, and set the value to '''v120_xp''' (to use the XP compatible toolset)
     150        * Change `CMAKE_INSTALL_PREFIX` to `X:\path\to\lpng1xxx\install`
     151        * Press '''Configure''' until there are no errors or red entries
     152        * Press '''Generate'''
     153        * In `lpng1xxx\build`, there should be a libpng.sln you can open in Visual Studio 2013. Open it
     154        * 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)
     155        * Optional DLL version info: add lpng1xxx\scripts\pngwin.rc as a source file in the png1x project
     156        * Build solution for '''Debug''' configuration, there should be no errors. Build the INSTALL project to copy files to the install folders set up earlier
     157        * Repeat for '''Release''' configuration
     158        * `lpng1xxx\install` should contain the newly built libs
     159       
     160== libxml2 ==
     161
     162'''Note:''' Depends on iconv, so if you're building it too, do that first.
     163
     164* Command line MSVC build:
     165        * [ftp://xmlsoft.org/libxml2/ Download libxml2] source tarball and extract somewhere (`X:\path\to\libxml2-x.x.x`)
     166        * Open Windows command prompt in the `libxml2-x.x.x\win32` subdirectory
     167        * 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)
     168        {{{
     169        #!application/x-dos-batch
     170        cscript configure.js compiler=msvc prefix=X:\path\to\install include=X:\path\to\iconv\include lib=X:\path\to\iconv\lib
     171        }}}
     172          '''Note:''' spaces are NOT allowed in these paths!
     173        * There should be no errors if it completed successfully
     174        * Set MSVC build environment
     175        {{{
     176        #!application/x-dos-batch
     177        "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat"
     178        }}}
     179        * 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])
     180        {{{
     181        #!application/x-dos-batch
     182        SET INCLUDE=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Include;%INCLUDE%
     183        SET PATH=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Bin;%PATH%
     184        SET LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Lib;%LIB%
     185        SET CL=/D_USING_V110_SDK71_
     186        SET LINK=/SUBSYSTEM:WINDOWS,5.01
     187        }}}
     188        * Modify `Makefile.msvc` to search for correct libiconv lib:
     189        {{{
     190        !if "$(WITH_ICONV)" == "1"
     191        LIBS = $(LIBS) libiconv.lib
     192        !endif
     193        }}}
     194        * Build and install
     195        {{{
     196        #!application/x-dos-batch
     197        nmake /f Makefile.msvc
     198        nmake /f Makefile.msvc install
     199        }}}
     200
     201== zlib ==
     202
     203* CMake GUI-based build:
     204        * [http://www.zlib.net/ Download zlib source] .zip and extract somewhere (`X:\path\to\zlib-x.x.x`)
     205        * Open cmake-gui (v3.2 in this example)
     206        * Set source location to the `X:\path\to\zlib-x.x.x` folder
     207        * Set build location to `X:\path\to\zlib-x.x.x\build` (this way the build files will be separate from the source)
     208        * Press '''Configure'''
     209          * Choose '''Yes''' to create the build directory if it doesn't exist
     210        * Choose '''Visual Studio 2013''' default native compiler as generator, then Finish
     211        * Add Entry, `CMAKE_GENERATOR_TOOLSET` as a String, and set the value to '''v120_xp''' (to use the XP compatible toolset)
     212        * Change CMAKE_INSTALL_PREFIX to `X:\path\to\zlib-x.x.x\install`
     213        * Change `INSTALL_*` group entries to `X:\path\to\zlib-x.x.x\install\*`
     214        * Press '''Configure''' until there are no errors or red entries
     215        * Press '''Generate'''
     216        * In `zlib-x.x.x\build`, there should be a `zlib.sln` solution you can open in Visual Studio 2013. Open it
     217        * Build solution for Debug configuration, there should be no errors
     218          * Build the '''INSTALL''' project by right-clicking on it (to copy files to the install folders set up earlier)
     219        * Repeat for Release configuration
     220        * `zlib-x.x.x\install` should contain all the newly built libs