Building Spring on Windows

Development < Building Spring < Building Spring on Windows

Contents

Get the Source Code

Tarballs

(For playing online)

Using Git is the recommended way to get the sources of the engine. In spite of, you can use the official tarballs to compile Spring without git.

Note: Do NOT use the zip-files from github, they are missing important data to compile Spring.

See Building spring for build instructions.


Git

Spring project page at github (status page)

Master repo URI: git://github.com/spring/spring.git
Backup repo: git://git.code.sf.net/p/springrts/code


Latest Stable (master branch)

Assuming the GIT command line client is installed, you can clone the repository with

git clone git://github.com/spring/spring.git -b master

and update it with:

git pull --rebase

Bleeding-edge (develop branch)

This will also allow you to make a patch out of the changes you make to the code, and send it to one of the developers with repository access. If you are new to git and github, you may want to have a look at this guide to get you started.


Just as above with a minimal change:

git clone git://github.com/spring/spring.git -b develop

and update with:

git pull --rebase


Note: you can switch branches this way:

# backup your current changes
git stash

# switch branch
git checkout $MY_OTHER_BRANCH

# sometimes needed
# note, it deletes all your unstashed changes and all non-pushed commits on the new branch,
# but it doesn't delete untracked files.
#git reset --hard 

# update/sync with remote repo
git pull --rebase

#optional
#git stash pop # reapplies your changes and DELETES the backup
#or
#git stash apply --index 0  # reapplies your changes and keep the backup (see `git stash list`)

Optional AI's

If you want to also compile the AI's, you have to type

git submodule sync
git submodule update --init

to update the submodules, you have to execute the same commands again.

Compiling with MinGW+CMake

Compiling Spring in MinGW requires >=GCC 4.x.

Because the official MinGW installer and packages are outdated, we recommend to use the TDM web-installer instead, to install the official MinGW Stable (not TDM-GCC) package:

TDM webinstaller

Download and run the On-Demand Installer (tdm-gcc-webdl).

Select at least the following components:

400px-Mingwscreenshot.jpg
  • gcc (version: MinGW Stable!)
    • core
    • g++
    • openmp (optional)
  • binutils
  • mingw-runtime
  • w32api
  • mingw32-make (if you have no Make installed yet)
  • gdb (recommended for debugging)

