Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G

Difference between revisions of "Building using CMake - Windows"

From FlightGear wiki
Jump to: navigation, search
(Required software)
m (32-bits: Fixed dead links to pre-built libs)
Line 19: Line 19:
 
<tt>
 
<tt>
 
: ${MSVC_3RDPARTY_ROOT} /
 
: ${MSVC_3RDPARTY_ROOT} /
:: [http://flightgear.simpits.org:8080/job/3rdParty-Win/lastSuccessfulBuild/artifact/3rdParty/*zip*/3rdParty.zip 3rdParty] / </tt> ( includes plib, fltk, zlib, libpng, libjpeg, libtiff, freetype, libsvn, gdal, ... ) <tt>
+
:: [http://build.flightgear.org:8080/view/Windows/job/3rdParty-Win/lastSuccessfulBuild/artifact/3rdParty/*zip*/3rdParty.zip 3rdParty] / </tt> ( includes plib, fltk, zlib, libpng, libjpeg, libtiff, freetype, libsvn, gdal, ... ) <tt>
 
::: bin /
 
::: bin /
 
::: include /
 
::: include /
 
::: lib /
 
::: lib /
:: [http://flightgear.simpits.org:8080/job/Boost-Win/lastSuccessfulBuild/artifact/*zip*/archive.zip Boost] / </tt> (latest version can be downloaded from http://www.boost.org/) <tt>
+
:: [http://build.flightgear.org:8080/view/Windows/job/Boost-Win/lastSuccessfulBuild/artifact/*zip*/archive.zip Boost] / </tt> (latest version can be downloaded from http://www.boost.org/) <tt>
 
::: boost /
 
::: boost /
 
::: lib /
 
::: lib /
 
:: install /
 
:: install /
 
::: msvc100 / </tt> ( for VS2010 32 bits, or msvc90 for VS2008 32-bits ) <tt>
 
::: msvc100 / </tt> ( for VS2010 32 bits, or msvc90 for VS2008 32-bits ) <tt>
:::: [http://flightgear.simpits.org:8080/view/Win/job/OSG-Win/lastSuccessfulBuild/artifact/install/msvc100/OpenSceneGraph/*zip*/OpenSceneGraph.zip OpenSceneGraph] / </tt> ( OSG CMake install ) <tt>
+
:::: [http://build.flightgear.org:8080/view/Windows/job/OSG-Win/lastSuccessfulBuild/artifact/install/msvc100/OpenSceneGraph/*zip*/OpenSceneGraph.zip OpenSceneGraph] / </tt> ( OSG CMake install ) <tt>
 
::::: bin /
 
::::: bin /
 
::::: include /
 
::::: include /

Revision as of 09:36, 16 June 2015

1rightarrow.png See Building Flightgear for the main article about this subject.

Required software

If you get an error during the installation of the SDK, try uninstalling MSVC redist packages first, then installing the SDK without compilers and then finally re-installing MSVC.

Obtaining source

1rightarrow.png See FlightGear and Git for the main article about this subject.

Throughout this article it is assumed that you've already set up git clones of the various source repositories (FlightGear, SimGear, data...).

Directory tree

On Windows, assumptions on the directory structure are made to automate the discovery of dependencies. This recommended directory structure is described below. Clicking the links allows you to download pre-built parts. If you do not use the recommended structure you will need to enter paths by hand. Source and build directories can be located anywhere.

32-bits

${MSVC_3RDPARTY_ROOT} /
3rdParty / ( includes plib, fltk, zlib, libpng, libjpeg, libtiff, freetype, libsvn, gdal, ... )
bin /
include /
lib /
Boost / (latest version can be downloaded from http://www.boost.org/)
boost /
lib /
install /
msvc100 / ( for VS2010 32 bits, or msvc90 for VS2008 32-bits )
OpenSceneGraph / ( OSG CMake install )
bin /
include /
lib /
SimGear / (create this empty for now, subfolders will be created by build process)
include /
lib /
FlightGear / (create this empty for now)
include /
lib /

64-bits

${MSVC_3RDPARTY_ROOT} /
3rdParty.x64 /
bin /
include /
lib /
Boost /
boost /
lib64 /
install /
msvc100-64 / ( for VS2010 64-bits, or msvc90-64 for VS2008 64-bits )
OpenSceneGraph / ( OSG CMake install )
bin /
include /
lib /
SimGear / (create this empty for now, subfolders will be created by build process)
include /
lib /
FlightGear / (create this empty for now)
include /
lib /

NdT: glut is missing for the 64bits build, you can use freeglut.

Building

  1. Set up a work directory as described above.
  2. Building SimGear
    1. Open the CMake gui.
    2. Set "Where is the source code" to wherever you put the SimGear sources (from the released tarball or the git repository).
    3. Set "Where to build the binaries" to a new empty directory (could be anywhere and any name, for example naming it simgear-build, at the same folder location as your unzipped SimGear source folder was put).
    4. Press CMake GUI Configure.png. The first time that the project is configured, CMake will bring up a window asking you to "Specify the generator for this project" i.e. which compiler you wish to use. Select Visual Studio 10 (or Visual Studio 10 Win64 for 64-bit), and press Finish. CMake will now do a check on your system and will produce a preliminary build configuration.
    5. CMake adds new configuration variables in red. Some have a value ending with -NOTFOUND. These variables should receive your attention. Some errors will prevent SimGear from building and others will simply invalidate some options without causing build errors.
      1. First check the MSVC_3RDPARTY_ROOT variable. If it is not set, chances are that there will be a lot of -NOTFOUND errors. Instead of trying to fix every error individually, set that variable to the location of the directory structure that is presented above. Then press CMake GUI Configure.png again.
      2. Set the CMAKE_INSTALL_PREFIX variable to ${MSVC_3RDPARTY_ROOT}/install/msvc100/SimGear.
      3. Also check the lines with a checkbox. These are build options and may impact the feature set of the built program.
    6. Repeat the process from step 5, until CMake GUI Generate.png is enabled.
    7. Press CMake GUI Generate.png.
    8. Start Visual Studio 2010 and load the SimGear solution (SimGear.sln) located in "Where to build the binaries".
    9. Choose the "Release" build in the VS2010 "Generation" toolbar. The right menu should read Win32 for 32-bits or x64 for 64-bits.
      MVSC 2010 solution.png
    10. Generate the solution with F7 key or right-click the top level "Solution SimGear" in the Solution Explorer and choose Build.
    11. If there are build errors, return to CMake, clear remaining errors, CMake GUI Configure.png and CMake GUI Generate.png.
    12. When Visual Studio is able to build everything without errors, right-click on the INSTALL project (further down within the "Solution Simgear" solution) and choose Build, which will put the include and lib files in ${CMAKE_INSTALL_PREFIX}
  3. Building FlightGear
    Repeat the steps under Building Simgear, but change the SimGear paths to FlightGear.
  4. Enjoy!

Build options

To include LaRCsim/UIUC in your build, set:

ENABLE_LARCSIM:BOOL=ON
ENABLE_UIUC_MODEL:BOOL=ON

Updating

When updating the source from git, it is usually unnecessary to restart CMake as the solution is able to reconfigure itself when CMake files are changed. Simply rebuild the solution from Visual Studio and accept the reload of updated projects. When the Simgear/FlightGear version numbers change, you do have to re-run CMake.

It is also possible to edit CMakeList.txt files directly in Visual Studio as they also appear in the solution, and projects will be reconfigured on the next generation. To change build options or directory path, it is mandatory to use the CMake Gui. In case of problems, locate the CMakeCache.txt file in "Where to build the binaries” directory and delete it to reconfigure from scratch or use the menu item File > Delete Cache.

TerraGear

TerraGear can be built the same way as FlightGear, just change the paths to your TerraGear source and directories.

Jenkins Windows configurations

When using CMake GUI, you can add those entries by clicking the Add entry button. Note that you should omit the -D prefix.

OSG-stable-Win

cmake ..\svn -G "Visual Studio 10"
      -DACTUAL_3RDPARTY_DIR:PATH=%WORKSPACE%/3rdParty
      -DBUILD_OSG_APPLICATIONS:BOOL=ON
      -DCMAKE_INSTALL_PREFIX:PATH=%WORKSPACE%/install/msvc100/OpenSceneGraph
      -DOSG_PLUGIN_SEARCH_INSTALL_DIR_FOR_PLUGINS:BOOL=OFF
      -DFREETYPE_LIBRARY:FILEPATH=%WORKSPACE%/3rdParty/lib/freetype243.lib
      -DGDAL_INCLUDE_DIR:PATH=
      -DGDAL_LIBRARY:FILEPATH=

SimGear-Win-CMake

cmake ..\SimGear -G "Visual Studio 10"
      -DMSVC_3RDPARTY_ROOT=%WORKSPACE%
      -DCMAKE_INSTALL_PREFIX:PATH=%WORKSPACE%/install/msvc100/SimGear

FlightGear-Win-CMake

cmake ..\FlightGear -G "Visual Studio 10"
      -DMSVC_3RDPARTY_ROOT=%WORKSPACE%
      -DCMAKE_INSTALL_PREFIX:PATH=%WORKSPACE%/install/msvc100/FlightGear
      -DFLTK_FLUID_EXECUTABLE=%WORKSPACE%/3rdParty/bin/fluid.exe

FGRun-Win-CMake

cmake ..\svn -G "Visual Studio 10" 
      -DMSVC_3RDPARTY_ROOT:PATH=%WORKSPACE%
      -DCMAKE_INSTALL_PREFIX:PATH=%WORKSPACE%/install/msvc100/FGRun
      -DFLTK_FLUID_EXECUTABLE:FILEPATH=%WORKSPACE%/3rdParty/bin/fluid.exe
      -DGETTEXT_MSGFMT_EXECUTABLE:FILEPATH=%WORKSPACE%/3rdParty/bin/msgfmt.exe
      -DGETTEXT_MSGMERGE_EXECUTABLE:FILEPATH=%WORKSPACE%/3rdParty/bin/msgmerge.exe

TerraGear-Win-CMake

cmake ..\TerraGear -G "Visual Studio 10"
      -DMSVC_3RDPARTY_ROOT=%WORKSPACE%
      -DCMAKE_INSTALL_PREFIX:PATH=%WORKSPACE%/install/msvc100/TerraGear
      -DGPC_LIBRARY=%WORKSPACE%/3rdParty/lib/gpc232.lib
      -DNEWMAT_LIBRARY=%WORKSPACE%/3rdParty/lib/newmat11.lib

External link