Skip to main content
Version: v2.0.1

Application Programming Interface Usage

DuneCopasi is a C++ program, its main objects may be consumed by another program in order to generate custom simulation rules, to couple intermediate steps with other tools, or to implement a GUI, etc. In such a case, DuneCopasi must be available in development mode and the downstream library is expected to consume the library by using the CMake build system and use the C++ objects in code.

Importing CMake targets

To use the API for development, you must find and consume the CMake targets from DuneCopasi in your project as follows:

CMakeLists.txt
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
project(my-app CXX)
# ...
find_package(dune-copasi IMPORTED REQUIRED)
target_link_libraries(my_app PRIVATE Dune::Copasi)
# ...
Custom installed directory

If DuneCopasi was installed on a custom directory (e.g. using CMAKE_INSTALL_PREFIX=/opt/dune) when installed from source, it is likely that you need to pass such directory to the CMAKE_PREFIX_PATH when building the CMake project. This way, CMake can find the CMake configuration file and its targets:

cmake -DCMAKE_PREFIX_PATH:PATH=/opt/dune /path/to/app/source/