Getting Started

This section introduces the new Shark build system. It assists the user in compiling the library from source and setting up a basic working environment. Note that this tutorial focuses on Unix-like operating systems and requires a basic knowledge of the command line.

Obtaining the Library Sources

First, one needs to obtain either a release package of the Shark sources or a snapshot of the current development trunk.

The Build System

Starting with version 2.3.0, the Shark library relies on the CMake build system (http://www.cmake.org). CMake allows to configure the whole build process within a simple text file called CMakeLists.txt. This high-level description file is converted by CMake to IDE- and/or compiler-specific project files.

To compile the Shark library, a version of CMake >= 2.6.0 needs to installed on the build system (see http://cmake.org/cmake/resources/software.html).

Next, the usage of CMake to generate Makefiles suitable for Posix platforms is explained. For the remainder of this page, it is assumed that the Shark sources are situated in the directory ${SHARK_SRCS}

Compiling & Installing the Library

After having obtained the Shark library sources, open a terminal and change to the directory ${SHARK_SRCS}/cmake.
> cd ${SHARK_SRCS}/cmake
Next, invoke cmake in the current directory to generate a Makefile for compiling the library.
> cmake .
Note that cmake might warn about OpenMP not being found. This is not an issue although parts of Shark perform better if compiled with a compiler supporting OpenMP. Finally, the library is compiled by invoking make in the current directory.
> make
Optionally, you can distribute the build across multiple processors/cores by invoking make with the following command line options (n refers to the number of parallel processes).
> make -j n
After the compilation has finished, the library is placed in the directory ${SHARK_SRCS}/lib. It is installed by invoking make on the target install.
> make install
The Shark library is installed according to the following directory layout: To adjust the base installation directory ${CMAKE_INSTALL_PREFIX}, invoke ccmake in the directory ${SHARK_SRCS}/cmake.

> cd ${SHARK_SRCS}/cmake

> ccmake .

Alternatively, the install prefix can be specified on the command line by invoking cmake with the following command line option:
> cmake . -DCMAKE_INSTALL_PREFIX=/your/install/prefix

Compiling & Installing the Documentation

Compiling and installing the documentation is optional. Thus, the options need to be enabled by invoking ccmake in the directory ${SHARK_SRCS}/cmake.

> cd ${SHARK_SRCS}/cmake

> ccmake .

After having re-run cmake in the current directory, a new target "doc" is available in the generated Makefile. To finally compile the documentation, invoke "make doc" in the current directory.
> make doc
The documentation is installed by invoking "make install" in the current directory.
> make install
Note that doxygen and LaTeX are required to compile the documentation.

Compiling & Installing the Examples

Compiling and installing the examples is optional. Thus, the option needs to be enabled by invoking ccmake in the directory ${SHARK_SRCS}/cmake.

> cd ${SHARK_SRCS}/cmake

> ccmake .

The examples are built and installed by invoking make in the current directory.
> make && make install
Shark is accompanied by number of GUI examples that require Qt by Nokia (see http://qt.nokia.com) and a set of technical Qt add-ons named Qwt freely available from http://qwt.sourceforge.net. To compile the GUI examples, the option "ENABLE_QT_EXAMPLES" needs to be enabled. Qt of version >= 4.0.0 and a corresponding version of Qwt is required on the build machine.

Installing Shark on Microsoft Windows

For Windows users not familiar with CMake, we encourage using the installer of a pre-built version of the Shark library available from After having downloaded the appropriate installer, you just need to take the following steps to start developing with the Shark library:

Further Reading