Last modified 20 months ago Last modified on 03/25/16 14:50:03

Downloading and Building GAMMA

This document tells you how to download GAMMA's source code build it on Linux, Windows, and OS X.

Please note that we have a separate page that describes how to build PyGamma. This page is for GAMMA only.

Download the Code

GAMMA's source code is stored in a Subversion (SVN) repository. If you do not have an SVN client, you will need to get one. TortoiseSVN is popular under Windows.

Once you have an SVN client, open a command prompt, go to your development directory and enter the following command --

svn co gamma

Install a C++ Compiler

To build the libraries, you need a C++ compiler.

On Windows, the code works with Visual Studio Express edition 2008. Note that Visual Studio Express Edition 2008 cannot build 64-bit binaries.

Under Linux use GCC. We've successfully built GAMMA using GCC 4.x. GCC 5.x might work too.

Under OS X, use Clang or GCC.

You might want to consider installing an optimized linear algebra library before building, although this is not essential and complicates the build a little.

Install Python (Optionally, for Testing)

The tests use Python as well as the Python libraries numpy and SciPy. Many *nix systems have Python installed already.

Building GAMMA on Linux and OSX

Building is fairly straightforward. Start a command prompt and move to gamma/platforms/Linux or gamma/platforms/OSX.

The following commands are valid --

  • make all - This is the default target. It builds the shared and static libraries.
  • make so - Builds the shared library.
  • make lib - Builds the static library.
  • make install - Installs the shared and static libraries to /usr/local/lib, the GAMMA build utility to /usr/local/bin, and the header files to /usr/local/include.
  • make test - Runs the tests (requires Python).
  • make pysg - Builds PYGAMMA.
  • make pysgdist - Builds PYGAMMA for distribution.

For the adventurous, we also have a document on statically linking GAMMA to BLAS.

Installing and Using the gamma Command Line Utility

To install the GAMMA header files and the gamma build script on your system, use this command --

sudo make install

You can verify that it's installed properly by requesting the GAMMA version --

gamma -v

Building Your Own Code that Uses GAMMA

Once you've run make install, you can compile your own code that uses GAMMA by including gamma.h in your code --

#include "gamma.h"

and running the gamma build command --

gamma -o output_file

Note that the gamma build utility is a BASH script and needs to be run under that shell.

Building GAMMA on Windows

The GAMMA source provides two MSVC projects in the gamma/platforms/msvc2008e directory. The project for building the static library and tests is static/gamma.sln and dynamic/gamma.sln will build the dynamic library and PyGAMMA.

In Windows Explorer, double click on the .sln file that contains the project you want to build. Hit F7 to build the whole project, or open the Solution Explorer (via the View/Solution Explorer menu item) if you only want to build individual items.

The static build creates the file gamma/i686-pc-msvc/gamma.lib. The dynamic build also puts its output in gamma/i686-pc-msvc.

Building Your Own Visual Studio Project that Uses GAMMA

To set up an MSVC project to build with the GAMMA libraries, make the following changes to your MSVC project under the "Configuration Properties" --

  • C/C++/General: set Additional Include Directories to ..\..\src
  • C/C++/Code Generation: set Runtime Library to Multi-Threaded (/MT) for use with the static library.
  • Linker/General: set Additional Library Directories to ..\..\i686-pc-msvc
  • Linker/Input: set Additional Dependencies to gamma.lib
  • Linker/General: set Output File to ..\..\i686-pc-msvc\your_output_file.exe

Note these settings will need to be set for "All Configurations" or for Release and Debug independently.

A sample project that links to the static library is located in the gamma/msvc2008e/fid_test.