rerun: add C++ SDK support, build librerun_c from source (#457945)

This commit is contained in:
Someone
2025-11-05 13:12:07 +00:00
committed by GitHub

View File

@@ -3,6 +3,7 @@
stdenv,
rustPlatform,
fetchFromGitHub,
arrow-cpp,
# nativeBuildInputs
binaryen,
lld,
@@ -36,6 +37,11 @@ rustPlatform.buildRustPackage (finalAttrs: {
pname = "rerun";
version = "0.26.2";
outputs = [
"out"
"dev"
];
src = fetchFromGitHub {
owner = "rerun-io";
repo = "rerun";
@@ -51,7 +57,10 @@ rustPlatform.buildRustPackage (finalAttrs: {
cargoHash = "sha256-EH/R+OgLeLNrZnkIGqutTo4K9XzhW+CGwG/uQKwWGXA=";
cargoBuildFlags = [ "--package rerun-cli" ];
cargoBuildFlags = [
"--package rerun-cli"
"--package rerun_c"
];
cargoTestFlags = [ "--package rerun-cli" ];
buildNoDefaultFeatures = true;
buildFeatures = [
@@ -128,6 +137,8 @@ rustPlatform.buildRustPackage (finalAttrs: {
]
++ lib.optionals stdenv.hostPlatform.isLinux [ (lib.getLib wayland) ];
propagatedBuildInputs = [ arrow-cpp ];
addDlopenRunpaths = map (p: "${lib.getLib p}/lib") (
lib.optionals stdenv.hostPlatform.isLinux [
libxkbcommon
@@ -155,6 +166,23 @@ rustPlatform.buildRustPackage (finalAttrs: {
postPhases = lib.optionals stdenv.hostPlatform.isLinux [ "addDlopenRunpathsPhase" ];
postInstall = ''
# Install C++ SDK components
mkdir -p $dev/include
cp -r $src/rerun_cpp/src/* $dev/include/
# Install rerun_c library (built from Rust)
if [ -f "target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/librerun_c.a" ]; then
cp "target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/librerun_c.a" $out/lib/
fi
# Install CMake config files
mkdir -p $dev/lib/cmake/rerun_sdk
cp $src/rerun_cpp/CMakeLists.txt $dev/lib/cmake/rerun_sdk/
cp $src/rerun_cpp/Config.cmake.in $dev/lib/cmake/rerun_sdk/
cp $src/rerun_cpp/download_and_build_arrow.cmake $dev/lib/cmake/rerun_sdk/
'';
nativeInstallCheckInputs = [
versionCheckHook
];
@@ -169,7 +197,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
};
meta = {
description = "Visualize streams of multimodal data. Fast, easy to use, and simple to integrate. Built in Rust using egui";
description = "Visualize streams of multimodal data. Fast, easy to use, and simple to integrate. Built in Rust using egui. Includes C++ SDK";
homepage = "https://github.com/rerun-io/rerun";
changelog = "https://github.com/rerun-io/rerun/blob/${finalAttrs.version}/CHANGELOG.md";
license = with lib.licenses; [