Skip to content

Latest commit

 

History

History
122 lines (91 loc) · 6.02 KB

README_FOR_DEVS.md

File metadata and controls

122 lines (91 loc) · 6.02 KB

Building from Source

Note: Currently there appears to be a bug with boost geometry and newer versions of GCC (this seems to start with version 11.4). A workaround until this is fixed is to use an older version of GCC (we suggest GCC 10). To do so, indicate the path to the older version of GCC in the CXX environment variable before building the code (e.g. export CXX=/usr/bin/g++-10).

Third-Party Dependencies

The following third-party dependencies of the C++ code are only required for building the project from source! While most of these dependencies are added automatically during the build process, you can install them manually via your package manager to speed up the build process.

Manual installation required:

Manual installation recommended to speed up the build:

Manual installation optional:

Optional dependencies:

  • Doctest (optional: for building unit tests)
  • Doxygen (optional: for building documentation)

The additional Python dependencies are listed in pyproject.toml.

Building the Code

  1. Install C++ dependencies:
sudo apt-get update
sudo apt-get install libomp-dev libboost-all-dev libeigen3-dev libyaml-cpp-dev pybind11-dev doctest-dev doxygen
  1. Build the package and install it to your conda environment via pip command.
pip install -v .

This will build the Python binding (pycrreach) required for collision checks and other C++-boosted computations.

Note: The -v flag (verbose) prints information about the build progress

Optional:

  • To build the code in Debug mode, add the flag --config-settings=cmake.build-type="Debug" to the pip command.
  • See here for further information on configuring CMake arguments via our build system (scikit-build-core).

Note: scikit-build-core uses ninja for building the C++ extension by default. Thus, the build is automatically parallelized using all available CPU cores. If you want to explicitly configure the number of build jobs, you can do so by passing the flag --config-settings=cmake.define.CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS to the pip command, where $BUILD_JOBS is the number of parallel jobs to use. See here for further details.

Note: Building the package in Debug mode (see above) significantly increases the computation time of the C++ backend. Please make sure you are building in Release mode (default setting) if you require fast computations.

Editable Install (experimental)

  1. Install the C++ dependencies as described above.

  2. Install the Python build dependencies (required to make --no-build-isolation work in the next step):

pip install -r requirements_build.txt
  1. Build the package and install it in editable mode with automatic rebuilds.
pip install -v --no-build-isolation --config-settings=editable.rebuild=true -e .

Note that this is considered experimental by scikit-build-core and is subject to change. For more information, please see the documentation of scikit-build-core. Flags:

  • -v (verbose) prints information about the build progress
  • --no-build-isolation disables build isolation, which means the build runs in your local environment
  • --config-settings=editable.rebuild=true enables automatic rebuilds when the source code changes (see the caveats in the documentation of scikit-build-core)
  • -e (editable) installs the package in editable mode

Debugging the C++ Code

  1. Install the package in editable mode using a Debug build:
pip install -v --no-build-isolation --config-settings=editable.rebuild=true --config-settings=cmake.build-type="Debug" -e .
  1. Launch the Python interpreter under a C++ debugger, for example with GDB:
gdb -ex r --args python compute_reachable_set.py

You can also use your favorite IDE to debug the C++ code.

Debugging with CLion

To set up a debugging configuration with CLion, follow the steps described under option 2 here. Make sure to use the Python and pip executables from your Anaconda environment.

When setting up the external build tool in CLion, we recommend to choose a different build directory to avoid interference with your manual builds. You also have to make sure that CMake uses the correct compiler version (see the note at the very top of this document). Below, you find the pip arguments of an example configuration:

install
-v
--no-build-isolation
--config-settings=editable.rebuild=true
--config-settings=cmake.build-type="Debug"
--config-settings=cmake.define.CMAKE_CXX_COMPILER=/usr/bin/g++-10
--config-settings=build-dir=build/CLion
-e
.

Note: Do not disable the automatic rebuilds. Otherwise, CLion appears to not recognize the breakpoints you set. It also appears that breakpoints are not recognized if you start debugging immeadiately after changing the code. In this case, restarting the debugging session should help.

Alternatively, you can omit the build step in the CLion configuration and just relay on the automatic rebuilds of your manual debug installation. With this, the breakpoints seem to work more reliably. To do so, edit your run configuration and remove "Build" from the "Before launch" section.

If all else fails, uninstalling and reinstalling the package also seems to fix the breakpoint recognition.