Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dev] Add rerun example #13

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bazel/workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ load("//third_party/rules_ros2:workspace.bzl", rules_ros2 = "repo")
load("//third_party/mcap:workspace.bzl", mcap = "repo")
load("//third_party/onnxruntime:workspace.bzl", onnxruntime = "repo")
load("//third_party/foxglove_schemas:workspace.bzl", foxglove_schemas = "repo")
load("//third_party/rerun:workspace.bzl", rerun = "repo")

def init_language_repos():
toolchains_llvm()
Expand Down Expand Up @@ -101,6 +102,7 @@ def init_third_parties():
mcap()
foxglove_schemas()
onnxruntime()
rerun()

# Define all external repositories required by
def repositories():
Expand Down
15 changes: 15 additions & 0 deletions experimental/rerun_example/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
load("@rules_cc//cc:defs.bzl", "cc_binary")
package(default_visibility = ["//visibility:public"])

cc_binary(
name = "rerun_example",
srcs = [
"rerun_example.cpp",
],
linkopts = ["-ldl"],
tags = ["no-tidy"],
deps = [
"@com_github_google_glog//:glog",
"@rerun",
],
)
8 changes: 8 additions & 0 deletions experimental/rerun_example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Rerun.io

### Cpp SDK
https://ref.rerun.io/docs/cpp/stable/index.html

### References
- https://github.com/kyle-figure/bazel-minimal-rerun
- https://github.com/rerun-io/rerun
25 changes: 25 additions & 0 deletions experimental/rerun_example/rerun_example.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include <rerun.hpp>
#include <rerun/demo_utils.hpp>

#include "glog/logging.h"

using rerun::demo::grid3d;

int main() {
LOG(INFO) << "Start a rerun example";
auto rec = rerun::RecordingStream("rerun_example_cpp");

rerun::spawn().exit_on_failure();

// Create some data using the `grid` utility function.
std::vector<rerun::Position3D> points =
grid3d<rerun::Position3D, float>(-10.f, 10.f, 10);
std::vector<rerun::Color> colors = grid3d<rerun::Color, uint8_t>(0, 255, 10);

// Log the "my_points" entity with our data, using the `Points3D` archetype.
rec.log("my_points",
rerun::Points3D(points).with_colors(colors).with_radii({0.5f}));

rec.save("example.rrd").exit_on_failure();
return 0;
}
6 changes: 4 additions & 2 deletions third_party/arrow/arrow.BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Description:
# Apache Arrow library
# See: https://github.com/tensorflow/io/blob/master/WORKSPACE

package(default_visibility = ["//visibility:public"])

Expand Down Expand Up @@ -81,10 +82,10 @@ cc_library(
],
copts = select({
"@bazel_tools//src/conditions:windows": [
"/std:c++14",
"/std:c++17",
],
"//conditions:default": [
"-std=c++14",
"-std=c++17",
],
}),
defines = [
Expand Down Expand Up @@ -120,5 +121,6 @@ cc_library(
"@xsimd",
"@zlib",
"@zstd",
"@io_opentelemetry_cpp//sdk/src/trace"
],
)
7 changes: 4 additions & 3 deletions third_party/arrow/workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

def repo():
version = "10.0.1"
http_archive(
name = "arrow",
build_file = "//third_party/arrow:arrow.BUILD",
sha256 = "57e13c62f27b710e1de54fd30faed612aefa22aa41fa2c0c3bacd204dd18a8f3",
strip_prefix = "arrow-apache-arrow-7.0.0",
sha256 = "28c3e0402bc1c3c1e047b6e26cedb8d1d89b2b9497d576af24b0b700eef11701",
strip_prefix = "arrow-apache-arrow-{}".format(version),
urls = [
"https://github.com/apache/arrow/archive/apache-arrow-7.0.0.tar.gz",
"https://github.com/apache/arrow/archive/apache-arrow-{}.tar.gz".format(version),
],
)
1 change: 1 addition & 0 deletions third_party/rerun/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package(default_visibility = ["//visibility:public"])
1 change: 1 addition & 0 deletions third_party/rerun/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Copied from https://github.com/kyle-figure/bazel-minimal-rerun/tree/main
35 changes: 35 additions & 0 deletions third_party/rerun/rerun.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
load("@rules_cc//cc:defs.bzl", "cc_import")
load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")

package(default_visibility = ["//visibility:public"])

filegroup(
name = "all_srcs",
srcs = glob(["**"]),
)

cc_import(
name = "rerun_core",
static_library = "@rerun//:lib/librerun_c__linux_x64.a",
)

cc_library(
name = "rerun",
srcs = glob([
"src/rerun/*.cpp",
"src/rerun/**/*.cpp",
]),
hdrs = glob([
"src/rerun.hpp",
"src/rerun/c/*.h",
"src/rerun/*.hpp",
"src/rerun/**/*.hpp",
]),
includes = [
"src",
],
deps = [
":rerun_core",
"@arrow",
],
)
13 changes: 13 additions & 0 deletions third_party/rerun/workspace.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

def clean_dep(dep):
return str(Label(dep))

def repo():
http_archive(
name = "rerun",
build_file = "//third_party/rerun:rerun.BUILD",
sha256 = "5f38113a647c72255b902fc3e00ca090c8011821550c94554c8c3845d2eac2a3",
strip_prefix = "rerun_cpp_sdk",
url = "https://github.com/rerun-io/rerun/releases/download/0.13.0/rerun_cpp_sdk.zip",
)
Loading