Difference between revisions of "Compile In Windows"

From FreeOrionWiki
Jump to: navigation, search
(Started editing this page. Added a reference to pdf document detailing how to set up visual studio to compile FreeOrion)
 
(No content on page; link was dead.)
Line 1: Line 1:
== Compiling FreeOrion with Microsoft Visual Studio ==
+
==Software requirements==
  
If you want to compile in Windows, for now you can read the [http://myvpn.game-host.org/freeorion.html documentation] that Ted Bullock has been writing which details how to build FreeOrion and all its prerequisites entirely from source codeFor now his document is incomplete but is available on his personal webserver.
+
===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 IDEThe 2003 compiler is no longer supported due to bugs which prevent FreeOrion from compiling.
  
Eventually the instructions he describes in that document will be moved to this page so that they can be maintained by the community more easily.
+
Visual Studio 2005 Express Edition may be [http://msdn.microsoft.com/vstudio/express/visualc/download/ downloaded for free] from Microsoft.  The [http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/ Platform SDK] must be installed separately.  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 2008 Express Edition is also available, but has not been tested with FreeOrion.
 +
 
 +
The commercial version of the Visual Studio 2005 compiler can be used with SCons or with the project files.  The full version of Visual Studio 2008 has project files available, and should also work with SCons, but has not been tested.
 +
 
 +
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 [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, DevIL, SDL, GraphViz, Boost, log4cpp, FreeType, OpenAL, libvorbis, and libogg.
 +
 
 +
Other dependencies include:
 +
 
 +
* [http://www.python.org/download/ Python 2.5] - Needed for the SCons build system, and FreeOrion AI
 +
 
 +
* [http://www.scons.org/ 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.
 +
 
 +
 
 +
==Compilation Instructions==
 +
# 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.
 +
 
 +
===Compiling with MSVC 2005 IDE===
 +
# Open msvc2005\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
 +
 
 +
===Compiling with MSVC 2008 IDE===
 +
# Download or build binaries for Boost 1.35.  You can build from source using the Boost instructions, or get the pre-compiled installer from [http://www.boostpro.com/products/free Boost Consulting].
 +
# 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.
 +
# Configure the Boost lib directories to where these are locted on your system.  As of this writing, the FreeOrion SDK does not contain libraries for Boost that work with MSVC 2008, so you need to point the IDE to where these are located.
 +
# Use Build->Build Solution to build the three projects' release targets
 +
# Copy boost_python-vc90-mt-1_35.dll from the boost lib directory into the directory where the freeorion executables are located.  (This file is also not present in the SDK in a version compatible with MSVC 2008)
 +
 
 +
===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.

Revision as of 19:41, 3 August 2008

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 2005 Express Edition may be downloaded for free from Microsoft. The Platform SDK must be installed separately. 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 2008 Express Edition is also available, but has not been tested with FreeOrion.

The commercial version of the Visual Studio 2005 compiler can be used with SCons or with the project files. The full version of Visual Studio 2008 has project files available, and should also work with SCons, but has not been tested.

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, DevIL, SDL, GraphViz, Boost, log4cpp, FreeType, 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.


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. Download or build binaries for Boost 1.35. You can build from source using the Boost instructions, or get the pre-compiled installer from Boost Consulting.
  2. Open msvc2008\FreeOrion\FreeOrion.sln
  3. 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.
  4. Configure the Boost lib directories to where these are locted on your system. As of this writing, the FreeOrion SDK does not contain libraries for Boost that work with MSVC 2008, so you need to point the IDE to where these are located.
  5. Use Build->Build Solution to build the three projects' release targets
  6. Copy boost_python-vc90-mt-1_35.dll from the boost lib directory into the directory where the freeorion executables are located. (This file is also not present in the SDK in a version compatible with MSVC 2008)

Compiling with SCons

  1. If not done already, get SCons and Python (Compile_In_Windows#Software_Dependencies 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.