Difference between revisions of "Compile In Windows"

From FreeOrionWiki
Jump to: navigation, search
m (link to prebuilt zlib and libpng zip on forums)
(Software Dependencies)
Line 26: Line 26:
  
 
Depending on the compiler you're using and the versions of library and dll files in the SDK, you might need to compile some on your own.  [[zlib|zlib and libpng may need to be compiled]] with MSVC 2008.  There is also a precompiled version of these libraries, built with MSVC 2008, available [http://www.freeorion.org/forum/viewtopic.php?p=34989#p34989 here]. If you need Boost libraries, there are Win32 installers available from [http://www.boostpro.com/products/free BoostPro Computing].
 
Depending on the compiler you're using and the versions of library and dll files in the SDK, you might need to compile some on your own.  [[zlib|zlib and libpng may need to be compiled]] with MSVC 2008.  There is also a precompiled version of these libraries, built with MSVC 2008, available [http://www.freeorion.org/forum/viewtopic.php?p=34989#p34989 here]. If you need Boost libraries, there are Win32 installers available from [http://www.boostpro.com/products/free BoostPro Computing].
 +
 +
If you are building the [http://www.bulletphysics.com/Bullet/wordpress/ Bullet] physics library from source, the Bullet SDK provides project files for MSVC 2005.  These can be imported into MSVC 2008 and used to build the needed libraries.  Only the library projects are needed to link with FreeOrion, not the App or Demo projects.  Note that you need to modify the Project Properties -> C++ -> Code Generation -> Runtime Library  to Multi-threaded DLL (/MD) and not a debug-related setting, otherwise you will get linking errors when trying to link the Bullet libraries with FreeOrion.
  
 
==Compilation Instructions==
 
==Compilation Instructions==

Revision as of 12:48, 5 February 2009

Software requirements

Compiler

To compile FreeOrion you can use the MSVC 2005 or MSVC 2008 IDEs or SCons. In any case, the MSVC compiler is required and will be used; compiling with SCons is done from the command-line, but uses the same compiler as the IDE. The 2003 compiler is no longer supported due to bugs which prevent FreeOrion from compiling.

Visual Studio 2008 Express Edition may be downloaded for free from Microsoft. Due to different registry keys being used, the Express Edition compiler may not be compatible with SCons, so if the newest version of SCons doesn't work, you'll have to use the project files to compile FreeOrion.

If you are a student, you may also be elligable for Microsoft Dreamspark, which will give you the full versions of MSVC 2008 or 2005 or several other Microsoft programs.

The commercial version of the Visual Studio 2005 compiler can be used with SCons or with the project files.

Note that the MSVC 2005 Service Pack 1 is required for FreeOrion to compile properly.

Software Dependencies

The majority of FreeOrion dependencies can be found precompiled and packaged in the FreeOrion Windows SDK, from the SourceForge downloads page.

The SDK includes compiled libraries, headers and DLLs for: zlib, SDL, GraphViz, Boost, FreeType, GLEW, OpenAL, libvorbis, and libogg.

Other dependencies include:

  • Python 2.5 - Needed for the SCons build system, and FreeOrion AI
  • SCons - Needed to build GiGi and (optionally) FreeOrion itself
  • GiGi - This is included in the FreeOrion SDK. If building FreeOrion using SCons, GiGi but must be built from source and installed. All GiGi dependencies are in the FreeOrion SDK and should be automatically detected when GiGi is built. If using the MSVC project files, it is not necessary to build GiGi separately from FreeOrion, but all the GiGi dependencies are needed to build FreeOrion.

Depending on the compiler you're using and the versions of library and dll files in the SDK, you might need to compile some on your own. zlib and libpng may need to be compiled with MSVC 2008. There is also a precompiled version of these libraries, built with MSVC 2008, available here. If you need Boost libraries, there are Win32 installers available from BoostPro Computing.

If you are building the Bullet physics library from source, the Bullet SDK provides project files for MSVC 2005. These can be imported into MSVC 2008 and used to build the needed libraries. Only the library projects are needed to link with FreeOrion, not the App or Demo projects. Note that you need to modify the Project Properties -> C++ -> Code Generation -> Runtime Library to Multi-threaded DLL (/MD) and not a debug-related setting, otherwise you will get linking errors when trying to link the Bullet libraries with FreeOrion.

Compilation Instructions

  1. First, get the FreeOrion SDK from SourceForge.
  2. Optionally, update FreeOrion to the latest revision in SVN which should automatically also update GiGi.

Compiling with MSVC 2005 IDE

  1. Open msvc2005\FreeOrion\FreeOrion.sln
  2. Configure the Python include and lib directories to where these are located on your system. These are accessed in the GUI at (Project->Properties->C/C++->General) and (Project->Properties->Linker->General). This is essential only for the "freeorionca" project, but all three projects have the directories in their settings by default.
  3. Use Build->Build Solution to build the three projects' release targets

Compiling with MSVC 2008 IDE

  1. Open msvc2008\FreeOrion\FreeOrion.sln
  2. Configure the Python include and lib directories to where these are located on your system. These are accessed in the GUI at (Project->Properties->C/C++->General) and (Project->Properties->Linker->General). This is essential only for the "freeorionca" project, but all three projects have the directories in their settings by default.
  3. Use Build->Build Solution to build the three projects' release targets


If you get a crash right after running freeorion.exe before the program shows the intro splash screen, you may need to built zlib1.dll and libpng13.dll with MSVC 2008 due to incompatibility with the versions in the SDK, which were built with an earlier version of MSVC's compiler. See here for instructions, which are unfortunately not completely straightforward.

Compiling with SCons

  1. If not done already, get SCons and Python (see above)
  2. Build and install GiGi using the instructions in README.txt in the SDK
  3. Follow the instructions in the FreeOrion SDK, as with GiGi.

Note that using SCons reduces compile time compared to compiling with the MSVC IDE, because common object files are only built one time instead of once for each executable.

As noted with for the MSVC 2008 IDE above, if you are compiling using the MSVC 2008 compiler and the FreeOrion SDK, you may get a crash when freeorion.exe starts. See above for a solution.

Compilation Errors

Please report compilation errors in the forums.


Runtime Errors

Please report runtime errors in the forums.