Depending on the requirements on supported hardware as well as the host system, different dependencies need to be installed and a set of options are available to customize the installation. This chapter contains details on the standard installation process and information about custom build configurations.

Downloading the source code

The latest version of Peary can be downloaded from the CERN Gitlab repository.

The software repository can be cloned as follows:

  git clone https://gitlab.cern.ch/Caribou/peary.git
cd peary
  

Configuring the build via CMake

Peary uses the CMake Build System to configure, build and install the core framework as well as all device libraries. An out-of-source build is recommended: this means CMake should not be directly executed in the source folder. Instead, a build folder should be created, from which CMake should be run. For a standard build without any additional flags this implies executing:

  mkdir build
cd build
cmake ..
  

CMake can run with several extra arguments to change the type of installation. These options can be set with -Doption=VALUE (see the end of this section for an example). Currently the following options are supported:

  • CMAKE_INSTALL_PREFIX: The directory to use as a prefix for installing the binaries, libraries and data. Defaults to the source directory (where the folders bin/ and lib/ are added).
  • CMAKE_BUILD_TYPE: Type of build to install, defaults to RelWithDebInfo (compiles with optimizations and debug symbols). Other possible options are Debug (for compiling with no optimizations, but with debug symbols) and Release (for compiling with full optimizations and no debug symbols).
  • BUILD_DeviceName: If the specific device DeviceName should be compiled or not. Defaults to ON for most devices, apart for some devices with additional dependencies not systematically satisfied by other users. These devices are not built by default and need to be explicitly activated. The device name is derived from the directory of the device’s source code.
  • BUILD_ALL_DEVICES: Build all included devices, defaulting to OFF. This overwrites any selection using the parameters described above.
  • INTERFACE_interface: Individual hardware interfaces can be switched to emulation mode for development purposes. This avoids having to install the dependencies e.g. for I2C and SPI support on the development system. By default, all interfaces are switched ON.

An example of a custom debug build, without the H2M device and with installation to a custom directory is shown below:

  mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=../install/ \
      -DCMAKE_BUILD_TYPE=DEBUG \
      -DBUILD_H2M=OFF ..
  

Compiling and installing the application

The application can be compiled with a single command in the build folder created earlier (replacing <number_of_cores>} with the number of cores to use for compilation):

  make -j<number_of_cores>
  

The compiled (non-installed) executables can be found at src/exec/ in the \dir{build} folder. To install the library to the selected installation location (defaulting to the source directory of the repository) requires the following command:

  make install
  

The binaries will be available in the bin/ folder of the installation directory.