chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
cmake_minimum_required(VERSION 3.16...3.27)
|
||||
|
||||
# If you use the example outside of the Rerun SDK you need to specify
|
||||
# where the rerun_c build is to be found by setting the `RERUN_CPP_URL` variable.
|
||||
# This can be done by passing `-DRERUN_CPP_URL=<path to rerun_sdk_cpp zip>` to cmake.
|
||||
if(DEFINED RERUN_REPOSITORY)
|
||||
add_executable(example_shared_recording main.cpp)
|
||||
rerun_strict_warning_settings(example_shared_recording)
|
||||
else()
|
||||
project(example_shared_recording LANGUAGES CXX)
|
||||
|
||||
add_executable(example_shared_recording main.cpp)
|
||||
|
||||
# Set the path to the rerun_c build.
|
||||
set(RERUN_CPP_URL "https://github.com/rerun-io/rerun/releases/latest/download/rerun_cpp_sdk.zip" CACHE STRING "URL to the rerun_cpp zip.")
|
||||
option(RERUN_FIND_PACKAGE "Whether to use find_package to find a preinstalled rerun package (instead of using FetchContent)." OFF)
|
||||
|
||||
if(RERUN_FIND_PACKAGE)
|
||||
find_package(rerun_sdk REQUIRED)
|
||||
else()
|
||||
# Download the rerun_sdk
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(rerun_sdk URL ${RERUN_CPP_URL})
|
||||
FetchContent_MakeAvailable(rerun_sdk)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Link against rerun_sdk.
|
||||
target_link_libraries(example_shared_recording PRIVATE rerun_sdk)
|
||||
@@ -0,0 +1,25 @@
|
||||
<!--[metadata]
|
||||
title = "Shared recording"
|
||||
-->
|
||||
|
||||
|
||||
<picture>
|
||||
<img src="https://static.rerun.io/shared_recording/c3da85f1d4c158b8c7afb6bd3278db000b58049d/full.png" alt="">
|
||||
<source media="(max-width: 480px)" srcset="https://static.rerun.io/shared_recording/c3da85f1d4c158b8c7afb6bd3278db000b58049d/480w.png">
|
||||
<source media="(max-width: 768px)" srcset="https://static.rerun.io/shared_recording/c3da85f1d4c158b8c7afb6bd3278db000b58049d/768w.png">
|
||||
<source media="(max-width: 1024px)" srcset="https://static.rerun.io/shared_recording/c3da85f1d4c158b8c7afb6bd3278db000b58049d/1024w.png">
|
||||
<source media="(max-width: 1200px)" srcset="https://static.rerun.io/shared_recording/c3da85f1d4c158b8c7afb6bd3278db000b58049d/1200w.png">
|
||||
</picture>
|
||||
|
||||
This example demonstrates how to use `RecordingId`s to create a single shared recording across multiple processes.
|
||||
|
||||
To build it from a checkout of the repository (requires a Rust toolchain):
|
||||
```bash
|
||||
cmake .
|
||||
cmake --build . --target example_shared_recording
|
||||
```
|
||||
|
||||
Run the following multiple times, and you'll see that each invocation adds data to the existing recording rather than creating a new one:
|
||||
```bash
|
||||
./examples/cpp/shared_recording/example_shared_recording
|
||||
```
|
||||
@@ -0,0 +1,24 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#if defined(WIN32)
|
||||
#include <process.h>
|
||||
#define getpid _getpid
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <rerun.hpp>
|
||||
#include <rerun/demo_utils.hpp>
|
||||
|
||||
using rerun::demo::grid3d;
|
||||
|
||||
int main() {
|
||||
const auto rec =
|
||||
rerun::RecordingStream("rerun_example_shared_recording", "my_shared_recording");
|
||||
rec.spawn().exit_on_failure();
|
||||
|
||||
rec.log("updates", rerun::TextLog(std::string("Hello from ") + std::to_string(getpid())));
|
||||
|
||||
std::cout << "Run me again to append more data to the recording!" << std::endl;
|
||||
}
|
||||
Reference in New Issue
Block a user