Installation
------------
Prerequisites
`````````````
These software packages should be installed in the order presented before you
attempt to build Ratpac.
* `Python 3+ with development headers `_ -
* `ROOT 6.25+ `_
* `Geant-4 11.0+ `_
* `CMake 3.22+ `_
Build Steps
```````````
A helper package exists at `ratpac-setup
`_ to help with the installation of
Ratpac and its dependencies. This package is recommended for general installation
and will install a local version of ROOT and Geant4.
Containers
``````````
Building Containers
'''''''''''''''''''
ratpac can be built in a container using the provided dockerfiles found in both
ratpac-two itself and ratpac-setup. The Dockerfile provided by ratpac-setup
creates a container with a all of ratpac-two's dependencies installed, while the
Dockerfile in ratpac-two creates a container with ratpac-two itself installed.
The container is based on the `ubuntu 22.04 image
`_ and includes all of the dependencies
required to build ratpac. the container can be built using the following
command:
.. code-block:: bash
cd ratpac-setup
docker build -f Dockerfile -t ratpac/ratpac-two:latest-base .
cd ../ratpac-two
docker build -f containers/Dockerfile -t ratpac/ratpac-two:latest .
The first command will build the base image which only includes the dependencies
but not the Ratpac source code. The second command will build the Ratpac image
which includes the Ratpac source code and uses ratpac/ratpac-two:latest-base.
A Singularity (Apptainer) image can be built from the Docker image using the
following command:
.. code-block:: bash
singularity build ratpac-two.sif docker-daemon://ratpac/ratpac-two:latest
Or if you are planning to develop Ratpac, you can build the image only from the
base docker image and then compile Ratpac inside the container.
.. code-block:: bash
singularity build ratpac-two.sif docker-daemon://ratpac/ratpac-two:latest-base
Pulling containers from Github CI
'''''''''''''''''''''''''''''''''
The ratpac-two repository also creates nightly builds of the latest commit to the
repository.
.. code-block:: bash
# Base container:
apptainer build ratpac-two-base.sif docker://ratpac/ratpac-two:latest-base
# Full container:
apptainer build ratpac-two.sif docker://ratpac/ratpac-two:main
Build from source
`````````````````
Using the convenience Makefile
''''''''''''''''''''''''''''''
A convenience Makefile exists to automate the above process, simply type `make`. Several targets are available:
- ``make`` or ``make all``: Builds in installs ratpac-two to ``install/`` directory. Default to the ``RelWithDebInfo`` build type.
- ``make debug/release/Minsize/relwithdebinfo``: Builds and installs ratpac-two with the specified build type.
- ``make clean``: Removes the ``build/`` and ``install/`` directories.
Custom Configuration with CMake
'''''''''''''''''''''''''''''''
Ratpac-two follows standard CMake conventions. The following is a step-by-step list CMake commands to compile:
.. code-block:: bash
mkdir build install
cd build
cmake .. -DCMAKEINSTALL_PREFIX=../install # Add any additional configuration flags here
make # use -jN to parallelize with N threads
make install