obu-firmware builds against vanetza-idf from microbu-esp32c5/external, but that tree was gitignored, so a clone of this repository could not build the firmware it ships. It is now committed here as ordinary files in its own folder, microbu-esp32c5/: the colleague's commit cf4b99f plus the V2X2MAP bridge's signature verification (--trust) used on the bench. Nothing is fetched from or pushed to the colleague's repository; this repository and its remotes carry everything. The folder's own .gitignore keeps build output, downloaded components and private key material out, as it did there; the committed file set is identical to that repository's tracked files. The ESP32-C5 is still flashed from obu-firmware/, which only takes vanetza-idf from microbu-esp32c5/, so the two stay separate folders. FLASHING.md says how to take a newer version of the colleague's tree (copy it over the folder, rebuild, test, commit).
2.1 KiB
How to build
Building Vanetza is accomplished by the CMake build system. Hence, CMake needs to be available on the build host.
Prerequisites
You need following tools and libraries on your system for compiling Vanetza:
- C++11 compatible compiler, e.g. GNU GCC or Clang
- CMake 3.12 or higher
- Boost 1.58 or higher
- GeographicLib 1.37 or higher
- Crypto++ 5.6.1 or higher
If OpenSSL (1.0 or 1.1) or LibreSSL is available on your system, an alternative security backend implementation is compiled along with the Crypto++ based backend.
See security::Backend and security::create_backend for more details.
!!! hint If you are building on Ubuntu 16.04 or 18.04, please note that these Ubuntu releases ship outdated CMake versions unsuitable for Vanetza. Have a look at the Kitware APT Repository, which lists some of your options for installing an up-to-date CMake version.
Compilation
Following command line snippet demonstrates the build process using a generated Makefile. Other CMake generators and build directory setups can be used as well.
:::shell
cd vanetza
mkdir build && cd build
cmake ..
make
Unit tests
Vanetza comes with many unit tests covering the most critical parts.
When the CMake option BUILD_TESTS is enabled, the Google Test sources are downloaded by the build system automatically.
The built test cases are standalone executables located in the tests subdirectory of your build directory.
For running all test cases, I recommend to invoke ctest in your build directory.
Integrating Vanetza
Vanetza is primarily a library project intended for integration by other projects, e.g. V2X simulation tools such as Artery.
Projects using CMake can integrate Vanetza most easily by calling find_package(Vanetza) and then refer to the imported Vanetza targets, such as Vanetza::vanetza.