Build STK on Linux

(Using Eclipse)
m (Installing dependencies)
 
(30 intermediate revisions not shown)
Line 1: Line 1:
-
Note that these instructions apply to STK versions more recent that 0.8 alpha. If you want to compile an older version, please use the history feature of the wiki.
+
Note that these instructions apply to STK versions more recent than 0.8 alpha. If you want to compile an older version, please use the history feature of the wiki.
<div class="outer_info">
<div class="outer_info">
Line 9: Line 9:
== Installing dependencies ==
== Installing dependencies ==
-
First of all, you will need a compiler and the autotools build system. When building the current SVN, you will also need cmake. Other dependencies you will need include openal, ogg, vorbis.
+
First of all, you will need a c++ compiler, the autotools build system and cmake. Other dependencies you will need include openal, ogg, vorbis. You don't need to install irrlicht, bullet, enet or wiiuse because they are included in the git repository.
* Fedora
* Fedora
-
<code>yum install gcc-c++ autoconf automake libogg-devel libvorbis-devel openal-soft-devel fribidi-devel subversion libcurl-devel cmake irrlicht-devel</code>
+
<code>yum install gcc-c++ autoconf automake git-core libogg-devel libvorbis-devel libXrandr-devel mesa-libGL-devel mesa-libGLU-devel openal-soft-devel fribidi-devel subversion libcurl-devel cmake libbluedevil-devel</code>
-
* Ubuntu
+
* Ubuntu/Debian
-
<code>sudo apt-get install autoconf automake build-essential cmake libogg-dev libvorbis-dev libopenal-dev libxxf86vm-dev libgl1-mesa-dev libglu1-mesa-dev libcurl4-openssl-dev libfribidi-dev</code>
+
<code>sudo apt-get install autoconf automake build-essential cmake git libogg-dev libvorbis-dev libopenal-dev libxxf86vm-dev libgl1-mesa-dev libglu1-mesa-dev libcurl4-openssl-dev libfribidi-dev libfreetype6-dev libbluetooth-dev subversion libxrandr-dev zlib1g-dev libpng12-dev libjpeg-turbo8-dev libsm-dev</code>
 +
== Obtain code and assets ==
 +
STK is splitted up into code and assets, so you need these two commands two get both:
 +
<code>git clone https://github.com/supertuxkart/stk-code.git stk-code # about 130 MB
 +
svn checkout https://svn.code.sf.net/p/supertuxkart/code/stk-assets stk-assets # about 650 MB</code>
 +
See [[Source control]] for more information.
-
== Building Irrlicht ==
+
The <TT>stk-code</TT> and the <TT>stk-assets</TT> directory need to be in the same folder. This means that you need the following folder structure:
-
 
+
* base dir
-
This part is required only for STK 0.8, no longer required with STK SVN.
+
** stk-code
-
 
+
*** src
-
From the STK root source directory, start by compiling irrlicht.
+
*** lib
-
<code>cd lib/irrlicht/source/Irrlicht/
+
*** ...
-
NDEBUG=1 make -j2
+
** stk-assets
-
cd -</code>
+
*** tracks
-
 
+
*** ...
-
(in this sample I configure make to use 2 cores. You can use more/less depending on your configuration).
+
-
Note that these steps should be repeated whenever we update irrlicht.
+
-
 
+
== Building SuperTuxKart ==
== Building SuperTuxKart ==
-
Then build SuperTuxKart using CMake
+
Next, build SuperTuxKart using CMake:
-
<code>mkdir cmake_build
+
<code>cd stk-code
 +
mkdir cmake_build
cd cmake_build
cd cmake_build
cmake ..
cmake ..
-
make VERBOSE=1 -j2
+
make -j2
</code>
</code>
-
(again in this sample I configure make to use 2 cores. You can use more/less depending on your configuration).
+
You can speed up compilation heavily by changing the number behind <tt>-j</tt> to the number of cores you have.
 +
=== CMake Options ===
 +
There is a varity ofCMake options. The most important ones are listed below:
 +
* To make a debug build add <tt>-DCMAKE_BUILD_TYPE=Debug</tt> like this: <code>cmake .. -DCMAKE_BUILD_TYPE=Debug</code>
-
To make a debug build add <tt>-DCMAKE_BUILD_TYPE=Debug</tt> like this:
+
* Another option is to build the regular release version with its optimizations, but with debugging symbols still enabled. Replace the <tt>Debug</tt> with <tt>RelWithDebInfo</tt> for that, ie: <code>cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo</code>
-
<code>cmake .. -DCMAKE_BUILD_TYPE=Debug</code>
+
* wiiuse can be enable with <code>-DUSE_WIIUSE=yes</code>
-
Another option is to build the regular release version with its optimizations, but with debugging symbols still enabled. Replace the <tt>Debug</tt> with <tt>RelWithDebInfo</tt> for that.
 
 +
Finally, you can simply run SuperTuxKart from the build directory:
 +
<code>./bin/supertuxkart</code>
-
And finally, to install (optional):
+
Optionally, STK can be installed /usr/local in using
-
<code>sudo make install</code>
+
<code>sudo make install</code>''
-
this will install in /usr/local. If you want to install somewhere else, replace the "cmake" command with something like:
+
If you want to install somewhere else, add the following options to cmake:
-
<code>cmake .. -DCMAKE_INSTALL_PREFIX=/opt/stk</code>
+
<code>-DCMAKE_INSTALL_PREFIX=/path/to/install</code>
 +
 
 +