Possible Problems

  • If you get undefined reference to `_Unwind_Resume' linking errors, deinstall whole TDM/MinGW and reinstall it with dwarf2 (MinGW Stable should have it enabled).
  • When you installed an old version of MinGW/TDM and forgot to deinstall it correctly, gcc.exe & g++.exe will be named gcc-dw2.exe/g++-dw2.exe. CMake will then fail to find the correct one, first try to deinstall anything mingw related and reinstall everything. If that didn't helped just rename the files. If even that doesn't help open cmake-gui and click the advanced button and set the paths to the correct files yourself (CMAKE_C_COMPILER & CMAKE_CXX_COMPILER).

Spring MinGW Dependencies (mingwlibs)

You also need some Spring dependencies, prepackaged in the mingwlibs archive.

You can download a tarball here (Download Source button).
Or (recommended) use git:

  • open a console (cmd.exe) or use git's bash (you find it in the right click context menu when clicking the folder), cd into your source dir
  • make a dir named mingwlibs
  • cd mingwlibs
  • run git clone git://github.com/spring/mingwlibs.git
  • and update it from time to time with: git pull --rebase

mingwlibs install directory

There are two ways to setup the MinGW libraries:

  • Make sure you install the package in the checkout directory, so the path is: /spring/mingwlibs. If done right, it will look like:
    • */spring/
    • */spring/...
    • */spring/mingwlibs
    • */spring/rts
  • Install the package somewhere else (preferably outside of the source tree), and pass its location with the MINGDIR option to CMake in the configure step (see further down, in the quick instructions).

Installing CMake

First get CMake here and install it.

then

  • run the cmake-gui and select a source and a build directory
  • configure and follow the instructions, and adjust variables to your needs (defaults are OK)
  • press Generate
  • open a console (cmd.exe), cd into your build directory
  • optional: for multi-threaded compilation, the mingw32-make part may differ on your system:
    set MAKE_COMMAND=mingw32-make -j2
  • compile with:
    mingw32-make install-spring

Generating the AI Sources/Wrappers

you can either build the wrapper:

make Cpp-AIWrapper

or generate all sources, in case you don't need the binary:

make generateSources

Compiling with Visual Studio

General Visual Studio Notes

When developing using Visual Studio keep in mind:

  • Your VS build won't sync with GCC builds in multiplayer mode
  • AIs built with Visual Studio will work with the mingw32 release builds thanks to the C AI Interface, however this interface may change when newer releases are made
  • Running any non-LUA AI on VS built Spring will crash it
  • Most spring developers use linux based environments, and the Visual Studio projects may be slightly out of date or missing files at any one time. Please contribute any changes or fixes you find back into the project
  • The project files are in /spring/rts/build/vstudion
  • You need to install the VClibs library package that holds all the project dependancies and put this in the /spring directory from the github checkout or the zipped source. The VClibs packages are Visual Studio version specific, so choose the proper one. If done right, it will look like:
    • /spring/
    • /spring/installer
    • /spring/rts
    • /spring/... other dirs
    • /spring/vclibs


to create the project file for visual studio 10, type:

cmake -G "Visual Studio 10"

2005 (v8)

(possibly the free Express Edition)

  • Install the VClibs for VS2005.
  • Install the DirectX SDK
  • Install the PlatformSDK. I got away with unchecking the parts of the PlatformSDK that were obviously not related (IIS, web stuff). Makes for a smaller download. Make sure the Platform SDK and DirectX SDK are in the VS search/include directories.
    • Note that the most recent version of Platform SDK is called Windows SDK.
  • After installing them, open Visual C++. Click Tools >> Options >> Projects and Solutions >> VC++ Directories. Add these entries to the corresponding sections (paths just a reference, yours may be different):
    • Include files:
      • $(ProgramFiles)\Microsoft DirectX SDK (August 2007)\Include
      • $(ProgramFiles)\Microsoft Platform SDK\include
    • Library files:
      • $(ProgramFiles)\Microsoft DirectX SDK (August 2007)\Lib\x86 (Might need \x64 on a 64-bit platform, I don't know.)
      • $(ProgramFiles)\Microsoft Platform SDK\lib
  • Open the solution. /spring/rts/build/vstudio8/rts.sln
  • Start building (usually you want to select the Release with error catching build, debug is really too slow and is used only when you really know what you want to test)
  • Select the working directory in the project properties, otherwise spring will not work correctly

Errors

  • ...\Windows\v6.0A\include\shlwapi.h(196) : error C2061: syntax error : identifier 'PCUITEMID_CHILD' - wrong version of Platform SDK is used; go to Tools >> Options >> >> Projects and Solutions >> VC++ Directories and move the one that's causing this problem all the way down.

2008 (v9)

(Standard or above Edition)

It won't work out of the box, you need at least this hotfix from Microsoft: KB946040 or update using your Windows Update, as well as Visual Studio 2008 Feature Pack.

For the rest the Visual Studio 8 instructions should apply, mostly. You probably won't need to add Windows SDK path references as they should be present by default. Before compiling it's recomended to select "Release with error catching" solution configuration or it's MT variant.

You need the vclibs for VS2008, and not the ones for Visual Studio 2005. The installation procedure is the same though.

Be aware that the project file isn't updated nearly as frequently as it should, so it's best to use the .vcproj file from VS8 build and VS2008 will automatically update it.

Errors

  • ...\rts\lib\assimp\code\STEPFile.h(58) : fatal error C1083: Cannot open include file: 'unordered_map': No such file or directory

You need to install Visual Studio 2008 Feature Pack. It's recomended to do so after a clean installation of VS2008 prior to installing SP1 and other updates. The linked installer only supports VS2008 Standard or above. If you installed all updates prior to installing the feature pack, there's no guarantee that installation of feature pack will be successfull (Installation on systems with Visual Studio 2008 Service Pack 1 (BETA) is not supported), though it did seem to work.

2010 (v10)

The instructions for VS2008 should mostly work, but you need VCLibs for VS2010 instead.


 
 

Page editing toolbox

Browse
Main page
Community portal
Current events
Recent changes
Random page
Help
Edit
View source
Editing help
This page
Discuss this page
New section
Printable version
Context
Page history
What links here
Related changes
My pages
Log in
Special pages
New pages
<imagelist>
Statistics
More...

Site layout created by Roflcopter et al.