Skip to content

Building

Ayush edited this page May 21, 2021 · 6 revisions

Building

Workflow dependenies

Name Version
cmake 3.16.0+
ninja 1.8.2
git 2.17.1

For Linux and Mac, ninja is optional as you can use make instead

Linux

First install the required dependencies using the package manager of your distribution

Debian/Ubuntu:

sudo apt install build-essential git cmake ninja-build libsdl2-dev libsdl2-ttf-dev

Fedora:

sudo dnf install git cmake ninja-build SDL2-devel SDL2_ttf-devel

Arch Linux:

sudo pacman -S git cmake ninja-build libsdl2-dev libsdl2-ttf-dev

MacOS

Just install the dependencies using brew

brew install git cmake ninja-build sdl2 sdl2_ttf

Windows

You need MSVC dev tools or mingw for compilation.
For MSVC, You can get it with whatever way it is recommended on windows by Microsoft, https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line

For MinGW, download it and set it up on your %PATH%, https://sourceforge.net/projects/mingw-w64/

Finally install cmake, https://cmake.org/
You should also install ninja for non-MSVC compilers, https://ninja-build.org/

Since, windows lack a proper package manager, SDL and SDL_ttf is obtained using nuget. Get nuget from https://www.nuget.org/

Run the batch script, exactly after getting the sources

cmd /c "scripts\install_sdl_on_windows.bat"

Getting sources

Using git,

git clone --recursive https://github.com/deccanengine/deccanengine.git
cd deccanengine

Building

Once successfully cloned, generate build files using

cmake -S . -B builddir -G Ninja

remove the -G Ninja part to use make instead

And build using

cmake --build builddir

By default, build files are generated for Release mode, switch to Debug using,

cmake -S . -B builddir -DCMAKE_BUILD_TYPE=Debug

You can use a different compiler by,

cmake -S . -B builddir -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++

Note: env might not be available on Windows

On windows, you can generate Visual Studio build files as follows:

cmake -S . -B builddir -G "Visual Studio 16 2019"

Note for non-CMake users: All commands containing cmake -S ... is generation command while cmake --build ... is the actual build command. You have to re-run the build command each time after you run a generation command

Cross-compilation

To be added soon