Rerun C++ SDK
|
The Rerun C++ SDK allows logging data to Rerun directly from C++.
Read the getting started guide on how to use the Rerun C++ SDK.
After you've installed the viewer and added the SDK to your project, you can jump right in and try logging some data.
You first create a rerun::RecordingStream
stream and spawn a viewer. You then use it to log some archetypes to a given entity path using rerun::RecordingStream::log
:
Streaming data to a file on disk using the .rrd format:
Instead of spawning a new viewer, you can also try to connect to an already open one.
As long as you haven't called rerun::RecordingStream::save
/rerun::RecordingStream::connect
/rerun::RecordingStream::spawn
any data will be kept in memory until you call one of these.
As general entry point for Rerun examples check the examples page on our website. All C++ examples can be found directly in the Rerun repository. Additionally, each archetype's documentation comes with at least one small self-contained code example.
The most important type in the SDK is the rerun::RecordingStream
. It allows you to connect to the Rerun Viewer and send data.
The built-in types are distributed to the respective namespaces:
If you include rerun.hpp
, all archetypes and most component types become part of the rerun
namespace.
Check the general doc page on types to learn more.
From a build system perspective, the SDK consists of three dependencies:
For convenience, Rerun provides a C++ SDK bundle with every release. (this includes our regular Development Builds!)
This is a simple zip archive containing the SDK from the repository (excluding the tests
folder) and a lib
folder with prebuilt rerun_c libraries for all major desktop platforms. The rerun_c libraries follow a simple name schema that the CMake script can pick up.
See CMake Setup in Detail for deeper dive on how to use the SDK's CMakeLists.txt
and an overview over all CMake configuration options.
We don't have first class support for other build systems yet, but it should be possible to setup Rerun C++ without CMake fairly easily:
You have to add all files from the src/ folder either directly to your project or a library. In addition, you need to link the rerun_c
libraries and the Arrow C++ library. For more information on how to install Arrow, see Install arrow-cpp.
Make sure to compile with C++17 or newer.
There's a user provided minimal Bazel example here: https://github.com/kyle-figure/bazel-minimal-rerun/
If you are using a package manager that supports conda packages such as conda
or pixi
to manage your C++ dependencies, the Rerun C++ SDK is available from conda-forge channel in the [librerun-sdk
package](). After you installed the librerun-sdk
package. The Rerun Viewer is instead provided by the rerun-sdk
package, and you can install both with:
or
Once the package is available, you can find and consume it in your CMake project as you consume any other installed C++ library that provides a CMake config file:
Refer to the build instruction at the repo root.
Keep in mind that all archetypes/components/datatypes are mostly generated by the Rerun types builder. Use pixi run codegen
to run code generation. Generally, all generated code files are part of the repository, so you only have to do that if you change the data definition or make changes to _ext.cpp
files which extend generated types.
The Rerun C++ SDK requires a C++17 compliant compiler.
As of writing we tested the SDK against: