Skip to content

How to compile on Ubuntu

Cyrus Cousins edited this page Jan 1, 2018 · 8 revisions

#Linux how-to compile - Ubuntu 14.04

First of all, we need some tools to build Open Dungeons. We will also need them to build CEGUI (version 0.8.4 is not available with Ubuntu as a library). sudo apt-get install g++
sudo apt-get install cmake
sudo apt-get install git

In this howto, we will not compile the needed libraries. We will install the packages available. If you prefer, you can build them yourself.

###OIS sudo apt-get install libois-dev

###OGRE sudo apt-get install libogre-1.9-dev

###libexpat (for cegui xml parser) sudo apt-get install libexpat-dev

###libfreetype sudo apt-get install libfreetype6-dev

###boost sudo apt-get install libboost-filesystem-dev libboost-locale-dev libboost-program-options-dev libboost-date-time-dev libboost-thread-dev libboost-system-dev

###CEGUI CEGUI 0.8.4 is not available in the ubuntu repositories. We need to download it and compile it : http://cegui.org.uk/download

First, download CEGUI dependencies and CEGUI sources. The current version is: 0.8.4 untar it in: /some/directory
cd /some/directory
tar xvzf /path/too/cegui-8.4.0.tar.gz
cd cegui-8.4.0
cmake .

Check that CEGUI_HAS_FREETYPE is set : grep CEGUI_HAS_FREETYPE CMakeCache.txt

In my case, it is not (like the other freetype files). So, let's set them manually.

For 64 bit systems with the x86_64 architecture:

cmake -DCEGUI_HAS_FREETYPE=ON -DFREETYPE_H_PATH_ft2build=/usr/include/freetype2/ -DFREETYPE_H_PATH_ftconfig=/usr/include/freetype2/ -DFREETYPE_LIB=/usr/lib/x86_64-linux-gnu/libfreetype.so .

Alternatively, for 32 bit systems on the i386 architecture:

cmake -DCEGUI_HAS_FREETYPE=ON -DFREETYPE_H_PATH_ft2build=/usr/include/freetype2/ -DFREETYPE_H_PATH_ftconfig=/usr/include/freetype2/ -DFREETYPE_LIB=/usr/lib/i386-linux-gnu/libfreetype.so .

make
sudo make install

If you want CMake to find CEGUI, you need to set CEGUIDIR to the path where you installed CEGUI. In my case: export CEGUIDIR=/usr/local/cegui-8.4.0

###SFML sudo apt-get install libsfml-dev

###OpenAl sudo apt-get install libopenal-dev

###And OpenDungeons itself! Now, we have all the needed libraries.

cd /where/you/want/to/build

Let's get the sources (including game-data):
git clone -b development https://github.com/OpenDungeons/OpenDungeons.git src-od

cd src-od

If you had set CEGUIDIR, CMake should find what it needs alone:
cmake -DCMAKE_CXX_FLAGS=-std=gnu++11 .

If you didn't set CEGUIDIR, you can force CMake parameters:
cmake -DCEGUI_LIBRARY_REL=/usr/local/cegui-0.8.4/lib/libCEGUIBase-0.so -DCEGUI_OGRE_LIBRARY_REL=/usr/local/cegui-0.8.4/lib/libCEGUIOgreRenderer-0.so -DCEGUI_INCLUDE_DIR=/usr/local/cegui-0.8.4/cegui/include/ -DCMAKE_CXX_FLAGS=-std=gnu++11 .

Now, let's compile the game:
make

We need to set the path to OpenGl renderer (RenderSystem_GL.so). In my case, it is: /usr/lib/i386-linux-gnu/OGRE-1.9.0
Edit plugins.cfg and plugins_d.cfg.
Line 4 => PluginFolder=/usr/lib/i386-linux-gnu/OGRE-1.9.0

That's it, you can play by typing from the source root directory:
./opendungeons

Enjoy :-D