Difference between revisions of "Compile In Windows"

From FreeOrionWiki
Jump to: navigation, search
(Compiler)
(We use msvc2015, not msvc2013)
(32 intermediate revisions by 8 users not shown)
Line 1: Line 1:
==Software requirements==
+
==Prerequisites==
  
 
===Compiler===
 
===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 [http://www.microsoft.com/express/Downloads/#2010-Visual-CPP downloaded for trial] from Microsoft. If that link doesn't work even in IE, than use [http://go.microsoft.com/?linkid=9709949 this English link]. 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.
+
FreeOrion can be compiled on Windows with Visual Studio 2015 Update 3. Premade Visual Studio project files are available in the source code repository, and the SDK provides precompiled dependencies for the compiler.  Project files may also be generated using CMake.
  
If you are a student, you may also be eligible for [http://www.dreamspark.com Microsoft Dreamspark], which will give you the Professional version of MSVC 2010 or several other Microsoft programs.
+
====Getting Visual Studio====
  
===Software Dependencies===
+
Visual Studio Community and Express can be [https://www.visualstudio.com/downloads/download-visual-studio-vs#DownloadFamilies_2 downloaded from Microsoft here].  If you're not sure which edition to pick, take the latest one for Windows Desktop.  You will need a Microsoft account to proceed, if you don't have one, you will have to register one.
The majority of FreeOrion dependencies can be found precompiled and packaged in the FreeOrion Windows SDK, from the [http://sourceforge.net/projects/freeorion/files/FreeOrion%20SDK/ 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.
+
===Version Control System===
  
Other dependencies include:
+
The FreeOrion project uses [[wikipedia:Git_(software)|Git]] for version control. To be able to use the SDK, you need to install the git command line client (the most recent release for Windows can be downloaded [http://git-scm.com/download/win here]). '''Important:''' When installing the git command line client, be sure to select the option that will include the git executable in your command path, otherwise the batch script which sets up the SDK will fail.
  
* '''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.
+
==Compilation Instructions==
* [http://www.python.org/download/ Python 2.6] - Needed for FreeOrion AI. Python version is tied to Boost.
+
* [http://www.cmake.org/ 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|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.
+
===Step by Step===
  
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 '''Multi-threaded DLL''' versions(there should be only those) of these libraries: '''date_time''', '''filesystem''', '''iostreams''', '''python''', '''regex''', '''serialization''', '''signals''', '''system''', and '''thread'''.
+
# First, get the FreeOrion SDK for Windows from [https://github.com/freeorion/freeorion-sdk/releases GitHub] (for FreeOrion later than v0.4.6) or [http://sourceforge.net/projects/freeorion/files/FreeOrion%20SDK SourceForge] (for FreeOrion v0.4.6 and earlier). (~50 or 35 MB)
 +
# Unpack the SDK to a directory of your choice.
 +
# Run the ''bootstrap.bat'' file located in the root folder of the unpacked SDK. This will (among other things) download and check out the source code from GitHub ([https://github.com/freeorion/freeorion freeorion/freeorion] repository, checked out branch will be "master").
 +
# Depending on which version of Visual Studio you're using, open FreeOrion\msvc2015\FreeOrion.sln
 +
# Use Build->Build Solution to build all projects' release targets.
  
If you are building the [http://code.google.com/p/bullet/downloads/list 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 may take some time: ~1 hour on Core i3 370M with 6GB RAM, ~20 min on Core i7 4710HQ with 8 GB RAM.
  
==Compilation Instructions==
+
===Software Dependencies===
# First, get the [[Compile#FreeOrion_SDK|FreeOrion SDK]] from SourceForge.
+
 
# Check out the source code from [[Compile#Subversion|SVN]] which should automatically also update GiGi.
+
The SDK includes compiled libraries, headers and DLLs for: zlib, Python 2, Boost, FreeType, GLEW, libpng, OpenAL, libvorbis, and libogg, SDL2.
# Open msvc2010\FreeOrion\FreeOrion.sln
+
# Configure the Python include and lib directories to where these are located on your system(need to be added to VS 2010 for AI). 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
+
  
 
==Runtime Errors==
 
==Runtime Errors==
 +
 
Please report runtime errors in the [http://www.freeorion.org/forum/viewtopic.php?f=9&t=1787 forums].
 
Please report runtime errors in the [http://www.freeorion.org/forum/viewtopic.php?f=9&t=1787 forums].

Revision as of 13:06, 25 March 2018

Prerequisites

Compiler

FreeOrion can be compiled on Windows with Visual Studio 2015 Update 3. Premade Visual Studio project files are available in the source code repository, and the SDK provides precompiled dependencies for the compiler. Project files may also be generated using CMake.

Getting Visual Studio

Visual Studio Community and Express can be downloaded from Microsoft here. If you're not sure which edition to pick, take the latest one for Windows Desktop. You will need a Microsoft account to proceed, if you don't have one, you will have to register one.

Version Control System

The FreeOrion project uses Git for version control. To be able to use the SDK, you need to install the git command line client (the most recent release for Windows can be downloaded here). Important: When installing the git command line client, be sure to select the option that will include the git executable in your command path, otherwise the batch script which sets up the SDK will fail.

Compilation Instructions

Step by Step

  1. First, get the FreeOrion SDK for Windows from GitHub (for FreeOrion later than v0.4.6) or SourceForge (for FreeOrion v0.4.6 and earlier). (~50 or 35 MB)
  2. Unpack the SDK to a directory of your choice.
  3. Run the bootstrap.bat file located in the root folder of the unpacked SDK. This will (among other things) download and check out the source code from GitHub (freeorion/freeorion repository, checked out branch will be "master").
  4. Depending on which version of Visual Studio you're using, open FreeOrion\msvc2015\FreeOrion.sln
  5. Use Build->Build Solution to build all projects' release targets.

Compilation may take some time: ~1 hour on Core i3 370M with 6GB RAM, ~20 min on Core i7 4710HQ with 8 GB RAM.

Software Dependencies

The SDK includes compiled libraries, headers and DLLs for: zlib, Python 2, Boost, FreeType, GLEW, libpng, OpenAL, libvorbis, and libogg, SDL2.

Runtime Errors

Please report runtime errors in the forums.