If you want to update your copy of STK to the current git/SVN versions, go to the parent directory of stk-code:
 +
<code>cd stk-code
 +
git pull
 +
cd cmake_build
 +
make -j2
 +
cd ../../stk-assets
 +
svn update</code>
== Using Eclipse ==
== Using Eclipse ==
Line 63: Line 78:
In the trunk :
In the trunk :
     mkdir cmake_build
     mkdir cmake_build
 +
    cd cmake_build
     cmake -G "Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ..
     cmake -G "Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ..
Line 69: Line 85:
Now you can open Eclipse, Import -> Existing projects into workspace, browse to the trunk and import the build project.
Now you can open Eclipse, Import -> Existing projects into workspace, browse to the trunk and import the build project.
-
I recommend making a new project, with the trunk as directory, so that you can actually browse the source in the IDE and use the SVN plugins.
+
Though, I recommend making a new project with the trunk as directory so that you can actually browse the source in the IDE and use the source control (SVN/GIT) plugins.
Now right-click on this project -> New -> Convert to C++ Project (Possibly not needed if you made a C++ project in the previous step.)
Now right-click on this project -> New -> Convert to C++ Project (Possibly not needed if you made a C++ project in the previous step.)
Line 75: Line 91:
Right-click the project -> properties -> C/C++ Build
Right-click the project -> properties -> C/C++ Build
* Uncheck "Use default build command"
* Uncheck "Use default build command"
-
* Enter as build command "make VERBOSE=1 -j2" (replace 2 by the number of cores)
+
* Enter as build command "make -j2" (replace 2 by the number of cores)
 +
* Change the build directory to cmake_build
Now you can build the project by :
Now you can build the project by :

Latest revision as of 22:06, 18 March 2016

Note that these instructions apply to STK versions more recent than 0.8 alpha. If you want to compile an older version, please use the history feature of the wiki.

If you are a packager making a package for a Linux distribution, please do not try to modify our build system to use system versions of bullet and irrlicht. In both cases we use a specific and/or modified version of the library, and linking STK against the system library will only introduce bugs (corrupted graphics, memory leaks) into SuperTuxKart. Thanks


Contents

Installing dependencies

First of all, you will need a c++ compiler, the autotools build system and cmake. Other dependencies you will need include openal, ogg, vorbis. You don't need to install irrlicht, bullet, enet or wiiuse because they are included in the git repository.

yum install gcc-c++ autoconf automake git-core libogg-devel libvorbis-devel libXrandr-devel mesa-libGL-devel mesa-libGLU-devel openal-soft-devel fribidi-devel subversion libcurl-devel cmake libbluedevil-devel

sudo apt-get install autoconf automake build-essential cmake git libogg-dev libvorbis-dev libopenal-dev libxxf86vm-dev libgl1-mesa-dev libglu1-mesa-dev libcurl4-openssl-dev libfribidi-dev libfreetype6-dev libbluetooth-dev subversion libxrandr-dev zlib1g-dev libpng12-dev libjpeg-turbo8-dev libsm-dev

Obtain code and assets

STK is splitted up into code and assets, so you need these two commands two get both: git clone https://github.com/supertuxkart/stk-code.git stk-code # about 130 MB svn checkout https://svn.code.sf.net/p/supertuxkart/code/stk-assets stk-assets # about 650 MB See Source control for more information.

The stk-code and the stk-assets directory need to be in the same folder. This means that you need the following folder structure:

Building SuperTuxKart

Next, build SuperTuxKart using CMake:

cd stk-code mkdir cmake_build cd cmake_build cmake .. make -j2

You can speed up compilation heavily by changing the number behind -j to the number of cores you have.

CMake Options

There is a varity ofCMake options. The most important ones are listed below:


Finally, you can simply run SuperTuxKart from the build directory: ./bin/supertuxkart

Optionally, STK can be installed /usr/local in using

sudo make install

If you want to install somewhere else, add the following options to cmake:

-DCMAKE_INSTALL_PREFIX=/path/to/install

If you want to update your copy of STK to the current git/SVN versions, go to the parent directory of stk-code: cd stk-code git pull cd cmake_build make -j2 cd ../../stk-assets svn update

Using Eclipse

If you want to use the eclipse ide, use the following approach:

In the trunk :

   mkdir cmake_build
   cd cmake_build
   cmake -G "Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ..

This will generate project files based on the cmake files.

Now you can open Eclipse, Import -> Existing projects into workspace, browse to the trunk and import the build project.

Though, I recommend making a new project with the trunk as directory so that you can actually browse the source in the IDE and use the source control (SVN/GIT) plugins.

Now right-click on this project -> New -> Convert to C++ Project (Possibly not needed if you made a C++ project in the previous step.)

Right-click the project -> properties -> C/C++ Build

Now you can build the project by :

For easier code browsing an making use of Eclipse features :

C/C++ Build -> Discovery options

Apply

Right-click project -> index -> rebuild

Retrieved from "http://supertuxkart.sourceforge.net/Build_STK_on_Linux"

User Tools