| 1 |
Build & install instructions |
| 2 |
============================ |
| 3 |
|
| 4 |
These are build & install instructions for Dust Racing 2D. |
| 5 |
|
| 6 |
Source code |
| 7 |
=========== |
| 8 |
|
| 9 |
The source tree includes source code for the track editor and the game itself. |
| 10 |
|
| 11 |
The code is "documented" with Doxygen tags. |
| 12 |
|
| 13 |
The source tree layout: |
| 14 |
|
| 15 |
src/game/ : Source files for the game. |
| 16 |
src/game/MiniCore/ : Graphics and physics engine. |
| 17 |
src/game/MTFH/ : Menu Toolkit From Hell. |
| 18 |
src/game/STFH/ : Sound Toolkit From Hell. |
| 19 |
src/editor/ : Source files for the track editor. |
| 20 |
src/common/ : Shared files between the editor and the game. |
| 21 |
src/images/ : Some SVG-images used as the source for final images. |
| 22 |
|
| 23 |
Data directory structure: |
| 24 |
|
| 25 |
data/ : Data mapping and configuration files. |
| 26 |
data/fonts/ : Font used by the game. |
| 27 |
data/icons/ : Icon files for game and editor. |
| 28 |
data/images/ : Image files and textures loaded by the game. |
| 29 |
data/levels/ : Level data. |
| 30 |
data/models/ : 3D models. |
| 31 |
data/sounds/ : Sound files. |
| 32 |
data/translations/ : Released Qt translation files. |
| 33 |
|
| 34 |
Other: |
| 35 |
|
| 36 |
packaging/windows/ : NSIS packaging for Windows. |
| 37 |
|
| 38 |
Build systems |
| 39 |
============= |
| 40 |
|
| 41 |
The "official" build system for Linux is CMake. |
| 42 |
|
| 43 |
Toolchains |
| 44 |
========== |
| 45 |
|
| 46 |
GCC/MinGW and Clang are the only "officially" supported toolchains on Linux. |
| 47 |
|
| 48 |
Windows builds are done in a Docker container with MXE (http://mxe.cc). The build script |
| 49 |
also generates automatically an NSIS Windows installer and a ZIP-archive. |
| 50 |
|
| 51 |
See scripts/build-windows-nsis and scripts/build-windows-nsis-packaging-helper. |
| 52 |
|
| 53 |
Building the project with Microsoft Visual C++ also works, but no automatic |
| 54 |
packaging/deployment currently exist. The runtime files (data/, Qt, OpenAL..) must be |
| 55 |
manually copied in place. See more detailed instructions below. |
| 56 |
|
| 57 |
Build dependencies |
| 58 |
================== |
| 59 |
|
| 60 |
Currently the build depends on Qt, libopenal and libvorbisfile. |
| 61 |
On Linux pkg-config is required. |
| 62 |
|
| 63 |
Building in the command line on Linux (tested on Ubuntu 24.04 LTS) |
| 64 |
================================================================== |
| 65 |
|
| 66 |
Development build (the game can be run without installing anything): |
| 67 |
------------------------------------------------------------------- |
| 68 |
|
| 69 |
1) Install Qt6 (>= 6.4) development files and other build tools: |
| 70 |
|
| 71 |
`$ sudo apt install build-essential cmake pkg-config libqt6uitools6 linguist-qt6 qt6-base-dev qt6-l10n-tools qt6-tools-dev-tools qt6-tools-private-dev libopenal-dev libvorbis-dev` |
| 72 |
|
| 73 |
(Qt packaging might change between Ubuntu releases) |
| 74 |
|
| 75 |
2) Go to the source directory and run: |
| 76 |
|
| 77 |
`$ mkdir build && cd build` |
| 78 |
|
| 79 |
`$ cmake ..` |
| 80 |
|
| 81 |
`$ make` |
| 82 |
|
| 83 |
This will build the editor and the game binaries. |
| 84 |
|
| 85 |
Run the game: |
| 86 |
|
| 87 |
`$ ./dustrac-game` |
| 88 |
|
| 89 |
Optionally run the track editor: |
| 90 |
|
| 91 |
`$ ./dustrac-editor` |
| 92 |
|
| 93 |
Run unit tests: |
| 94 |
|
| 95 |
`$ ctest` |
| 96 |
|
| 97 |
Release build (in this example game installs under /usr): |
| 98 |
-------------------------------------------------------- |
| 99 |
|
| 100 |
`$ mkdir build && cd build` |
| 101 |
|
| 102 |
`$ cmake .. -DReleaseBuild=ON -DCMAKE_INSTALL_PREFIX=/usr` |
| 103 |
|
| 104 |
`$ make` |
| 105 |
|
| 106 |
This will build the editor and the game binaries. |
| 107 |
|
| 108 |
Install the binaries and data files: |
| 109 |
|
| 110 |
`$ sudo make install` |
| 111 |
|
| 112 |
This installs also the desktop files so Dust Racing 2D |
| 113 |
should appear in your application menu. |
| 114 |
|
| 115 |
Cross-compiling for Windows in Docker with MXE on Linux |
| 116 |
======================================================= |
| 117 |
|
| 118 |
1) Install Docker |
| 119 |
|
| 120 |
2) `$ ./scripts/build-windows-installer` |
| 121 |
|
| 122 |
CPack |
| 123 |
===== |
| 124 |
|
| 125 |
Dust Racing 2D has a support for CPack. It's not complete, but can be used to generate |
| 126 |
e.g. Debian packages. |
| 127 |
|
| 128 |
After a successful build with ReleaseBuild=ON run CPack: |
| 129 |
|
| 130 |
`$ cpack -G DEB` |
| 131 |
|
| 132 |
This will generate a Debian package. |
| 133 |
|
| 134 |
Building with Microsoft Visual C++ (OUTDATED) |
| 135 |
============================================= |
| 136 |
|
| 137 |
The project has been successfully compiled and executed with MSVC with the following setup: |
| 138 |
|
| 139 |
* Windows 8.1 Pro |
| 140 |
* Windows SDK for Windows 8.1 |
| 141 |
* CMake 3.0 |
| 142 |
* Qt 5.3 32-bit SDK for MSVC |
| 143 |
* MS Visual Studio 2013 for Desktop Windows |
| 144 |
|
| 145 |
1) Download and build Vorbis libraries and OpenAL Soft with the same toolchain |
| 146 |
|
| 147 |
2) Open the top-level CMakeLists.txt in Qt Creator, configure and build |
| 148 |
|
| 149 |
3) Copy the runtime files, like OpenAL DLL, to the same directory with the game binary |
| 150 |
|
| 151 |
Jenkins CI |
| 152 |
========== |
| 153 |
|
| 154 |
Jenkinsfile includes pipelines configuration for Jenkins CI. |
| 155 |
|
| 156 |
For packagers |
| 157 |
============= |
| 158 |
|
| 159 |
The binaries only need to find the data dir that includes |
| 160 |
all the runtime data. This can be set in the main CMakeLists.txt |
| 161 |
and is given to the game via -DDATA_PATH. |
| 162 |
|
| 163 |
The release build should be used when packaging (give |
| 164 |
-DReleaseBuild=ON to cmake). |
| 165 |
|
| 166 |
Currently the data files install to CMAKE_INSTALL_PREFIX/share/DustRacing |
| 167 |
and the binaries install to CMAKE_INSTALL_PREFIX/bin. |
| 168 |
|
| 169 |
Among the data files there are also fonts that are installed by default; |
| 170 |
in case they are available in the system, it is possible to not ship |
| 171 |
any font by giving -DSystemFonts=ON to cmake. |
| 172 |
|
| 173 |
CMAKE_INSTALL_PREFIX usually defaults to /usr/local and |
| 174 |
can be changed by giving, for example, -DCMAKE_INSTALL_PREFIX=/usr to cmake. |
| 175 |
|