Skip to content
m!m edited this page Oct 15, 2016 · 13 revisions

Before compiling FSO you need to install the required libraries. The exact names of the packages depend on your distribution. This list is not complete, please let us know which packages you needed if you compiled FSO on another distribution. This guide is aimed at people with less experience with compiling projects so if you already know how to do that you can probably skip a lot of these steps.

Ubuntu (and derivatives)

apt-get install libopenal-dev libogg-dev libvorbis-dev build-essential cmake libsdl2-dev libpng12-dev libjpeg62-dev liblua5.1-0-dev libjansson-dev libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev

Fedora (22+)

dnf install openal-devel libvorbis-devel gcc gcc-c++ cmake SDL2-devel compat-lua-devel libpng-devel libjpeg-devel jansson-devel ffmpeg-devel

Compiling

FSO uses CMake to generate the make files for compiling the project (Ninja works as well). Open a terminal and navigate to the source code checkout:

cd <source code dir>

Create a new directory for CMake to generate the Make files in and change to that directory (the name is not important but it shouldn't be an existing directory).

mkdir build
cd build

You are now able generate the Make file with CMake with a command similar to cmake ... However, before doing that you may want to customize the build process a bit. By setting special command line options for CMake you can influence how the Make files are generated. These variables are listed in the Readme of the main repository. If you just want to get an FSO executable then you probably want to set the FSO_FREESPACE_PATH variable to the path of your FS2 install. That will enable you to automatically install the executables to that path. If you don't want this you can just run the command from above.

cmake -DFSO_FREESPACE_PATH=<fs2 path> ..

This will generate the Make files. If everything went well the last line in the terminal should be

-- Build files have been written to: <build directory>

Now you are finally ready to compile the executables. To speed up the build make you can use the -j<N> option where <N> equals the number of cores your CPU has:

make -j<N> install

This will take a while, depending on how fast your CPU is. If everything went well this will end with the installation of the compiled exeutables:

Install the project...
-- Install configuration: "Release"
-- Installing: <fs2 path>/./fs2_open_3_7_5_x64

That's it! You now have your executable that you can use either directly or with wxLauncher.