# Building OVITO on Linux

Note that the following instructions have been written for Ubuntu Linux 14.04 or later, or any compatible Debian-based distribution. Other Linux distributions may require slightly modified steps.

## Installing dependencies

First install the required build tools and third-party libraries:

Distribution | Command
--- | ---
Ubuntu |
    sudo apt-get install build-essential git cmake-curses-gui qt5-default libboost-dev libqt5scintilla2-dev \
                         libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavresample-dev \
                         libavutil-dev libswscale-dev libnetcdf-dev libhdf5-dev libhdf5-serial-dev \
                         libbotan1.10-dev libmuparser-dev libqwt-qt5-dev python3-dev \
                         python3-sphinx python3-numpy python3-matplotlib python3-pyqt5 \
                         libfftw3-dev xsltproc docbook-xml
openSUSE |
    sudo zypper install git docbook_5 libxslt-tools cmake gcc-c++ \
                         libQt5Concurrent-devel libQt5Core-devel libQt5Gui-devel libQt5Network-devel libQt5DBus-devel \
                         libQt5OpenGL-devel libQt5PrintSupport-devel libQt5Widgets-devel libQt5Xml-devel \
                         libavutil-devel libavresample-devel libavfilter-devel libavcodec-devel libavdevice-devel \
                         netcdf-devel libbotan-devel muparser-devel python3-devel python3-numpy python3-matplotlib \
                         python3-Sphinx python3-qt5 boost-devel hdf5-devel libswscale-devel libqscintilla-qt5-devel \
                         fftw3-devel
centOS |
    sudo yum install epel-release
    sudo yum install git gcc gcc-c++ cmake qt5-qtbase-devel qt5-qtsvg-devel qt5-qttools-devel \
                              muParser-devel boost-devel netcdf-devel hdf5-devel botan-devel
These packages allow building only a basic version of OVITO without Python scripting and video encoding support and documentation. In order to build a more complete version, other dependencies must be installed manually.

## Getting the source code

Then download OVITO's source code into a new subdirectory named `ovito/`:

    git clone https://gitlab.com/stuko/ovito.git ovito

## Compiling OVITO

Within that directory, create a build directory and let CMake generate the Makefile:

    cd ovito
    mkdir build
    cd build
    cmake -DOVITO_BUILD_DOCUMENTATION=ON \
          -DCMAKE_BUILD_TYPE=Release \
          -DPYTHON_EXECUTABLE=/usr/bin/python3 \
          -DPYTHON_INCLUDE_DIR=/usr/include/python3.5m \
          -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.5m.so \
          ..

If this step fails, or if you want to disable certain components of OVITO, you can now run "`ccmake .`" to open the CMake configuration program. Changing the `PYTHON_INCLUDE_DIR` and `PYTHON_LIBRARY` settings may be needed to build OVITO against a different Python version.

Finally, compile OVITO:

    make -j4

After a successful build, the executable can be found in the `ovito/build/bin` directory.