# Build dependencies 

The following software has to be installed (if not optional).

- Linux OS

- CMake 2.8.12+

- CXX compiler which supports multi threading (GCC 4.7+)

- ATLAS 3.8.3+

  Web Site: http://math-atlas.sourceforge.net/ <br>
  Download: https://sourceforge.net/projects/math-atlas/files/Stable/ <br>
  Ubuntu:   libatlas-dev

- Boost 1.33+

  Web Site: http://www.boost.org/ <br>
  Download: http://www.boost.org/users/download/ <br>
  Ubuntu:   libboost-dev 

- boost-numeric-bindings 20081116+ (already provided in the <code><b>ATLAS/</b></code> directory - see <code><b>ATLAS/boost-numeric-bindings/LICENSE_1_0.txt</b></code> for details)

  Web Site: http://mathema.tician.de/software/boost-numeric-bindings <br>
  Download: http://mathema.tician.de/dl/software/boost-numeric-bindings 

  In particular, the ATLAS bindings are used by this software.

- nifticlib 1.1+

  Web Site: http://niftilib.sourceforge.net/ <br>
  Download: http://sourceforge.net/projects/niftilib/files/nifticlib/ <br>
  Ubuntu:   libnifti1-dev or nifticlib

 
An example installation chain (for Ubuntu 14.04) is given below:

\verbatim
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install g++-4.9 cmake # check version using "gcc --version", if mismatch then change the symbolic link /usr/bin/g++ to a target of /usr/bin/g++-4.9
sudo apt-get install libblas-dev libatlas-dev libatlas-base-dev libatlas3-base liblapacke-dev libboost-all-dev libnifti-dev libnifti2 
sudo apt-get install doxygen
\endverbatim


Note for Fedora-based distributions:

The Atlas library has started building a single "master" .so file for Fedora (reference - https://www.centos.org/forums/viewtopic.php?f=47&t=48723). 
To mitigate the FindLapack issue with CMake, create soft links for <code>libatlas.so</code>, <code>libcblas.so</code> and <code>libf77blas.so</code> with <code>/usr/lib64/atlas/libsatlas.so</code>
under <code>/usr/lib64/</code> or to a directory where you have write access and append it to <code>CMAKE_LIBRARY_PATH</code>.


# Build ODVBA

The common steps to build, test, and install software based on CMake,
including this software, are as follows:

1. Extract source files.
2. Create build directory change to it.
3. Run CMake to configure the build tree.
4. Build the software using selected build tool.
5. Run the unit tests (optional but recommended).
6. Install the built files (optional).

On Unix-like systems with GNU Make as build tool, these build steps can be
summarized by the following sequence of commands executed in a shell,
where <code>$package</code> and <code>$version</code> are shell variables which represent the name
of this package and the obtained version of the software.

\verbatim
tar xzf $package-$version-source.tar.gz
mkdir $package-$version-build; cd $package-$version-build
cmake -DCMAKE_INSTALL_PREFIX:PATH=$install_path ../
make
make test    #optional but recommended
make install #optional
\endverbatim

Please refer to this guide first if you are uncertain about above steps or
have problems to build, test, or install the software on your system.
If this guide does not help you resolve the issue, please contact us at
<a href="mailto:sbia-software@uphs.upenn.edu">sbia-software at uphs.upenn.edu</a>. 

In case of configuration errors, please attach the following file: <code><b>$build_directory/CMakeCache.txt</b></code>.

In case of compilation errors, please attach the output of the following command in addition to the previous file:

\verbatim
make >& make.log
\endverbatim

In case of failing tests, please attach the output of the following command to your email along of the previous two files:

\verbatim
ctest -V >& test.log
\endverbatim

In the following, only package-specific CMake settings available to
configure the build and installation of this software are documented.


# CMake Configuration Variables

\verbatim
ATLAS_CBLAS_INCLUDE_DIR   CBlas header location
ATLAS_CLAPACK_INCLUDE_DIR Lapack header location
CBLAS_LIB                 CBlas install location
ITK_DIR                   ITK install location
CMAKE_INSTALL_PREFIX      Directory to do the installation
NiftiCLib_DIR             Installation directory of the nifticlib library, e.g., /usr/local.
                          
Advanced CMake Options:

BLAS_atlas_LIBRARY        Path of the ATLAS library.
BLAS_cblas_LIBRARY        Path of the C BLAS library.
BLAS_f77blas_LIBRARY      Path of the Fortran BLAS library.
Boost_INCLUDE_DIR         Include directory of the Boost library, e.g., /usr/include.
Boost_LIBRARY_DIRS        Directory where the Boost libraries are installed, e.g., /usr/lib.
\endverbatim
