====== Installation from source code ======
In case a package for your system is not available or the standard package installation does not work, Focus can be installed using the source code. The compilation of Focus has some additional dependencies compared with the precompiled binary packages. Focus depends on Qt5 and FFTW to compile and additionally requires cmake and GNU compilers like ''g+ +'' and ''gfortran''.
===== Getting the source code =====
The latest source for Focus is available at our [[https://github.com/C-CINA/focus/archive/master.zip|GITHUB]] repository. Source code for [[https://github.com/C-CINA/focus/releases|previous releases]] is also available. Once downloaded the software can be extracted using ''unzip''.
Alternatively the GIT repository can also be cloned (For this, installation of ''git'' is required):
''git clone https://github.com/LBEM-CH/focus.git''
===== Installing Dependencies =====
The dependencies for Focus are open source and free. They can be installed using standard package managers on various platforms. We recommend the following package managers for following operations systems:
* MacOS: ''brew'' (https://brew.sh)
* Ubuntu: ''apt-get''
* Fedora/CentOS/RedHat: ''yum''
==== cmake ====
As we use cmake as build system you should have installed it on your machine. We advise to install this and most of the other dependencies by means of your native package manager.
On OSX, for example, you could use "brew install cmake".
Alternatively, you can get cmake under the following link: http://www.cmake.org.
**NOTE:** Qt versions >= 5.7 (see below) will require a CMake version >= 3.1.0.
==== gfortran (incl. bindings) ====
Some programs of the kernel are written in fortran. Thus compiling Focus requires a fortran compiler. Note that we only support the GNU fortran compiler ''gfortran''. Dependent on your package source you might have to install some platform dependent binding libraries between fortran and c++. But on Fedora you have to install these additional packages: ''gcc-gfortran'' and ''libgfortran''.
On OSX, you can install this via "brew install gcc".
Please make sure to use gfortran **version 5.x** or later.
==== g++ (incl. bindings) ====
The GUI is written in c++ with c++11 standards and thus requires a corresponding compiler. Again on some RedHat-like Linux distributions you need to install some bindings. On Fedora Focus relies on the ''gcc-c++'' package.
For **MacOS**, one would probably need to install packages like gcc using homebrew or macports.
This could be done with "brew install gcc ; brew link gcc".
If done so, the following should be added to path:
''/usr/local/bin:/opt/bin:/opt/local/bin:/usr/bin/:/usr/sbin''
Make sure that the gcc/g++ from the clang is not used to build otherwise it will fail.
On OSX, you might have to do "cd /usr/local/bin ; \ln -s g++-9 g++ ; \ln -s gcc-9 gcc" .
Or, depending on the g++ and gcc versions that you have installed, you might need to do "cd /usr/local/bin ; \ln -s g++-8 g++ ; \ln -s gcc-8 gcc".
==== libfftw3 ====
Focus requires fftw version 3.0.0 or later. The package is called ''libfftw3-dev'' on Ubuntu, but on Fedora you have to install ''fftw-devel'' and ''fftw-libs''. You can install this famous library via the package manager or directly from http://www.fftw.org. In such a case use the following commands to compile FFTW: