KDevelop IDE configuration for use with Crystal Space
In this short tutorial I will guide you through some simple 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".
1. Creating the application template
Now open KDevelop C/C++ IDE and click on Project -> New. A wizard appears and you should see a screen similar to this: 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.
2. Author, version control and copyright information
3. The important part
Now you have created a new configuration profile and can set up the Crystal-Space specific settings as shown: 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): CFLAGS: `$CRYSTAL/cs-config --cflags` And at the C++ tab: CXXFLAGS: `$CRYSTAL/cs-config --cxxflags`
4. Runtime options
In the 'run' options tab on the left hand side, you can enter some arguments to the program, e.g. '-mode=1280x1024 -fs'
5. 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 CS_IMPLEMENT_APPLICATION. In addition you may need to modify the signature of the main function the following way:
6. 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'
7. Have fun!
You should now 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 can try the Crystal Space IRC-Channel or drop me a note.
8. Useless information
Written by Jan Hendriks (DaHoC, DaHoC3150@gmail.com) Last updated 19.02.2007, Using KDevelop 3.3.6, Crystal Space 1.0 Based on a tutorial made by Andreas Busch