23
edits
(→Compiling: More CMake background) |
(→Compiling: $PREFIX) |
||
| Line 1: | Line 1: | ||
== Compiling == | == Compiling == | ||
If you're compiling Flightgear, you are likely to attempt building the latest revision. It is unlikely that a Linux distro will have a version of OpenSceneGraph recent enough for the latest Flightgear. To make the process of building dependencies like OpenSceneGraph from source easier, these instructions will assume that you will be installing to a custom "prefix"; a tree separate from root (/usr/lib). | |||
This is advisable for the following reasons: | |||
* Builds can fail in mysterious ways if leftovers from older versions remain (common cause of build failures). You can safely delete your tree, without needing root. | |||
* If you're developing Flightgear, you are likely to need several variants available (e.g., "HEAD", Debug/Release). | |||
These instructions will use a Bash variable called "<tt>$PREFIX</tt>". You can assign this variable at the beginning to use the commands verbatim, or you can substitute your path by hand. | |||
=== Example: Setting <code>$PREFIX</code> === | |||
<syntaxhighlight lang="bash"> | |||
$ export PREFIX="/home/me/projects/fg" | |||
</syntaxhighlight> | |||
You can even use your "project" directory as the prefix. To do this cleanly, make a <tt>src/</tt> directory under the project directory. Download the git repositories into this directory. You will end up with a tree like this: | |||
<syntaxhighlight lang="bash"> | |||
</syntaxhighlight> | |||
=== CMake === | === CMake === | ||
| Line 7: | Line 28: | ||
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"> | ||
edits