-
Notifications
You must be signed in to change notification settings - Fork 179
Compile (Linux)
If you just want to run RoR development builds without any hassle then have a look at the development builds: https://forum.rigsofrods.org/threads/ror-development-builds-for-0-4-8-for-windows-and-linux.696/
Rigs of Rods is very complex and is built on top of many components to provide its features. This results in a long list of dependencies. Most dependencies can usually be found in the software repositories of your distribution but some have to be compiled by hand. Fear not! While this may look overwhelming at first it is actually very easy if you follow these steps closely.
Before you can build Rigs of Rods itself you have to prepare several libraries it uses to be able to build it.
Many build dependencies can usually be found in the package repositories of a distribution. First check this wiki article if the packages for your distribution are already listed here. If they aren't, you have to identify them yourself. To identify which packages you need, skip to the next step, run CMake and see which dependencies it reports as missing. Search the package repositories for them and install them if they are available. If they aren't available, you would have to acquire the source code for them and build them yourself.
sudo apt-get update
sudo apt-get install build-essential git cmake ninja-build \
libssl-dev nvidia-cg-dev \
libgl1-mesa-dev libglu1-mesa-dev \
libxaw7-dev libx11-dev libxt-dev libxaw7-dev libxrandr-dev
There are a few more dependencies you need which have conveniently bundled in one git project so they can be built easily.
cd ~/
git clone --recursive https://github.com/RigsOfRods/ror-dependencies.git
cd ror-dependencies
cmake .
make
cd ~/
git clone --recursive https://github.com/RigsOfRods/rigs-of-rods.git
cd rigs-of-rods
It is recommended to create a dedicated directory for the build. This way, you can have multiple builds with different configurations simultaneously (e.g. different compilers or build types).
mkdir -p ~/rigs-of-rods/build
Before you can compile the code, you have to configure your build by running cmake. cmake automatically detects what platform you are using, finds the dependencies, sets up the flags for the compiler accordingly etc..
cd ~/rigs-of-rods/build
cmake -GNinja -B. -S.. -DCMAKE_PREFIX_PATH=~/ror-dependencies/Dependencies_Linux/ -DCMAKE_BUILD_TYPE=RelWithDebInfo
To start building simply run:
ninja
That's it! You finally built Rigs of Rods.
This section is only relevant for developers. For development purposes it might be beneficial to build with clang-tidy support. clang-tidy support requires a build that was built with the clang
compiler and an additional cmake switch. It can be configured like this:
mkdir -p ~/rigs-of-rods/build_clang
cd ~/rigs-of-rods/build_clang
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
cmake -B. -S.. -DCMAKE_PREFIX_PATH=~/ror-dependencies/Dependencies_Linux/ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
make
If you already got the sources and just want to update, follow the steps below:
cd rigs-of-rods
git pull
cmake .
ninja