Superbuild

From FlightGear wiki
Jump to navigation Jump to 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].

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://gitorious.org/fg/fgmeta.git


This tells Git to clone submodules, which we need since both flightgear and simgear are submodules of fgmeta. The source repository is: here 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.

git checkout next


Superbuild on Windows

Using VisualStudio / msbuild:

Requirements:

  • VisualStudio 2010 (for the moment, other variations such as 2012 need some work)
  • CMake for Windows
  • SVN (see here.)

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.


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,