Difference between revisions of "Compile In Windows"

From FreeOrionWiki
Jump to: navigation, search
m (Software Dependencies)
Line 2: Line 2:
  
 
===Compiler===
 
===Compiler===
To compile [[FreeOrion]] you can use the MSVC 2008 IDE 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.
+
To compile [[FreeOrion]] you can use the MSVC 2010 IDE.
  
Visual Studio 2008 Express Edition may be [http://www.microsoft.com/express/vc/ 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.
+
Visual Studio 2010 Express Edition may be [http://www.microsoft.com/express/Downloads/#2010-Visual-CPP downloaded for free] from Microsoft.
  
If you are a student, you may also be elligable for [http://www.dreamspark.com Microsoft Dreamspark], which will give you the full versions of MSVC 2008 or several other Microsoft programs.
+
If you are a student, you may also be elligable for [http://www.dreamspark.com Microsoft Dreamspark], which will give you the Professional version of MSVC 2010 or several other Microsoft programs.
  
 
===Software Dependencies===
 
===Software Dependencies===
 
The majority of FreeOrion dependencies can be found precompiled and packaged in the FreeOrion Windows SDK, from the [http://sourceforge.net/project/showfiles.php?group_id=75752&package_id=236893 SourceForge downloads page].
 
The majority of FreeOrion dependencies can be found precompiled and packaged in the FreeOrion Windows SDK, from the [http://sourceforge.net/project/showfiles.php?group_id=75752&package_id=236893 SourceForge downloads page].
  
The SDK includes compiled libraries, headers and DLLs for: [[zlib]], OGRE, bullet, GraphViz, Boost, FreeType, GLEW, libpng, libjpeg, OpenAL, libvorbis, and libogg.
+
The SDK includes compiled libraries, headers and DLLs for: zlib, OGRE, bullet, Boost, FreeType, GLEW, libpng, libjpeg, OpenAL, libvorbis, and libogg.
  
 
Other dependencies include:
 
Other dependencies include:
  
* [http://www.python.org/download/ Python 2.5] - Needed for the SCons build system, and FreeOrion AI
+
* '''GiGi''' - Including '''GiGiOgre''' and '''GiGiOgrePlugin_OIS'''.  These are available from a Subversion repository, and should be automatically checked out with FreeOrion code when using the FreeOrion SDK.  The MSVC project files contain projects for the GiGi libraries that are needed by FreeOrion, and the DLLs .lib files will be placed in the FreeOrion folder when built.  All GiGi dependencies are in the FreeOrion SDK and should be automatically found and used when GiGi is built.
 
+
* [http://www.scons.org/ SCons] - Optional for building FreeOrion and the GiGi libraries
+
 
+
* '''GiGi''' - Including '''GiGiOgre''' and '''GiGiOgrePlugin_OIS'''.  These are included in the FreeOrion SDK.  If building FreeOrion using SCons, GiGi but must be built from source and installed.  The MSVC project files contain projects for the GiGi GiGi libraries that are needed by FreeOrion, and the DLLs .lib files will be placed in the FreeOrion folder when built.  All GiGi dependencies are in the FreeOrion SDK and should be automatically detected when GiGi is built.
+
 
+
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.  If you're using a version of the MSVC compiler other than 2008, [[zlib|zlib and libpng]] need to be compiled; the version in the SDK probably, which was built with MSVC 2008 probably will not work with another compiler.  Similarly, the boost libraries in the SDK were built with MSVC 2008 and you may need to build or download other versions for other compilers.
+
 
+
If you need Boost libraries, there are Win32 installers available from [http://www.boostpro.com/products/free BoostPro Computing].  As of this writing, you want to install the headers, and the '''Multithreaded DLL''' versions of these libraries: '''date_time''', '''filesystem''', '''python''', '''regex''', '''serialization''', '''signals''', '''system''', and '''thread'''.
+
 
+
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 which can be imported into MSVC 2008.  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.  The '''libbulletcollision''' and '''libbulletmath''' libraries and DLLs are used by FreeOrion.
+
  
 
==Compilation Instructions==
 
==Compilation Instructions==
 
# First, get the [http://sourceforge.net/project/showfiles.php?group_id=75752&package_id=236893 FreeOrion SDK] from SourceForge.
 
# First, get the [http://sourceforge.net/project/showfiles.php?group_id=75752&package_id=236893 FreeOrion SDK] from SourceForge.
# Optionally, update FreeOrion to the latest revision in [[Compile#Subversion|SVN]] which should automatically also update GiGi.
+
# Check out the source code from [[Compile#Subversion|SVN]] which should automatically also update GiGi.
 
+
# Open msvc2010\FreeOrion\FreeOrion.sln
 
+
 
+
===Compiling with MSVC 2008 IDE===
+
# Open msvc2008\FreeOrion\FreeOrion.sln
+
# 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.
+
 
# Use Build->Build Solution to build the three projects' release targets
 
# 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 [[zlib|here]] for instructions, which are unfortunately not completely straightforward.
 
 
 
===Compiling with SCons===
 
# If not done already, get SCons and Python ([[Compile_In_Windows#Software_Dependencies|see above]])
 
# Build and install GiGi using the instructions in README.txt in the SDK
 
# 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.
 
 
==Build Errors==
 
 
If building on one of the x64 variants of Windows (XP, Vista, Win7) and using the x64 variants of Python, you may get python-related errors while linking freeorionca '''error LNK2001: unresolved external symbol'''.  This is due to [http://lists.boost.org/Archives/boost/2008/09/142776.php missing symbols] (in Python 2.5.2, 2.5.4 and 2.6.1, possibly others) in the x64 lib.  To fix this issue use a 32-bit version of Python instead.
 
 
Please search for discussion about or report other build errors in the [http://freeorion.org/forum/viewforum.php?f=24 forums].
 
  
 
==Runtime Errors==
 
==Runtime Errors==
 
Please report runtime errors in the [http://freeorion.org/forum/viewforum.php?f=25 forums].
 
Please report runtime errors in the [http://freeorion.org/forum/viewforum.php?f=25 forums].

Revision as of 13:27, 5 December 2010

Software requirements

Compiler

To compile FreeOrion you can use the MSVC 2010 IDE.

Visual Studio 2010 Express Edition may be downloaded for free from Microsoft.

If you are a student, you may also be elligable for Microsoft Dreamspark, which will give you the Professional version of MSVC 2010 or several other Microsoft programs.

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, OGRE, bullet, Boost, FreeType, GLEW, libpng, libjpeg, OpenAL, libvorbis, and libogg.

Other dependencies include:

  • GiGi - Including GiGiOgre and GiGiOgrePlugin_OIS. These are available from a Subversion repository, and should be automatically checked out with FreeOrion code when using the FreeOrion SDK. The MSVC project files contain projects for the GiGi libraries that are needed by FreeOrion, and the DLLs .lib files will be placed in the FreeOrion folder when built. All GiGi dependencies are in the FreeOrion SDK and should be automatically found and used when GiGi is built.

Compilation Instructions

  1. First, get the FreeOrion SDK from SourceForge.
  2. Check out the source code from SVN which should automatically also update GiGi.
  3. Open msvc2010\FreeOrion\FreeOrion.sln
  4. Use Build->Build Solution to build the three projects' release targets

Runtime Errors

Please report runtime errors in the forums.