KDevelop IDE configuration for use with Crystal Space
In this short tutorial I will guide you through some basic steps in order to create a Crystal Space application using the KDevelop IDE.
First of all, you need to have a compiled and working version of Crystal Space, see "Building and Installing Crystal Space".
Note: The screenshots embedded on this page are reduced versions. Click on them for the full resolution image.
Creating the application template
Now open KDevelop C/C++ IDE and click on Project -> New.
Now, as shown in the screenshot, choose C++ and Simple Hello world program.
In the properties area, enter your preferred application name and a location to store the source and additional files in. The path can be located anywhere you like and does not have to be in the Crystal Space source directory. Just make sure you have sufficient r/w permissions and drive space available.
Author, version control and copyright information
The next step of the wizard takes you to this screen:
Here you can enter your name, e-mail and the version and license type of your application.
In the next step you can optionally set up a version control system, which is useful for larger projects. I will not go into detail here, since this is not part of this tutorial:
The next two screens show the templates for the .h and .cpp source files, you may want to keep the copyright stuff in there:
The important part
Please note: If you did not install Crystal Space and the Crystal Space build directory is not in the system $PATH variable, you have to specify the location of the 'cs-config' file explicitly. This means that instead of just entering cs-config you have to state the location of the 'cs-config' in addition, for example the Crystal Space build directory. If you registered the $CRYSTAL-variable system-wide this can be done by substitution of every `cs-config` with `$CRYSTAL/cs-config`. If you did not, you really have to enter the path to the build directory of Crystal Space, e.g. `/mnt/g/CS/cs-config`. However, it is also possible, but not recommended to copy the cs-config file into the top directory of your new project.
Also note another thing that can be a source of errors: The character that encloses cs-config is an "opening single quote" ` (ASCII nr. 96) and not '! Ensure you do not forget these characters, otherwise you will get a compiler error message later.
Basically you can copy-paste (and if needed, edit) the following:
CPPFLAGS: -I `$CRYSTAL/cs-config --includedir`
LDFLAGS: `$CRYSTAL/cs-config --libs crystalspace`
And at the next tab (C tab):
And at the C++ tab:
In the 'run' options tab on the left hand side, you can enter some arguments to the program, e.g. '-mode=1280x1024 -fs'
Let your friends run
Before you can start, you have to insert the obligatory lines for Crystal-Space applications in your .cpp file:
#include <crystalspace.h> (in the screenshot: <cssysdef.h> because of older version of Crystal Space) and
That's a Simple One
For testing purposes, you can try out the 'simple1.cpp' and 'simple1.h' source files from the Crystal Space code tree. These files can be found within the Crystal Space source code tree at the following location: 'CS/apps/tutorial/simple1'
Now you should be able to compile your application and make some shiny game with Crystal Space!
That's all there is to it. If you have trouble, you are welcome to check out the Crystal Space IRC-Channel for help or drop me a note.
Written by Jan Hendriks (DaHoC, DaHoC3150@gmail.com)
Last updated 19.02.2007, Using KDevelop 3.3.6, Crystal Space 1.0