Linux Coding Environment
This document describes the Linux coding environement, everything you will need to work on orxonox successfully and happily ever after.
You will want to use the standard GNU gcc compiler that is shipped with all Linux distributions. MacOSX normally uses the XCode environment, that can be found on all installation media or on Apple XCode. For more compiler and installation related stuff refer to the installation section?.
KDevelop Project Creation
- Start KDevelop and select Project→Import Existing Project.
Choose the repository directory as source directory.
As project type choose Generic C++ Application (Custom Makefiles).
This will auto generate the project files.
There are some settings that you will have to get right to enable KDevelop to compile your program correctly. The options and menu setting change often between different versions of kdeveloper. So don't be surprised, if it won't look exactly the same on your IDE. The settings listed in this tutorials are for the kDeveloper version 3.3.2 with KDE libs 3.5.2 (you can look them up in Help→abou KDevelop).
- C++ file endings:
Select: Project→Project Settings, go to section: C++ Specific, there look out for: Class Wizard Options→Implementation Suffix, change it from .cpp to .cc (since we call our files .cc and not .cpp)
- Project build options:
Select Project→Project Settings, go to section: Build Options, change to tab Make, there check the fields: Abord on first error and increase Number of simultaneous jobs to 2 or 3
- Project run options:
Select Project→Run Options, set the Main program to ./src/orxonox
Code Formatting Settings
- Source Code Formatting
- Choose Menu: Settings→Configure Editor (this is only selectable if you have already opened a c++ source file to view)
- Choose section Editing: Check the Insert spaces instead of tabulators, Remove trailing spaces box.
- Choose Indentation: Select C Style for Indentation Mode, make sure Use spaces instead of tabs to indent is checked (this is sometimes also found in another section, just go on) Number of spaces should be set to 2
- Choose Open/Save? Check: Mark the Replace tabs with spaces, and Remove trailing spaces boxes.
- More Source Code Formatting:
- Choose Menu: Settings→Configure KDevelop, Formatting: Select User defined and then change to tab Indentation, make sure that the following settings are set like this:
- Use spaces set to 2
- Indent switches checked
- Indent cases checked
- Indent namespaces checked
- Indent labels checked
- Now switch to tab Other
- Brackets are set to Break, all the other options are false (not checked)
Including the Orxonox Documentation
- Integrate the Orxonox Doxygen Documentation
- Documentation: Click on Doxygen Documentation Collection (in the lower middle) ⇒ Add: trunk/doc/html/index.html (this only works, if you have already generated the doxygen documentation with make doc in the orxonox trunk)
- Some more Source Building Settings
- Project->Project Options->CTags: Look at the Path section and look for the ctags application on your system: on the Gentoo system it is /usr/bin/exuberant-ctags.
- Enable the Built-in Version Control System (doesn't work on all systems)
- Choose Menu: Project->Project Options->Version Control: Choose your Version Control System (for Orxonox it's subversion). This might cause some instability in KDevelop, use at you own risk (nico?: Nov '07)
Eclipse Editor (3.2)
You can also work with Eclipse. I only tried this on Ubuntu yet and I'm not used to the whole system in linux with installing and stuff, but I'll try to explain it anyway.
Since Eclipse is a Java based editor you'll need a JDRE or something similar to work with Eclipse. Also to program C++ with Eclipse you'll need the package "eclipse-cdt". After installing eclipse run it for the first time…
Since you will mostly work on branches in Orxonox it's recommended to use ~/orxonox/branches or wherever you downloaded that piece of svn repository to.
If you'll work on the trunk as well, you will have to switch workspaces I guess, of course you can download every branch separately into the same directory you downloaded the trunk to. Best thing is to choose the parent directory of the trunk or your branch as workspace directory.
Now I assume you already downloaded the branch you want to work on with svn. Choose "New→Project" and "Standard C++ Project" in the popup. There you choose as the project name the name of your branch. Eclipse will create a directory for every new project, so by choosing the existing directory of the branch you don't have to worry that eclipse doesn't get where the files are.
Beside that, all the other preferences should be okay for our project, so click finish to create the project. If everything went well, you should have the whole directory tree of your Orxonox branch in Eclipse now.
On the right handed side you are able to create make targets to build your project. Don't forget to use ./autogen.sh and ./configure when you're dealing with a new checked out branch. Just make a target there to let eclipse build Orxonox. You may want to experiment with those make targets, but a normal make should be okay.
I'll add some more about Orxonox in Eclipse as I work with it.