-
Notifications
You must be signed in to change notification settings - Fork 163
Building on Linux
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.
apt-get install libopenal-dev libogg-dev libvorbis-dev build-essential cmake libsdl2-dev libtheora-dev libreadline6-dev libpng12-dev libjpeg62-dev liblua5.1-0-dev libjansson-dev
dnf install openal-devel libvorbis-devel gcc gcc-c++ cmake SDL2-devel libtheora-devel readline-devel compat-lua-devel libpng-devel libjpeg-devel jansson-devel libtool
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.