Skip to content
Hiradur edited this page Oct 19, 2024 · 35 revisions

Tip: Development build

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/

Introduction

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.

Acquire build dependencies

Before you can build Rigs of Rods itself you have to prepare several libraries it uses to be able to build it.

Install build dependencies from package repositories

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.

Packages required on Debian/Ubuntu/Mint

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

Compile build dependencies

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

Building Rigs of Rods

Download the source code:

cd ~/
git clone --recursive https://github.com/RigsOfRods/rigs-of-rods.git
cd rigs-of-rods

Create a dedicated build directory:

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

Configuring your 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

Building the source code

To start building simply run:

ninja

That's it! You finally built Rigs of Rods.

Build with clang-tidy support

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

Updating existing sources

If you already got the sources and just want to update, follow the steps below:

cd rigs-of-rods
git pull

cmake .
ninja