Difference between revisions of "Getting Started/Build/KDE Applications"

Jump to: navigation, search
(Steps)
m (Use syntaxhighlight.)
Line 15: Line 15:
 
First we will download the code
 
First we will download the code
  
git clone git://anongit.kde.org/blinken
+
<syntaxhighlight lang="bash">
 +
git clone git://anongit.kde.org/blinken
 +
</syntaxhighlight>
  
 
This will create a directory with blinken's source code inside. We get in and we create a directory where it's going to be built
 
This will create a directory with blinken's source code inside. We get in and we create a directory where it's going to be built
  
cd blinken; mkdir build; cd build
+
<syntaxhighlight lang="bash">
 +
cd blinken; mkdir build; cd build
 +
</syntaxhighlight>
  
 
Now we'll set up the development system by calling cmake. We're passing two parameters here CMAKE_INSTALL_PREFIX that will tell where the application will be installed and CMAKE_BUILD_TYPE that will tell the optimization of the produced binaries. (not entirely accurate, but there's heaps of documentation about that).
 
Now we'll set up the development system by calling cmake. We're passing two parameters here CMAKE_INSTALL_PREFIX that will tell where the application will be installed and CMAKE_BUILD_TYPE that will tell the optimization of the produced binaries. (not entirely accurate, but there's heaps of documentation about that).
  
cmake .. -DCMAKE_INSTALL_PREFIX=<install_path> -DCMAKE_BUILD_TYPE=debugfull
+
<syntaxhighlight lang="bash">
 +
cmake .. -DCMAKE_INSTALL_PREFIX=<install_path> -DCMAKE_BUILD_TYPE=debugfull
 +
</syntaxhighlight>
  
 
The moment we were all expecting has arrived, now you can start compiling.
 
The moment we were all expecting has arrived, now you can start compiling.
  
make
+
<syntaxhighlight lang="bash">
 +
make
 +
</syntaxhighlight>
  
 
Some applications can work without installing but that's usually not the case so just do it if you know what you're doing, otherwise you will want to install probably.
 
Some applications can work without installing but that's usually not the case so just do it if you know what you're doing, otherwise you will want to install probably.
  
make install
+
<syntaxhighlight lang="bash">
 +
make install
 +
</syntaxhighlight>
  
 
If you're installing it to a directory where the owner is root, then you'll probably need some extended privileges to install. That's not the only option, though. You can create a specific install directory by pointing the PATH and KDEDIRS variables to it, more information here: [[Getting_Started/Build/Environment]]
 
If you're installing it to a directory where the owner is root, then you'll probably need some extended privileges to install. That's not the only option, though. You can create a specific install directory by pointing the PATH and KDEDIRS variables to it, more information here: [[Getting_Started/Build/Environment]]

Revision as of 00:25, 9 November 2011

Introduction

The process to build applications is easy. It can get tedious in the beginning but with time it's easy to understand.

In this page I'll discuss the compilation and installation of a simple KDE application or project on a regular GNU/Linux system. It can get more complicated but I'd prefer to keep this document simple.

Preparing your system a little

First of all you probably will need to know the dependencies to compile the program you want to compile. In my experience, a great portion of the problems that people have forgot to install the development packages for the system libraries. Keep that in mind.

In general, the needed packages will be: cmake, git-core, libqt4(-dev), kdelibs(-dev). Depends on the distribution but the naming should be something like this.

Steps

Here we will try to compile an application, let's say blinken. You can find a full compendium of the KDE projects in http://projects.kde.org

First we will download the code

git clone git://anongit.kde.org/blinken

This will create a directory with blinken's source code inside. We get in and we create a directory where it's going to be built

cd blinken; mkdir build; cd build

Now we'll set up the development system by calling cmake. We're passing two parameters here CMAKE_INSTALL_PREFIX that will tell where the application will be installed and CMAKE_BUILD_TYPE that will tell the optimization of the produced binaries. (not entirely accurate, but there's heaps of documentation about that).

cmake .. -DCMAKE_INSTALL_PREFIX=<install_path> -DCMAKE_BUILD_TYPE=debugfull

The moment we were all expecting has arrived, now you can start compiling.

make

Some applications can work without installing but that's usually not the case so just do it if you know what you're doing, otherwise you will want to install probably.

make install

If you're installing it to a directory where the owner is root, then you'll probably need some extended privileges to install. That's not the only option, though. You can create a specific install directory by pointing the PATH and KDEDIRS variables to it, more information here: Getting_Started/Build/Environment


KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal