Skip to content

Latest commit

 

History

History
89 lines (55 loc) · 2.4 KB

INSTALL.md

File metadata and controls

89 lines (55 loc) · 2.4 KB

How to build and use Sirius in a C++ cmake project

Table of Contents

How to build Sirius

Prequisites

Those are the minimal version that have been tested to work, but Sirius should also work with more recent versions of those tools.

  • gcc 6.3 or Visual Studio 15 2017
  • cmake 3.12
  • git 1.8

Clone, configure, build and install

First, clone the project:

git clone https://github.com/rte-france/sirius-solver.git -b master Sirius

Then you can configure it with cmake:

cd Sirius
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="SiriusInstall" -B build -S src

And finally build and install:

cmake --build build/ --config Release --target install

A directory named SiriusInstall will be created, containing the Sirius solver library to be used with cmake projects.

How to link Sirius library in a C++ cmake project

Locate your Sirius install directory

First, locate your Sirius install directory (generated with the above process, or downloaded from your nexus). It must contains the cmake, lib and include directories.

This directory will be refered to as sirius_solver_ROOT from now on.

Make cmake aware of where the Sirius library is located

There are two ways of doing so.

  • You can define an environnement variable named sirius_solver_ROOT pointing to your Sirius install directory.
  • Or you can define a sirius_solver_ROOT variable while calling cmake
cmake -Dsirius_solver_ROOT="/path/to/sirius_solver_ROOT" [the rest of your cmake configuration command] ...

Add Sirius to your cmake

Import with find_package

First, you need to activate the following cmake policy. It will allow cmake to find everything it needs to use the Sirius library from the sirius_solver_ROOT path.

if(POLICY CMP0074)
  cmake_policy(SET CMP0074 NEW)
endif()

You can then just import the sirius_solver package.

find_package(sirius_solver CONFIG REQUIRED)

Link with target_link_libraries

Then, you can link you target (binary, library, ...) with sirius_solver.

target_link_libraries(${EXECUTABLE_NAME} PUBLIC sirius_solver)

Use the Sirius solver API in your C++ code

Please refer to the Sirius solver API user guide.