olympus-robotics / mcap_builder

Add support to build and install MCAP with CMake
MIT License
9 stars 5 forks source link

MCAP CMake Builder

This repo provides a wrapper to build and install MCAP via CMake.

Build and Install

To build and install run:

$ cd mcap_builder
$ mkdir build && cd build
$ cmake ../ && make install

you can change the install folder by setting CMAKE_INSTALL_PREFIX (as for any CMake project).

Usage

MCAP Is Installed

If you built and installed as described above, to include MCAP in your library first you need to add it to your CMake:

find_package(mcap)

target_link_libraries(<target> PUBLIC mcap)

and in your code, you can include reader.hpp or writer.hpp.

Build MCAP Locally

If you do not want to install MCAP, and you want to build it as part of your project you can, in your CMakeLists.txt add:

include(FetchContent)
FetchContent_Declare(
  mcap_builder
  GIT_REPOSITORY https://github.com/olympus-robotics/mcap_builder.git
  GIT_TAG main
)
FetchContent_MakeAvailable(mcap_builder)

# create your targets

target_link_libraries(<target> PUBLIC mcap)

Macros

Notes

MCAP is natively a header-only library, but in this wrapper, it is built into a binary library.

This has two benefits: