User:Daemonburrito/Building FlightGear - Linux: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(→‎Compiling: Out-of-source explanation and link to cmake wiki.)
(→‎Compiling: More CMake background)
Line 1: Line 1:
== Compiling ==
== Compiling ==
=== CMake ===


Flightgear, Simgear, and OpenSceneGraph now use <tt>cmake</tt>. See the [http://www.cmake.org/Wiki/CMake_Useful_Variables CMake wiki] for additional documentation.
Flightgear, Simgear, and OpenSceneGraph now use <tt>cmake</tt>. See the [http://www.cmake.org/Wiki/CMake_Useful_Variables CMake wiki] for additional documentation.
Line 5: Line 7:
CMake allows users to create "out-of-source" builds, which means build files are created in a separate directory, and many variants can be maintained. To use out-of-source builds, simply create a new directory and pass the path to source to <code>cmake</code>.
CMake allows users to create "out-of-source" builds, which means build files are created in a separate directory, and many variants can be maintained. To use out-of-source builds, simply create a new directory and pass the path to source to <code>cmake</code>.


=== Example "out-of-source" build with CMake ===
==== Example "out-of-source" build with CMake ====


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
Line 12: Line 14:
build.simgear $ cmake ../simgear
build.simgear $ cmake ../simgear
</syntaxhighlight>
</syntaxhighlight>
==== <tt>ccmake</tt> ====
CMake build configuration files (<tt>CMakeCache.txt</tt>) are designed to be edited and generated. A GUI has been baked in since the beginning of the CMake project, which allows editing of configuration settings (like <tt>configure</tt> parameters).
For Ubuntu, the package <tt>cmake-curses-gui</tt> needs to be install to use the <tt>ccmake</tt> GUI.
==== Installation with CMake ====


After CMake has run, you can <code>make && make install</code>.
After CMake has run, you can <code>make && make install</code>.

Revision as of 15:37, 10 May 2014

Compiling

CMake

Flightgear, Simgear, and OpenSceneGraph now use cmake. See the CMake wiki for additional documentation.

CMake allows users to create "out-of-source" builds, which means build files are created in a separate directory, and many variants can be maintained. To use out-of-source builds, simply create a new directory and pass the path to source to cmake.

Example "out-of-source" build with CMake

simgear $ mkdir ../build.simgear
simgear $ cd ../build.simgear
build.simgear $ cmake ../simgear

ccmake

CMake build configuration files (CMakeCache.txt) are designed to be edited and generated. A GUI has been baked in since the beginning of the CMake project, which allows editing of configuration settings (like configure parameters).

For Ubuntu, the package cmake-curses-gui needs to be install to use the ccmake GUI.

Installation with CMake

After CMake has run, you can make && make install.

Getting and compiling SimGear

Step 1:

Clone the SimGear git repository and set it up to track the 'next' branch.

$ git clone git://gitorious.org/fg/simgear.git

or if the git port is firewalled on you network, use the http transport

$ git clone http://gitorious.org/fg/simgear.git

By default after cloning you should have a local next branch that tracks the master next branch. It can be updated it with git pull.

Step 2:

The source code will be downloaded into a directory called simgear.

Next, go into the directory and make preparations for the compilation:

$ cd simgear
$ cmake .

Note that if you don't want to install simgear globally on the system but in a specific directory, you can do so by adding -DCMAKE_INSTALL_PREFIX==/path/to/your/fgInstallation to the cmake command

Step 3:

Compile and install SimGear by doing:

$ make; make install

Note: with gcc 4.2 or later,on some platforms, you can get compiling errors about alc.h like:

'<anonymous>' has incomplete type 

take a look at http://bugs.gentoo.org/166723

Getting and compiling FlightGear

Step 1:

Clone the FlightGear git repository and set it up to track the 'next' branch.

$ git clone git://gitorious.org/fg/flightgear.git

By default after cloning you should have a local next branch that tracks the master next branch. It can be updated it with git pull.

Step 2:

Next, go into the folder and make preparations for the compilation:

$ cd flightgear
$ ./autogen.sh
$ ./configure

Note that if you don't want to install simgear globally on the system but in a specific directory, you can do so by adding --prefix=/path/to/your/fgInstallation to the ./configure command. If you didn't install OSG globally or in the same prefix as SimGear and FlightGear, you have to pass the OSG directory to the configure-command like this:

$ ./configure --prefix=/path/to/fgInstallation --with-osg=/path/to/osg/installation --enable-osgviewer

In this case you have to tell your system where to find the OSG libraries before you can run flightgear:

$ export LD_LIBRARY_PATH=/path/to/osgInstallation/lib:$LD_LIBRARY_PATH

Step 3:

Now you can compile and install Flightgear by:

$ make; make install

Step 4:

Clone the data directory:

$ git clone git://gitorious.org/fg/fgdata.git

The data directory is large (almost 2.5GB) so it will take considerable time to download. There mirror of fgdata that might be faster to download from:

$ git clone git://mapserver.flightgear.org/fgdata

The mirror is synchronized with the master so either will do.

And install it in (or as) /usr/local/share/FlightGear

$ mv fgdata /usr/local/share/flightgear