Superbuild: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
 
(30 intermediate revisions by 8 users not shown)
Line 1: Line 1:
== Requirements ==
According to some recent reports, you should make sure to upgrade your cmake binary to 2.12.1 if you encounter any errors [http://forum.flightgear.org/viewtopic.php?f=37&t=21579&p=196700#p196670].
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.
<ref> {{cite web
  | url    = http://sourceforge.net/p/flightgear/mailman/message/35020034/
  | title  = <nowiki>Re: [Flightgear-devel] MSVC 2012 or 2013 support?</nowiki>
  | author = <nowiki>James Turner</nowiki>
  | date  = Apr 17th, 2016
  | added  = Apr 17th, 2016
  | script_version = 0.26
  }}
</ref> ('''note the quote context: ''' for MSVC 2015 and higher support)
==Building via the superbuild==
==Building via the superbuild==


Line 5: Line 19:
===Getting the source===
===Getting the source===


In all cases, you should get the superbuild by doing a clean clone (from Git) of fgmeta, with the --recursive options. This tells Git to clone submodules, which we need since both flightgear and simgear are submodules of fgmeta. The source repository is: [http://git.gitorious.org/fg/fgmeta.git here]
In all cases, you should get the superbuild by doing a clean clone (from Git) of fgmeta, with the <code>--recursive</code> option:
Once the clone complete, checkout the 'next' branch of fgmeta; the superbuild is not supported on the release branches. 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.
 
{{#tag:source
| {{fgmeta clone
  | opt  = --recursive
  | post = fgmeta
  }}
| lang=sh
}}
 
This tells Git to clone submodules, which we need since both flightgear and simgear are submodules of fgmeta. The source repository is {{fgmeta source|text=fgmeta}}.
Note that providing you cloned with <code>--recursive</code>, git pull will also update submodules automatically; some documentation and pages may tell you to manually run <code>git submodule update</code> but providing you do the initial clone with <code>--recursive</code> 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 <code>--fg-root</code> command line argument.
 
Once the clone is complete, check out the <code>next</code> branch of fgmeta; the superbuild is not supported on the release branches.


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.
<source lang=sh>
cd fgmeta
git checkout next
</source>
<!-- FIXME: Needs to be made compatible with the <source> tags: {{Git checkout|next}} -->


===Superbuild on Windows===
===Superbuild on Windows===
{{Main article|Superbuild on Windows}}


Using VisualStudio / msbuild:
Using VisualStudio / msbuild:


Requirements:
Requirements:
* VisualStudio 2010 (for the moment, other variations such as 2012 need some work)
* CMake for Windows
  Note that if you see the error "LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt"
* SVN (see [[Tools of the Trade#Source Code Management / Revision Control Systems|here]].)
  after running the CMake "Configure" command and you're using Visual Studio 2010, you should install Service Pack 1 for
* VisualStudio 2010 or 2012 (it should works, otherwise please report it)
  VS2010.  The service pack can be downloaded from here: http://www.microsoft.com/en-us/download/details.aspx?id=23691
* Optional: [http://www.microsoft.com/en-us/download/details.aspx?id=8279 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: [http://www.microsoft.com/en-au/download/details.aspx?id=23691 Visual Studio 2010 SP1] (recommend you install this if you use the 2010 version; overcomes various issues users have had according to the forums.)


* CMake for Windows


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.
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.
Line 29: Line 63:
* Run the CMake GUI, and select C:\FGFS\fgmeta as the source dir, and C:\FGFS\metabuild as the build dir
* 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)
* Run 'Configure' once, and set CMAKE_INSTALL_PREFIX to C:\FGFS\metabuild\install (this step will be automated soon)
* Run 'Configure' again, and then 'Generate'
: 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'.<br />This step creates the ''FlightGear-Meta'' solution (.sln) in C:\FGFS\metabuild
* Build the FlightGear-Meta solution in C:\FGFS\metabuild<br />
:This build step creates ''FlightGear.sln'' in C:\FGFS\metabuild\fgbuild<br />
 
: 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.<br />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.<br />
 
: The first time will be slow - OpenSceneGraph and Boost will be downloaded and compiled, followed by all of simgear and finally flightgear.<br />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 <br />


C:\FGFS\metabuild now contains a FlightGear-Meta solution (.sln);you can build this from a Visual Studio command prompt using msbuild, or open up the .sln in the IDE and again hit build. The first time will be slow - OpenSceneGraph and Boost will be downloaded and compiled, followed by all of simgear and finally flightgear.
: 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)<br />


Once the build completes, 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.
<br />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, bu for the moment is still required.
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.
Using other generators / IDEs: untested, but quite likely to work if they already work with CMake. Try it out.
Line 52: Line 93:
(The follow assumes regular 'make' generator, other generators may work, testing welcome)
(The follow assumes regular 'make' generator, other generators may work, testing welcome)


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


===Superbuild on Mac===
===Superbuild on Mac===


Make-based build works, XCode is more interesting. Probably only for the brave,
Make-based build works, XCode is more interesting. Probably only for the brave,
==Maintenance ==
{{FGCquote
  |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/fgmeta/ci/next/tree/CMakeLists.txt#l3 http://sourceforge.net/p/flightgear/fgm ... sts.txt#l3]
  |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=238199#p238199
    |title=<nowiki>Re: Buildings in OsgEarth</nowiki>
    |author=<nowiki>Hooray</nowiki>
    |date=<nowiki>Thu Apr 09</nowiki>
  }}
}}
{{FGCquote
  |the main directive is '''ExternalProject_Add()''' - e.g. see the section which builds boost: [http://sourceforge.net/p/flightgear/fgmeta/ci/next/tree/CMakeLists.txt#l26 http://sourceforge.net/p/flightgear/fgm ... ts.txt#l26]<br/>
<br/>
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/module/ExternalProject.html http://www.cmake.org/cmake/help/v3.0/mo ... oject.html]<br/>
<br/>
An introduction can be found at: [http://www.kitware.com/media/html/BuildingExternalProjectsWithCMake2.8.html http://www.kitware.com/media/html/Build ... ke2.8.html]
  |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=238199#p238199
    |title=<nowiki>Re: Buildings in OsgEarth</nowiki>
    |author=<nowiki>Hooray</nowiki>
    |date=<nowiki>Thu Apr 09</nowiki>
  }}
}}


[[Category:Core development projects]]
[[Category:Core development projects]]
[[Category:Building from source]]

Latest revision as of 17:44, 4 August 2023

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/ 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 submodule update 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 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 directory

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?.