Compile In Windows

From FreeOrionWiki
Revision as of 01:50, 6 December 2010 by OndrejR (Talk | contribs) (Compilation Instructions)

Jump to: navigation, search

Software requirements

Compiler

To compile FreeOrion you can use the MSVC 2010 IDE, MSVC 2008 IDE(but needs to update project files) or cmake;compiling with cmake is done from the command-line, but uses the same compiler as the IDE.

Visual Studio 2010 Express Edition may be downloaded for trial from Microsoft. But after 30 days you have to register for free.On same page can be downloaded also VS 2008 Express Edition. Due to different registry keys being used, the Express Edition compiler may not be compatible with cmake, so if the newest version of cmake doesn't work, you'll have to use the project files to compile FreeOrion.

If you are a student, you may also be eligible 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 FreeOrion SDK page.

The SDK includes compiled libraries, headers and DLLs for: zlib, OGRE, bullet, Boost, FreeType, GLEW, libpng, libjpeg, OpenAL, ALUT, 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. If building FreeOrion using cmake, GiGi but must be built from source and installed.
  • Python 2.6 - Needed for FreeOrion AI. Python version is tied to Boost.
  • cmake - Optional for building FreeOrion and the GiGi libraries on Windows.

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 2010, zlib and libpng need to be compiled; the version in the SDK probably, which was built with MSVC 2010 probably will not work with another compiler. Similarly, the boost libraries in the SDK were built with MSVC 2010 and you may need to build or download other versions for other compilers.

If you need Boost libraries, there are Win32 installers available from BoostPro Computing. As of this writing, you want to install the headers, and the Multi-threaded DLL versions(there should be only those) of these libraries: date_time, filesystem, iostreams python, regex, serialization, signals, system, and thread.

If you are building the Bullet physics library from source, the Bullet SDK provides project files for MSVC 2008 which can be imported into MSVC 2010. 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, libBulletDynamics and libLinearMath libraries and DLLs are used by FreeOrion.

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. Configure the Python include and lib directories to where these are located on your system(need to be added to SDK). 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.
  5. Use Build->Build Solution to build the three projects' release targets

Runtime Errors

Please report runtime errors in the forums.