General build instructions

Dependencies

The components within this repository have some dependencies:

Dependencies provided by Ubunutu (>= 18.04):

  • Boost
  • pugixml
  • libproj-dev
  • gtest
  • libpython-dev

Those can be installed by calling:

$>  sudo apt-get install libboost-all-dev libpugixml-dev libgtest-dev libpython-dev libproj-dev

Additional dependencies for the python bindings:

$>  sudo apt-get install castxml
$>  pip install --user pygccxml pyplusplus xmlrunner

Remaining dependencies are present as GIT submodules; also to fix the version of these:

  • ad_map_access
  • ad_map_opendrive_reader
  • ad_physics
  • spdlog

Building

For compiling all libraries and the dependencies, colcon is used colcon. Please use the link above for installation instructions.

This repository is prepared as colcon workspace including all dependencies not provided as installable packages by the OS. Those dependencies are part of the dependencies folder as GIT submodules. To properly fetch these, the submodules have to be updated and initialized.

 ad-rss-lib$>  git submodule update --init --recursive

Once this is done, the full set of dependencies and components can be built calling:

 ad-rss-lib$> colcon build

All components will be compiled respecting the dependencies between them.

The python bindings are disabled by default. To integrate them into the build you can make use of the prepared colcon meta file:

 ad-rss-lib$> colcon build --metas colcon_python.meta

colcon_python.meta enables python build (-DBUILD_PYTHON_BINDING=ON). To specify the python version to be used you call e.g.:

 ad-rss-lib$> colcon build --metas colcon_python.meta --cmake-args -DPYTHON_BINDING_VERSION=3.8

If cmake isn't able to find the requested python version you can try to specify the python executable explicitly (e.g. under Ubuntu18.04):

 ad-rss-lib$> colcon build --metas colcon_python.meta --cmake-args -DPYTHON_BINDING_VERSION=3.6 -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3.6

Build options

There are some CMake options affecting what or how the components are built.

  • BUILD_TESTING: Enables unit tests compilation
  • BUILD_APIDOC: Enables API documentation building
  • BUILD_HARDENING: Enables hardening compiler and linker flags
  • BUILD_PYTHON_BINDING: Enables the build of the respective python bindings
  • PYTHON_BINDING_VERSION: Select the python version to use explicitly e.g. "3.8". (Note: If that's not one of the system installed python versions, you have to ensure that the boost-python binding for that python version is available!)

By default, all options are set to off. Any of these could be activate by adding them via the colcon call above as "--cmake-args -D<OPTION>=[ON|OFF]", e.g.:

 ad-rss-lib$> colcon build --cmake-args -DBUILD_TESTING=ON -DBUILD_APIDOC=ON -DBUILD_PYTHON_BINDING=ON -DPYTHON_BINDING_VERSION=3.8

Unit tests

 ad-rss-lib$> colcon build --cmake-args -DBUILD_TESTING=ON

When activating the Unit tests, they all can be executed with:

 ad-rss-lib$> colcon test

API documentation

When BUILD_APIDOC is enabled, the "colcon" call will automatically generate the API documentation.

 ad-rss-lib$> colcon build --cmake-args -DBUILD_APIDOC=ON

The API documentation is written to the apidoc folder within the build directory.

Build hardening

Usually, build hardening is injected by the surrounding build system. Nevertheless, the CMakeLists.txt defines hardening flags to ensure the code is compatible to respective flags. To enable hardening compiler and linker flags:

 ad-rss-lib$> colcon build --cmake-args -DBUILD_HARDENING=ON