Marble/QtCreator

From KDE Community Wiki
Revision as of 19:06, 28 May 2011 by Earthwings (talk | contribs) (Created page with '[http://qt.nokia.com/products/developer-tools QtCreator] is a cross-platform C++ IDE. It is not only fast, but offers excellent development assistance including features like syn...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

QtCreator is a cross-platform C++ IDE. It is not only fast, but offers excellent development assistance including features like syntax highlighting, auto completion, git support, visual debugging and much more. The user interface is clean.

This page describes the setup of QtCreator for Marble development: Checkout from git, cmake configuration, environment setup, compilation, running.

Starting QtCreator

Please install QtCreator on your system. The screenshots on this page were generated using QtCreator 2.2. Other versions probably work as well, but the work flow may be a bit different.

Start QtCreator and choose "Create New Project" in the Welcome screen.

Getting the Source Code

We'll have QtCreator clone the git repository for us. Choose "Git Repository Clone" in "Project from Version Control" like this:

Press "Choose" to advance to the next page.

Set "git://anongit.kde.org/marble" as the Clone URL. Press the refresh icon to have QtCreator check the available branches. The branch master should be preselected. If not, select it in the "Branch" field.

Choose a "Checkout path" where you want the project to be created. Make sure there's enough space. After compiling and installing Marble, around 400 MB will be occupied. Press "Next" to have QtCreator clone the repository.

Cloning the git repository will take some time. Press "Finish" when it's done to start setting up cmake.

Building Marble

QtCreator's project wizard will now setup cmake to build and install Marble.

Choose a directory outside of the one chosen as the checkout directory. Press "Next".

The next wizard page takes parameters to pass to cmake for configuring the build. No parameters are strictly needed, but using a local directory is usually a good idea as it avoids messing up the system. Furthermore you don't need root/sudo rights for a local installation.

You can add other variables as well. In particular useful are

  • -DQTONLY=TRUE to build the non-KDE version of Marble
  • -DCMAKE_BUILD_TYPE=Debug to generate a build with debug information

Separate the parameters with spaces if you use more than one. Press "Run CMake" to let QtCreator execute cmake with the given parameters. One it finishes successfully, you can close the wizard by pressing "Finish".

QtCreator will do some background parsing. The project is nearly ready now, we just need to tweak the build settings a bit.

To be able to run Marble after compilation, files like map themes must lie at the correct places. The 'install' target of make takes care of that. It also takes care of compiling, so all we need to do is adding "install" as "Additional arguments" in the build options for our project. The screenshot also has a "-j4" argument to have make run four processes in parallel. This is suitable for a quadcore system. Choose "-j2" on a dual core etc. The "-j" argument is optional, you can leave it out.

Your Marble project is now ready to be compiled. We'll have a look at the run settings before we do that in the next step.

Running Marble

For a local build, the environment needs to be adjusted a bit to have your system find every files it needs. Add two variables to the build environment:

  • KDEDIRS=/path/to/your/marble/export/dir
  • LD_LIBRARY_PATH=/path/to/your/marble/export/dir/lib

Now press the Run button (green triangle icon on the bottom left) to have QtCreator compile and start Marble. This will take some minutes for the first run.