Superbuild

From FlightGear wiki
Jump to: navigation, search

Requirements

According to some recent reports, you should make sure to upgrade your cmake binary to 2.12.1 if you encounter any errors [1].

The superbuild is currently bit-rotted but could be resurrect, however with the build script (.bat) in fg-meta it’s less needed, especially now we have the windows-3rdparty-repo better organised. [1] (note the quote context: for MSVC 2015 and higher support)

Building via the superbuild

A CMake super-build is a project which downloads, configures and builds other projects. Download can be from a web server, or via Git or SVN. Most normal CMake options apply - you can use different generators (Makefiles, VisualStudio, XCode) and pass in options.

Getting the source

In all cases, you should get the superbuild by doing a clean clone (from Git) of fgmeta, with the --recursive option:

 git clone --recursive git://git.code.sf.net/p/flightgear/fgmeta/ flightgear-fgmeta

This tells Git to clone submodules, which we need since both flightgear and simgear are submodules of fgmeta. The source repository is fgmeta. Note that providing you cloned with --recursive, git pull will also update submodules automatically; some documentation and pages may tell you to manually run git update submodules but providing you do the initial clone with --recursive option, it should not be needed.

Note the superbuild does not include any data repository or base files - you should separately download these or clone fgdata, and pass the location to fgfs when running in your preferred way, eg via the --fg-root command line argument.

Once the clone is complete, check out the next branch of fgmeta; the superbuild is not supported on the release branches.

cd flightgear-fgmeta
git checkout next

Superbuild on Windows

1rightarrow.png See Superbuild on Windows for the main article about this subject.

Using VisualStudio / msbuild:

Requirements:

  • CMake for Windows
  • SVN (see here.)
  • VisualStudio 2010 or 2012 (it should works, otherwise please report it)
  • Optional: Microsoft Windows SDK (only required for 64-bit builds)
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.
  • Optional: Visual Studio 2010 SP1 (recommend you install this if you use the 2010 version; overcomes various issues users have had according to the forums.)


We assume you have cloned fgmeta in C:\FGFS\fgmeta. All the example paths below work just fine if you replace C:\FGFS with G:\MyAwesomeDir\AnySubDir. (Spaces in the paths are untested and might cause issues, but might work fine)

The steps are as follows:

  • Make a build dir beside fgmeta - for example C:\FGFS\metabuild
  • Run the CMake GUI, and select C:\FGFS\fgmeta as the source dir, and C:\FGFS\metabuild as the build dir
  • Run 'Configure' once, and set CMAKE_INSTALL_PREFIX to C:\FGFS\metabuild\install (this step will be automated soon)
If Subversion_SVN_EXECUTABLE is marked red, look for svn.exe in the folders under where SVN is installed and set it to point at that.
  • Run 'Configure' again, and then 'Generate'.
    This step creates the FlightGear-Meta solution (.sln) in C:\FGFS\metabuild
  • Build the FlightGear-Meta solution in C:\FGFS\metabuild
This build step creates FlightGear.sln in C:\FGFS\metabuild\fgbuild
You can build the -Meta solution from a Visual Studio command prompt using msbuild, or open up the .sln in the IDE and hit build.
To avoid build errors in the IDE, perform your first build using the 'Release' build configuration rather than a 'Debug' configuration. Building in 'Debug' configuration can fail if some release-mode files (such as for OpenSceneGraph) are not already present in their folders.
The first time will be slow - OpenSceneGraph and Boost will be downloaded and compiled, followed by all of simgear and finally flightgear.
If the build fails due to a "hash mismatch" in the OpenSceneGraph file, it could be because the source site itself is inaccessible or having temporary issues. To confirm this, check the presence and size of the downloaded OpenSceneGraph-x.x.x.zip file in C:\FGFS\metabuild\src . You might also try and obtain the file directly. To determine where SuperBuild is trying to get the file from, look for the OSG_SOURCE setting defined in C:\FGFS\fgmeta\CMakeLists.txt
Once the -Meta build completes, you will already have a flyable executable in either C:\FGFS\metabuild\install\msvc100-64\FlightGear\bin or C:\FGFS\metabuild\install\msvc100\FlightGear\bin depending on whether it's 64 or 32 bit. Other files such as fgrun.exe can be found and copied from the nearby folders under \install if required. (If you build with VS2012, you would rather get a msvc110 directory)


It is easier to run FlightGear by closing the -Meta solution, and instead opening the FlightGear.sln in C:\FGFS\metabuild\fgbuild. From here you can set 'fgfs' as the startup project, enter any command line options, and debug / hack / run the code as normal.

Note you will need to add the OpenSceneGraph install directory to the PATH variables in the 'fgfs' target properties; the dir will be something like C:\FGFS\metabuild\install\msvc100\OpenSceneGraph\bin. Again this step will hopefully go away soon, but for the moment is still required.

Using other generators / IDEs: untested, but quite likely to work if they already work with CMake. Try it out.

Superbuild on Linux

Requirements:

  • compiler (probably GCC)
  • CMake - available on all distros
  • Boost - available on all distros
  • development packages for your distribution. (For OpenGL, OpenAL and OpenSceneGraph dependencies such as FreeType)

See here for some lists of packages names for distributions, but be aware these change or go out of date.

(The follow assumes regular 'make' generator, other generators may work, testing welcome)

  • make build dir next to your fgmeta clone
  • cd into the build dir
  • run cmake ../fgmeta -DCMAKE_INSTALL_PREFIX=$PWD/install -DCMAKE_BUILD_TYPE=Release (or Debug for a debug configuration(
  • run make -jN (where N is as large a number as your system can support)
  • make some coffee
  • fgfs should be in install/bin

Superbuild on Mac

Make-based build works, XCode is more interesting. Probably only for the brave,

Maintenance

Cquote1.png the Superbuild script isn't very well documented for people interested in maintaining/extending it - on the other hand, cmake itself is relatively straightforward, and we should be able to work out what is needed to also build your osgEarth branch using the Superbuild. The main thing that the Superbuild is built around is the ExternalProject notion, which is included at the top of the file: http://sourceforge.net/p/flightgear/fgm ... sts.txt#l3
— Hooray (Thu Apr 09). Re: Buildings in OsgEarth.
(powered by Instant-Cquotes)
Cquote2.png
Cquote1.png the main directive is ExternalProject_Add() - e.g. see the section which builds boost: http://sourceforge.net/p/flightgear/fgm ... ts.txt#l26


This directive is highly flexible and supports a huge variety of options (e.g. downloading options etc) - which are extensively covered at: http://www.cmake.org/cmake/help/v3.0/mo ... oject.html

An introduction can be found at: http://www.kitware.com/media/html/Build ... ke2.8.html


— Hooray (Thu Apr 09). Re: Buildings in OsgEarth.
(powered by Instant-Cquotes)
Cquote2.png
  1. James Turner (Apr 17th, 2016). Re: [Flightgear-devel] MSVC 2012 or 2013 support?.