You are on page 1of 3

26/09/2016 compile[wiki]

How to compile the game from sources, on GNU/Linux.

Introduction
Compiling on Windows, is usually a nightmare. Yes, it is, and thus should be avoided.
For compiling on Windows, using VS2010 Express see this Wiki page.

Compiling Stunt Rally on Ubuntu using CMake is quite easy.


Recently (on 14.04) all dependencies can be just installed using apt-get.

This is the recommended way, even if you don't know any Ubuntu OS
[http://en.wikipedia.org/wiki/Ubuntu_%28operating_system%29] or GNU/Linux at all.

On other GNU/Linux distributions building probably isn't much trouble,


if you know how to build 1 or 2 dependencies from sources (if they aren't available).

Get sources
It is recommended that you get the latest version directly from the Git code repository.
Use software manager to install git or this command:

sudoaptgetinstallgit

Then, use these commands to get sources:

gitclonedepth=1git://github.com/stuntrally/stuntrally.gitstuntrally
cdstuntrally/data
gitclonedepth=1git://github.com/stuntrally/tracks.gittracks

This will get sources to a directory called stuntrally and inside it will download the tracks to a subdirectory data/tracks.
If you got sources some other way, be sure to have tracks/ inside data/.

Note: The parameter depth=1 tells git to not get history (to lower download time and space).
This way data is about: 300 MB and 500 MB for tracks.
With history it's quite big: 500 MB and 1,5 GB for tracks.
You can use other depth value to get some recent commits.
Or download an archive from github: here [https://github.com/stuntrally/stuntrally/tags] and tracks here
[https://github.com/stuntrally/tracks/tags].

If you want to use a (stable) release version, instead of the (latest) development version,
use the following command (replace 2.6 with the desired version number):

gitcheckout2.6

You can see the available versions with the following:

gittag

Dependencies

http://stuntrally.tuxfamily.org/wiki/doku.php?id=compile 1/3
26/09/2016 compile[wiki]

Here's a list of librariesDownloads


Library you will need.
page Sources
Newer versions should be used (except Ogre), listed here are only minimal versions needed (for VM with Ubuntu 12.04 LTS).

Library Downloads page Sources


OGRE 1.9 (or http://www.ogre3d.org/download https://bitbucket.org/sinbad/ogre
1.10) with plugins: [http://www.ogre3d.org/download] [https://bitbucket.org/sinbad/ogre]
OgrePaging,
OgreTerrain,
Plugin_ParticleFX
MyGUI 3.2 with http://mygui.info [http://mygui.info] http://github.com/MyGUI/mygui
Ogre support [http://github.com/MyGUI/mygui]

SDL2 http://libsdl.org/download-2.0.php [http://libsdl.org/download- http://libsdl.org/hg.php


2.0.php] [http://libsdl.org/hg.php]

OGG, VorbisFile http://xiph.org/downloads [http://xiph.org/downloads]


Boost (system, http://www.boost.org/users/download
thread, filesystem, [http://www.boost.org/users/download]
wave)
ENet http://enet.bespin.org/Downloads.html https://github.com/lsalzman/enet
[http://enet.bespin.org/Downloads.html] [https://github.com/lsalzman/enet]

Bullet Physics http://www.bulletphysics.org/Bullet/phpBB3/viewforum.php? https://github.com/bulletphysics/bullet3


2.81 f=18 [http://www.bulletphysics.org/Bullet/phpBB3/viewforum.php? [https://github.com/bulletphysics/bullet3]
f=18]

OpenAL Soft 1.13 http://kcat.strangesoft.net/openal.html https://github.com/kcat/openal-soft


[http://kcat.strangesoft.net/openal.html] [https://github.com/kcat/openal-soft]

Either install them from your distribution's package manager (including the -dev packages), or download and compile them
yourself.

In Ubuntu, those commands should get you all dependencies.

sudoaptgetupdate
sudoaptgetinstallassumeyesgitcmakeg++

#boost
sudoaptgetinstallassumeyeslibboostwavedevlibboostsystemdevlibboostfilesystemdevlibboostthreaddev

#graphics
sudoaptgetinstallassumeyeslibogre1.9devlibmyguidevlibsdl2dev

#sound
sudoaptgetinstallassumeyesliboggdevlibvorbisdevlibenetdevlibopenaldev

#bullet
sudoaptgetinstallassumeyeslibbulletdevlibbulletextrasdev

Note1: extras may be already inside libbullet, on older. Needed for BulletFileLoader and BulletWorldImporter.
Note2: libbullet and libopenal are present since ver 2.6 or master since late Aug 2015.

These are included in sources and compiled with project (no need to do anything):

BtOgre [http://www.ogre3d.org/forums/viewtopic.php?f=5&t=46856] #
OICS [http://sourceforge.net/projects/oics/] #
PagedGeometry [http://www.ogre3d.org/addonforums/viewforum.php?f=14] 1.1.1 #
shiny [https://github.com/scrawl/shiny/]
TinyXML [http://www.grinninglizard.com/tinyxml/index.html], TinyXML2 [https://github.com/leethomason/tinyxml2]

Marked modified sources with #.


http://stuntrally.tuxfamily.org/wiki/doku.php?id=compile 2/3
26/09/2016 compile[wiki]

Compiling
Project is written in C++. For compilation, we use CMake.
Use following commands (for Unix-like shell environments, such as Bash or MSYS):

cdstuntrally#Changedirectorytothegamesources
mkdirbuild#Createabuilddirectory
cdbuild#Changetothebuilddirectory

cmake..#Createbuildfiles
makej4#Compileusing4threads(changetoyournumberofCPUs)

#Optionallyinstalleverything(youcanrunwithoutinstalling)
makeinstall#mightneedadministratorprivileges

Troubleshooting
If you get errors on the cmake-step, you are most likely missing some library or CMake couldn't find it. Install the development
files for the library in question and if automatic finding fails, tell the paths to CMake manually. On Windows you should be able to
open up a graphical interface by double-clicking the CMakeCache.txt file in the build directory. Similar interface is also available on
other platforms, but the command-line alternative ccmake is also quite popular on GNU/Linux.

CMake has various generators [http://www.vtk.org/Wiki/CMake_Generator_Specific_Information] besides Makefiles for you to choose
from, including Visual Studio, Eclipse CDT and Code::Blocks project files.

Useful CMake variables

Here's some variables that come in handy frequently. You can set them on command line by: cmakeDVARIABLE_NAME=VALUE or
use one of the GUIs.

CMAKE_BUILD_TYPE - this determines release/debug builds, possible values are Release, Debug, MinSizeRel,
RelWithDebInfo, defaulting to the last one.
CMAKE_INSTALL_PREFIX - Specify the path where files are copied if makeinstall is invoked (on GNU/Linux,
usually /usr or /usr/local).
BUILD_EDITOR - Disable editor compilation by setting this to OFF.

For more information about CMake, see the documentation [http://www.cmake.org/cmake/help/documentation.html] and wiki
[http://www.vtk.org/Wiki/CMake].

Running
Once everything is compiled, you can run the game from the build directory (./stuntrally).
If you didn't use CMake, you'll probably have the exe in the source root, from where you can also run the game.
Same also applies to the editor, which is called sreditor.

More information available in the Running wiki page.

compile.txt Last modified: 2016/03/14 11:19 by cryham

http://stuntrally.tuxfamily.org/wiki/doku.php?id=compile 3/3

You might also like