# Building from Source

Info: This outlines the necessary steps for compiling Takin from source. If you've already downloaded a binary package of Takin for your system, you can skip this section.

## Preparations before compilation

Install (developer versions of) all required libraries either from your system's package manager or directly from the given links: Boost, Qt 4 or 5, Qwt 6, Minuit 2, Clipper,

For example, on *buntu systems, use the following commands:

`

    sudo su
    apt-get install cmake clang build-essential libboost-all-dev libclipper-dev libqt4-dev qt4-dev-tools libqwt-dev python-dev libfreetype6-dev wget
    wget http://www.cern.ch/mathlibs/sw/5_34_14/Minuit2/Minuit2-5.34.14.tar.gz
    tar -xzvf Minuit2-5.34.14.tar.gz
    cd Minuit2-5.34.14
    ./configure --disable-openmp
    make && make install
    exit

`

Set up other external dependencies:

`

    cd <takin source dir>
    ./setup_externals.sh

`

## Building Takin using CMake

Takin has to be compiled with a fully C++11 compliant compiler, e.g. GCC version 4.8 or above or Clang.

Make using CMake:

`

    mkdir build
    cd build
    cmake ..
    make
    optional: make install (as root)

`

Run Takin with `takin` (if installed) or `./takin` (for local version). In case tlibs is not found, use: `LD_LIBRARY_PATH=/usr/local/lib takin`.

## Alternatively building Takin directly

- Open "themakefile" in your favourite editor.
- Adapt the flags in the first few lines according to your system.
- Build Takin using "./build.sh".
- Run "./gentab" to create required tables.
- Run Takin with "./takin".