Compare commits

...

3 commits

Author SHA1 Message Date
heinrich5991 de78a15a6d
Merge 4b2934eea0 into 51c0b4dafc 2024-09-03 17:36:04 +03:00
heinrich5991 4b2934eea0 README.md: Don't require the user to mkdir/cd
Also remove the `-j$(nproc)` parameter, if the user wants to fast, they
should use `ninja`.
2024-05-14 21:28:16 +02:00
heinrich5991 19f0aa50bb Consistently indent bullet points 2024-05-14 21:21:26 +02:00

View file

@ -68,35 +68,31 @@ Building on Linux and macOS
To compile DDNet yourself, execute the following commands in the source root:
mkdir build
cd build
cmake ..
make -j$(nproc)
Pass the number of threads for compilation to `make -j`. `$(nproc)` in this case returns the number of processing units.
cmake -Bbuild
cmake --build build
DDNet requires additional libraries, some of which are bundled for the most common platforms (Windows, Mac, Linux, all x86 and x86\_64) for convenience and the official builds. The bundled libraries for official builds are now in the ddnet-libs submodule. Note that when you build and develop locally, you should ideally use your system's package manager to install the dependencies, instead of relying on ddnet-libs submodule, which does not contain all dependencies anyway (e.g. openssl, vulkan). See the previous section for how to get the dependencies. Alternatively see the following build arguments for how to disable some features and their dependencies (`-DVULKAN=OFF` won't require Vulkan for example).
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]** <br>
An optional CMake variable for setting the build type. If not set, defaults to "Release" if `-DDEV=ON` is **not** used, and "Debug" if `-DDEV=ON` is used. See `CMAKE_BUILD_TYPE` in CMake Documentation for more information.
An optional CMake variable for setting the build type. If not set, defaults to "Release" if `-DDEV=ON` is **not** used, and "Debug" if `-DDEV=ON` is used. See `CMAKE_BUILD_TYPE` in CMake Documentation for more information.
* **-DPREFER_BUNDLED_LIBS=[ON|OFF]** <br>
Whether to prefer bundled libraries over system libraries. Setting to ON will make DDNet use third party libraries available in the `ddnet-libs` folder, which is the git-submodule target of the [ddnet-libs](https://github.com/ddnet/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.
Whether to prefer bundled libraries over system libraries. Setting to ON will make DDNet use third party libraries available in the `ddnet-libs` folder, which is the git-submodule target of the [ddnet-libs](https://github.com/ddnet/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]** <br>
Whether to enable WebSocket support for server. Setting to ON requires the `libwebsockets-dev` library installed. Default value is OFF.
Whether to enable WebSocket support for server. Setting to ON requires the `libwebsockets-dev` library installed. Default value is OFF.
* **-DMYSQL=[ON|OFF]** <br>
Whether to enable MySQL/MariaDB support for server. Requires at least MySQL 8.0 or MariaDB 10.2. Setting to ON requires the `libmariadbclient-dev` library installed, which are also provided as bundled libraries for the common platforms. Default value is OFF.
Whether to enable MySQL/MariaDB support for server. Requires at least MySQL 8.0 or MariaDB 10.2. Setting to ON requires the `libmariadbclient-dev` library 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").
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]** <br>
Whether to test MySQL/MariaDB support in GTest based tests. Default value is 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:
Note that this requires a running MySQL/MariaDB database on localhost with this setup:
```
CREATE DATABASE ddnet;
@ -106,47 +102,47 @@ FLUSH PRIVILEGES;
```
* **-DAUTOUPDATE=[ON|OFF]** <br>
Whether to enable the autoupdater. Packagers may want to disable this for their packages. Default value is ON for Windows and Linux.
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]** <br>
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.
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]** <br>
Whether to add video recording support using FFmpeg to the client. Default value is ON.
Whether to add video recording support using FFmpeg to the client. Default value is ON.
* **-DDOWNLOAD_GTEST=[ON|OFF]** <br>
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.
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]** <br>
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.
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]** <br>
Whether to enable UPnP support for the server.
You need to install `libminiupnpc-dev` on Debian, `miniupnpc` on Arch Linux.
Default value is OFF.
Whether to enable UPnP support for the server.
You need to install `libminiupnpc-dev` on Debian, `miniupnpc` on Arch Linux.
Default value is OFF.
* **-DVULKAN=[ON|OFF]** <br>
Whether to enable the vulkan backend.
On Windows you need to install the Vulkan SDK and set the `VULKAN_SDK` environment flag accordingly.
Default value is ON for Windows x86\_64 and Linux, and OFF for Windows x86 and macOS.
Whether to enable the vulkan backend.
On Windows you need to install the Vulkan SDK and set the `VULKAN_SDK` environment flag accordingly.
Default value is ON for Windows x86\_64 and Linux, and OFF for Windows x86 and macOS.
* **-GNinja** <br>
Use the Ninja build system instead of Make. This automatically parallelizes the build and is generally faster. Compile with `ninja` instead of `make`. Install Ninja with `sudo apt install ninja-build` on Debian, `sudo pacman -S --needed ninja` on Arch Linux.
Use the Ninja build system instead of Make. This automatically parallelizes the build and is generally faster. Compile with `ninja` instead of `make`. Install Ninja with `sudo apt install ninja-build` on Debian, `sudo pacman -S --needed ninja` on Arch Linux.
* **-DCMAKE_CXX_LINK_FLAGS=[FLAGS]** <br>
Custom flags to set for compiler when linking.
Custom flags to set for compiler when linking.
* **-DEXCEPTION_HANDLING=[ON|OFF]** <br>
Enable exception handling (only works with Windows as of now, uses DrMingw there). Default value is OFF.
Enable exception handling (only works with Windows as of now, uses DrMingw there). Default value is OFF.
* **-DIPO=[ON|OFF]** <br>
Enable interprocedural optimizations, also known as Link Time Optimization (LTO). Default value is OFF.
Enable interprocedural optimizations, also known as Link Time Optimization (LTO). Default value is OFF.
* **-DFUSE_LD=[OFF|LINKER]** <br>
Linker to use. Default value is OFF to try mold, lld, gold.
Linker to use. Default value is OFF to try mold, lld, gold.
* **-DSECURITY_COMPILER_FLAGS=[ON|OFF]** <br>
Whether to set security-relevant compiler flags like `-D_FORTIFY_SOURCE=2` and `-fstack-protector-all`. Default Value is ON.
Whether to set security-relevant compiler flags like `-D_FORTIFY_SOURCE=2` and `-fstack-protector-all`. Default Value is ON.
Running tests (Debian/Ubuntu)
-----------------------------
@ -158,7 +154,7 @@ This library isn't compiled, so you have to do it:
sudo apt install libgtest-dev
cd /usr/src/gtest
sudo cmake CMakeLists.txt
sudo make -j$(nproc)
sudo make
# copy or symlink libgtest.a and libgtest_main.a to your /usr/lib folder
sudo cp lib/*.a /usr/lib
@ -306,11 +302,9 @@ sv_use_sql 1
add_sqlserver r teeworlds record teeworlds "PW2" "localhost" "3306"
add_sqlserver w teeworlds record teeworlds "PW2" "localhost" "3306"
$ mkdir build
$ cd build
$ cmake -DMYSQL=ON ..
$ make -j$(nproc)
$ ./DDNet-Server -f mine.cfg
$ cmake -Bbuild -DMYSQL=ON
$ cmake --build build --target DDNet-Server
$ build/DDNet-Server -f mine.cfg
```
<a href="https://repology.org/metapackage/ddnet/versions">