Skip to content

Build UPBGE on Linux

lordloki edited this page Jan 24, 2020 · 30 revisions

The procedure is almost the same as for building blender

https://wiki.blender.org/index.php/Dev:Doc/Building_Blender/Linux/Ubuntu/CMake (For Ubuntu or Linux Mint)

Get the sources

Note: If you are having troubles with the repository and submodules, just delete the folder and start fresh again.
Beware: Deleting a git folder will also remove any branch/work you made inside, act carefully.

mkdir ~/sources/
cd ~/sources/
git clone https://github.com/UPBGE/blender.git upbge
cd upbge
git submodule sync
git submodule update --init --recursive --remote
git submodule foreach git checkout master
git submodule foreach git pull --rebase origin master

Update the sources and libraries

git pull --rebase
git submodule update --recursive --remote
git submodule foreach git pull --rebase origin master
(
    cd build_files/build_environment
    ./install_deps.sh
)

These commands can be automated in a .sh (executable) file.

Build

The UPBGE repository contains the sources, which have to be compiled. It is preferred to compile in a different directory, so you will need some folder to store the build (compiled program/libraries).

You may have different builds, Release (optimized), Debug (with extra debugging symbols inside the binaries) or different flags enabled etc... So it is also recommended to name your build folders accordingly in order to know what kind of build is inside the folder.

mkdir -p ~/builds/upbge-dev
cd ~/builds/upbge-dev

# using cmake to generate our build-system files
cmake -DCMAKE_CXX_STANDARD=11 ~/sources/upbge

# -j controls the number of max jobs to run in parallel.
# (5 if you have a quad cores CPU, 9 for 8 cores, 3 for 2 cores)
make -j5
make install

If you are using cmake-gui, go in advanced options and check with CXX11. Once you have configured and generated your build system files, go into the build folder and use make like mentioned above to build.

CMake magic explained:

cmake is a tool to generate the files for your build system. Basically, when you want to make a build, you would write a Makefile and then use make to follow the instructions. CMake is a tool that uses configuration files from the sources (CMakeLists.txt or others) and allow you to configure extra parameters in order to automatically write a Makefile in your build folder, taking into account all the parameters that you used to set it up.

Usually cmake is invoked from the build folder, and we pass the path to the sources folder for it to pick up the different CMakeLists.txt files and be able to generate a healthy build setup.

Troubleshooting

When running install_deps script, some issues were already reported related to Open Image IO and Open Shading Language.

To skip installation of these librairies run install_deps with options:

./install_deps.sh --skip-osl --skip-oiio

To know what options can be skipped, open install_deps script with a text editor. All the options are listed.

Clone this wiki locally