Development Guide#


In order to start developing, clone the DDSIM repository using

$ git clone --recurse-submodules

Note the --recurse-submodules flag. It is required to also clone all the required submodules. If you happen to forget passing the flag on your initial clone, you can initialize all the submodules by executing git submodule update --init --recursive in the main project directory.

A C++ compiler supporting C++17 and a minimum CMake version of 3.19 are required to build the project.

Working on the core C++ library#

Our projects use CMake as the main build configuration tool. Building a project using CMake is a two-stage process. First, CMake needs to be configured by calling

$ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release

This tells CMake to search the current directory . (passed via -S for source) for a CMakeLists.txt file and process it into a directory build (passed via -B). The flag -DCMAKE_BUILD_TYPE=Release tells CMake to configure a Release build (as opposed to, e.g., a Debug build).

After configuring with CMake, the project can be built by calling

$ cmake --build build --config Release

This tries to build the project in the build directory (passed via --build). Some operating systems and developer environments explicitly require a configuration to be set, which is why the --config flag is also passed to the build command. The flag --parallel <NUMBER_OF_THREADS> may be added to trigger a parallel build.

Building the project this way generates

  • the main library libddsim.a (Unix) / ddsim.lib (Windows) in the build/src directory

  • a test executable ddsim_test containing unit tests in the build/test directory (this requires passing -DBUILD_DDSIM_TESTS=ON to CMake during configuration)

  • the Python bindings library pyddsim.<...> in the build/mqt/ddsim directory (this requires passing -DBINDINGS=ON to CMake during configuration)

Working on the Python module#

The mqt.ddsim Python module can be conveniently built locally by calling

(venv) $ pip install --editable .

The --editable flag ensures that changes in the Python code are instantly available without re-running the command.

Pybind11 is used for providing bindings of the C++ core library to Python (see bindings.cpp). If parts of the C++ code have been changed, the above command has to be run again to make the changes visible in Python.