The installation of this package is based on CMake.

If you checked out the sources directly from the repository, make sure
that you also obtained and installed SIMPUT before installing SIXTE.

### Configure

Before running the compilation, the project first needs to be configured
and a build directory created. For this purpose, run a terminal in the
main directory of the package (the location of the file you are currently
reading) and run

 cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/path/to/simputdir

where /path/to/simputdir is the path where you have installed SIMPUT we
will call this path the ${prefix} from now on.

Alternatively, you may install SIXTE into its own directory. To do this,
you have to specify the path of the simput installation to a separate
variable called

 -DSIMPUT_ROOT=...

You may also need to specify the location of the installation of some
other libraries if CMake does not find them, namely

 -DGSL_ROOT_DIR=...
 -DBOOST_ROOT=...
 -DCGAL_ROOT=...
 -DGMP_INCLUDE_DIR=... -DGCMP_LIBRARIES_DIR=...
 -DMPFR_INCLUDE_DIR=... -DMPFR_LIBRARIES_DIR=...

### Compilation

Once this has been completed, a "build" directory should have been
created in your current working directory. When this has been done,
you can compile and link the code via

 cmake --build build

This may take some time. If you have multiple cores available, you
may set the additional option

 --parallel n

Where n is the number of maximum concurrent processes used for
compilation.

For debugging, you can also set the

 --verbose

flag, which prints all output of gcc, g++ etc. In this case, you should
disable parallel computation.

### Installation

After compilation finished, you can then install the files with the command

cmake --install build

### Initialization

The simulation package uses several FITS template files to create FITS
files. These templates are stored in ${prefix}/share/sixte/templates
during the installation. The instrument XML definition files are
maintained in the directory ${prefix}/share/sixte/instruments.
For parameter input the simulation software uses the PIL / APE library
and therefore requires a .par file for each simulation task. These
files are installed in the directory ${prefix}/share/sixte/pfiles. 

In order to run the simulation, you have to set an
environment variable called $SIXTE pointing to the ${prefix} directory
and then call the setup script 'install-sixte.sh' or 'install-sixte.csh'
depending on which shell you use.

In a C-shell environment you can do this with the following command:

setenv SIXTE $prefix
source $SIXTE/bin/sixte-install.csh

In a Bash environment the corresponding command is:

export SIXTE=$prefix
$SIXTE/bin/sixte-install.sh
