Building Spring on Windows
Compiling on Windows
For other platforms and obtaining the source code see Building spring.
SCONS/MinGW
Code::Blocks and Dev C++ use MinGW too, so if you are using one of these IDEs, you'll want to follow these instructions too.
Getting MinGW
Compiling in MinGW requires GCC 4.x which is only available in experimental builds. TDM's experimental MinGW
Previous versions of this document suggested using Dev-C++ or Code::Blocks for their included MinGW. They both come with MinGW 3.4 which no longer compiles a fully working Spring.exe. If you want to use Dev-C++ or Codeblocks, you can install the experimental MinGW build over the one that's included.
Get at least the following packages:
- mingw-runtime
- core
- c++
- java (if MinGW 4.3.1 is out yet, you dont need this)
- binutils
- win32api
Use v13 of the MinGW library package if you have MinGW .
MinGW Setup
There are two ways to setup the MinGL libraries:
1. 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/installer
- /spring/rts
- /spring/... other dirs
- /spring/mingwlibs
2. Install the package somewhere else (preferably outside of the source tree), and pass its location with the mingwlibsdir option to SCons in the configure step (see further down, in the quick instructions).
These programs are a must have if you want to compile Spring with MinGW, so install them now, if you don't have them already.
- Python 2.5 installer
- Python 2.5 win32 extensions installer
- Scons 1.1.0 installer
- CMake 2.6 installer
Quick instructions
- Grab and install the above programs.
- Make sure C:\Python25, C:\Python25\Scripts and C:\Dev-Cpp\bin are in your PATH environment variable. Set environment variables by: Start -> Settings -> Control Panel -> System -> Advanced -> Environment variables (for Windows XP).
- Make sure a MINGDIR environment variable with value C:\Dev-Cpp exists. (change paths where appropriate.)
- Checkout the Spring SVN repository, following the instructions above in obtaining source. (TODO:link)
- Open a console (Start -> Run -> cmd.exe -> Run), cd \where you checked it out in the previous step, if you checked it out on a different drive make sure to change drives with DriveLetter:<enter> first.
- Type scons configure<enter>. Refer to scons --help for options which can be passed to scons configure. Gotchas:
- If you get an error message starting with "EOFError: : env = Environment...", try deleting the file build/scons_signatures.dblite
- If you get an error message stating "ImportError: No module named win32file:", you have probably not installed the python-win32-extensions.
- If all proceeds as intended you will see a message similar to: "Everything seems OK. Run `scons' now to build."
- Type scons<enter> to start the compilation.
- If you have Delphi installed and get an error message that the commandline params "--no-print-directory" & "-C" aren't supported, then you should remove the Delphi dirs from your PATH variable, because scons tried to run the delphi's make.exe instead of using mingw32-make. (this will cause that streflop can't be build!)
- Wait for the compilation to finish, this may take a while.
- Copy datafiles and stuff from official Spring installation to the /spring/game directory (where spring.exe is located, after the compilation finished.)
- Copy missing DLLs from mingwlibs/dll.
- Start developing.
CMake/GCC
Currently the CMake scripts are not capable of generating Visual Studio project files, so CMake can only be used for gcc compiling.
- Install CMake (must be at least version 2.6.0) from either www.cmake.org or through your distributions package manager
- get the source code (from svn, tarballs...)
The GUI method
CMake offers a nice Qt4 gui to ease the following steps (to use the gui explained here, cmake must be at least version 2.6.1). Doing so should be straightforward:
- select source directory
- select (and/or create) build directory where temporary files are stored
- hit configure button
- choose your build type:
- Unix makefile if you are using linux and want to compile linux executables
- mingw makefiles if you are working on windows
- Unix makefile with cross compiler setup to cross-compile mingw32 executables, you have to select the toolchain file you want to use (see below)
- configure variables to your need (move the mouse over the options and read the tooltip for further informations on them and or see Section "Options")
- push generate button
- open commandline and do "make" and "make install"
Visual Studio 8 (2005)
(possibly the free Express Edition)
- Install the vclibs library package. You need to install this in the /spring directory from the SVN checkout or the zipped source. If done right, it will look like:
- /spring/
- /spring/installer
- /spring/rts
- /spring/... other dirs
- /spring/vclibs
- 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:
- 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
- Include files:
- Open the solution. /spring/rts/build/vstudio8/rts.sln
- Start building (usually you want to select the release/no debug 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
Visual Studio 9 (2008)
(possibly the free Express Edition)
Not yet fully working as far as I know; you need at least this hotfix from Microsoft though:
http://support.microsoft.com/kb/946040
For the rest the Visual Studio 8 instructions should apply, mostly.