For basic build instructions, refer to the Building section in the README.
The following is a non-exhaustive list of build arguments that can be passed to the cmake command-line tool in order to enable or disable options in build time:
-
-DCMAKE_BUILD_TYPE=[Release|Debug|RelWithDebInfo|MinSizeRel]
An optional CMake variable for setting the build type. If not set, defaults to "Release" if-DDEV=ONis not used, and "Debug" if-DDEV=ONis used. SeeCMAKE_BUILD_TYPEin CMake Documentation for more information. -
-DPREFER_BUNDLED_LIBS=[ON|OFF]
Whether to prefer bundled libraries over system libraries. Setting to ON will make DDNet use third party libraries available in theddnet-libsfolder, which is the git-submodule target of the ddnet-libs repository mentioned above -- Useful if you do not have those libraries installed and want to avoid building them. If set to OFF, will only use bundled libraries when system libraries are not found. Default value is OFF. -
-DWEBSOCKETS=[ON|OFF]
Whether to enable WebSocket support for server. Setting to ON requires thelibwebsockets-devlibrary installed. Default value is OFF. -
-DMYSQL=[ON|OFF]
Whether to enable MySQL/MariaDB support for server. Requires at least MySQL 8.0 or MariaDB 10.2. Setting to ON requires thelibmariadb-dev-compatlibrary installed, which are also provided as bundled libraries for the common platforms. Default value is OFF.Note that the bundled MySQL libraries might not work properly on your system. If you run into connection problems with the MySQL server, for example that it connects as root while you chose another user, make sure to install your system libraries for the MySQL client. Make sure that the CMake configuration summary says that it found MySQL libs that were not bundled (no "using bundled libs").
-
-DTEST_MYSQL=[ON|OFF]
Whether to test MySQL/MariaDB support in GTest based tests. Default value is OFF.Note that this requires a running MySQL/MariaDB database on localhost with this setup:
CREATE DATABASE ddnet;
CREATE USER 'ddnet'@'localhost' IDENTIFIED BY 'thebestpassword';
GRANT ALL PRIVILEGES ON ddnet.* TO 'ddnet'@'localhost';
FLUSH PRIVILEGES;-
-DAUTOUPDATE=[ON|OFF]
Whether to enable the autoupdater. Packagers may want to disable this for their packages. Default value is ON for Windows and Linux. -
-DCLIENT=[ON|OFF]
Whether to enable client compilation. If set to OFF, DDNet will not depend on Curl, Freetype, Ogg, Opus, Opusfile, and SDL2. Default value is ON. -
-DVIDEORECORDER=[ON|OFF]
Whether to add video recording support using FFmpeg to the client. Default value is ON. -
-DDOWNLOAD_GTEST=[ON|OFF]
Whether to download and compile GTest. Useful if GTest is not installed and, for Linux users, there is no suitable package providing it. Default value is OFF. -
-DDEV=[ON|OFF]
Whether to optimize for development, speeding up the compilation process a little. If enabled, don't generate stuff necessary for packaging. Setting to ON will set CMAKE_BUILD_TYPE to Debug by default. Default value is OFF. -
-DUPNP=[ON|OFF]
Whether to enable UPnP support for the server. You need to installlibminiupnpc-devon Debian,miniupnpcon Arch Linux. Default value is OFF. -
-DVULKAN=[ON|OFF]
Whether to enable the Vulkan graphics backend. You need to install the Vulkan SDK and set theVULKAN_SDKenvironment flag accordingly. Default value is ON for Linux, and OFF for Windows and macOS. -
-GNinja
Use the Ninja build system instead of Make. This automatically parallelizes the build and is generally faster. Compile withninjainstead ofmake. Install Ninja withsudo apt install ninja-buildon Debian,sudo pacman -S --needed ninjaon Arch Linux. -
-DCMAKE_CXX_LINK_FLAGS=[FLAGS]
Custom flags to set for compiler when linking. -
-DEXCEPTION_HANDLING=[ON|OFF]
Enable exception handling (only works with Windows as of now, uses DrMingw there). Default value is OFF. -
-DIPO=[ON|OFF]
Enable interprocedural optimizations, also known as Link Time Optimization (LTO). Default value is OFF. -
-DFUSE_LD=[OFF|LINKER]
Linker to use. Default value is OFF to try mold, lld, gold. -
-DSECURITY_COMPILER_FLAGS=[ON|OFF]
Whether to set security-relevant compiler flags like-D_FORTIFY_SOURCE=2and-fstack-protector-all. Default Value is ON. -
-DMACOS_CODESIGN=[ON|OFF]
Whether to sign code when building the DMG on macOS.
Install MinGW cross-compilers of the form i686-w64-mingw32-gcc (32 bit) or
x86_64-w64-mingw32-gcc (64 bit). This is probably the hard part. ;)
Then add -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/mingw64.toolchain to the
initial CMake command line.
Install osxcross, then add
-DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/darwin.toolchain and
-DCMAKE_OSX_SYSROOT=/path/to/osxcross/target/SDK/MacOSX10.11.sdk/ to the
initial CMake command line.
Install dmg and hfsplus from
libdmg-hfsplus and newfs_hfs
from
diskdev_cmds
to unlock the package_dmg target that outputs a macOS disk image.
Detailed instructions can be found in docs/BUILDING-android.md.
Detailed instructions can be found in docs/BUILDING-emscripten.md.