1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
|
Build & install instructions
============================
These are build & install instructions for Dust Racing 2D.
Source code
===========
The source tree includes source code for the track editor and
the game itself. The game uses an 2D engine called MiniCore
written by Jussi Lind. The code is "documented" by using
Doxygen tags.
The source tree layout:
src/game/ : Source files for the game.
src/game/MiniCore/ : Graphics and physics engine.
src/game/MTFH/ : Menu Toolkit From Hell.
src/game/STFH/ : Sound Toolkit From Hell.
src/editor/ : Source files for the track editor.
src/common/ : Shared files between the editor and the game.
src/images/ : Some SVG-images used as the source for final images.
data/ : Data mapping and configuration files.
data/images/ : Image files and textures loaded by the game.
data/levels/ : Level data.
data/shaders/ : GLSL shaders.
packaging/ : Example packaging for Ubuntu/Debian.
Build systems
=============
The "official" build system for Linux is CMake.
There are also qmake project files for easier cross-compilation for Windows and Android. Qt5 is required.
I used to make Windows releases also with CMake, but in the future I'll cross-compile for Windows on Ubuntu host by using MXE and qmake. MXE is a cool cross-compilation environment
and all libraries are linked statically by default (no DLLs needed).
Toolchains
==========
GCC/MinGW and Clang are the only "officially" supported toolchains on Linux.
Windows builds are done on Ubuntu with MXE (web: mxe.cc). The build script
also generates automatically an NSIS Windows installer and a ZIP-archive.
See scripts/mxeWindowsBuild.sh.
Building the project with Microsoft Visual C++ 2013 also works, but no automatic
packaging/deployment currently exist. The runtime files (data/, Qt, OpenAL..) must be
manually copied in place. See more detailed instructions below.
Build dependencies
==================
Currently the build depends on Qt, libopenal and libvorbisfile.
On Linux pkg-config is required.
Dustrac also exploits some features of the C++11 standard,
so a somewhat compliant compiler is required (GCC >= 4.7).
Building in the command line on Linux (tested on Ubuntu 16.04)
==============================================================
Development build (the game can be run without installing anything):
-------------------------------------------------------------------
1) Install Qt5 development files (qt5-default on Ubuntu).
2) Install OpenAL development files (libopenal-dev on Debian/Ubuntu).
3) Install Vorbis development files (libvorbis-dev on Debian/Ubuntu).
4) Install CMake (cmake on Debian/Ubuntu).
5) Go to the source directory and run:
$ mkdir build
$ cd build
$ cmake ..
This runs CMake that generates the makefiles.
You can also use Qt Creator to open the top-level CMakeLists.txt and build inside Qt Creator.
There's also a convenience configure script which is just a wrapper for cmake.
Anyway, if everything went ok with cmake, run:
$ make
This will build the editor and the game binaries.
Run the game:
$ ./dustrac-game
Optionally run the track editor:
$ ./dustrac-editor
Run unit tests:
$ ctest
Release build (in this example game installs under /usr):
--------------------------------------------------------
$ mkdir build
$ cd build
$ cmake .. -DReleaseBuild=1 -DCMAKE_INSTALL_PREFIX=/usr
This runs CMake that generates the makefiles.
If everything went ok, run:
$ make
This will build the editor and the game binaries.
Install the binaries and data files:
$ sudo make install
This installs also the desktop files so Dust Racing
should appear in your application menu.
Cross-compiling for Windows with MXE on Linux (tested on Ubuntu 14.04)
======================================================================
1) Install MXE (http://mxe.cc)
2) Install Qt5, Vorbis and OpenAL with MXE
3) Run <Your MXE installation dir>/usr/i686-pc-mingw32/qt5/bin/qmake dustrac.pro
4) make
There's also a script to build the game with a Windows installer:
1) export DUSTRAC_RELEASE_VERSION=x.y.z (use the latest version)
2) source ./scripts/mxeEnv.sh (assumes that MXE is installed in /opt/mxe)
3) ./scripts/mxeWindowsBuild.sh
The script checks that needed binaries are found.
CPack
=====
Dust Racing 2D has a support for CPack. It's not complete, but can be used to generate
some generic binary packages.
After a successful build run CPack:
$ cpack
This will generate .tar.gz and .sh binary packages on Linux.
Building with Microsoft Visual C++
==================================
The project has been successfully compiled and executed with MSVC with the following setup:
* Windows 8.1 Pro
* Windows SDK for Windows 8.1
* CMake 3.0
* Qt 5.3 32-bit SDK for MSVC
* MS Visual Studio 2013 for Desktop Windows
1) Download and build Vorbis libraries and OpenAL Soft with the same toolchain
2) Open the top-level CMakeLists.txt in Qt Creator, configure and build
3) Copy the runtime files, like OpenAL DLL, to the same directory with the game binary
For packagers
=============
The binaries only need to find the data dir that includes
all the runtime data. This can be set in the main CMakeLists.txt
and is given to the game via -DDATA_PATH.
The release build should be used when packaging (give
-DReleaseBuild=1 to cmake).
Currently the data files install to CMAKE_INSTALL_PREFIX/share/DustRacing
and the binaries install to CMAKE_INSTALL_PREFIX/bin.
CMAKE_INSTALL_PREFIX usually defaults to /usr/local and
can be changed by giving, for example, -DCMAKE_INSTALL_PREFIX=/usr
to cmake (or to the configure script).
There's an example Debian packaging in packaging/debian/.
-- Jussi Lind <jussi.lind@iki.fi>
|