-
Notifications
You must be signed in to change notification settings - Fork 284
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
Move C++ SDK to own folder #2624
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
506bf2b
Move C++ SDK to own repository
emilk 7f49d8d
Split CMakeLists.txt into a project of three files
emilk 46c098f
Rename C++ namespace to rr
emilk 909bada
Only lint "GitHub" in .md files
emilk 37fef01
Write a proper C++ API
emilk 31037f5
Prepare for running C++ stuff on CI
emilk 52d74d3
Use GLOB to find C++ source files
emilk eafe047
Move recording stream to its own hpp/cpp
emilk a4e8576
Add some docs
emilk e09c462
fix
emilk d018ef5
remove duplicated cmake
emilk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
cmake_minimum_required(VERSION 3.16) | ||
|
||
project(rerun_cpp_proj LANGUAGES CXX) | ||
|
||
add_subdirectory(src) # The Rerun C++ SDK library | ||
add_subdirectory(example) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Rerun C++ SDK | ||
|
||
This is not yet ready to be used. | ||
|
||
## Requirements | ||
Run `scripts/setup.sh`. | ||
|
||
## Test it | ||
rerun_cpp/example/build_and_run.sh | ||
|
||
# To do: | ||
* CI | ||
* Code-gen | ||
* Documentation | ||
* Packaging | ||
* Publishing | ||
* … | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) | ||
cd "$script_path" | ||
set -x | ||
|
||
mkdir -p build | ||
pushd build | ||
cargo build -p rerun_c # TODO(emilk): add this to CMakelists.txt instead? | ||
cmake -DCMAKE_BUILD_TYPE=Debug .. | ||
make # VERBOSE=1 | ||
popd | ||
|
||
./build/example/rerun_example | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
cmake_minimum_required(VERSION 3.16) | ||
|
||
# project(RerunExample) | ||
|
||
# ------------------------------------------------------------------------------ | ||
|
||
# Arrow requires a C++17 compliant compiler | ||
if(NOT DEFINED CMAKE_CXX_STANDARD) | ||
set(CMAKE_CXX_STANDARD 17) | ||
endif() | ||
|
||
if(NOT DEFINED CMAKE_BUILD_TYPE) | ||
set(CMAKE_BUILD_TYPE Release) | ||
endif() | ||
|
||
add_executable(rerun_example main.cpp) | ||
|
||
if(MSVC) | ||
target_compile_options(rerun_example PRIVATE /W4 /WX) | ||
else() | ||
target_compile_options(rerun_example PRIVATE -Wall -Wextra -Wpedantic -Wcast-align -Wcast-qual -Wformat=2 -Wmissing-include-dirs -Wnull-dereference -Woverloaded-virtual -Wpointer-arith -Wshadow -Wswitch-enum -Wvla -Wno-sign-compare -Wconversion -Wunused -Wold-style-cast -Wno-missing-braces) | ||
endif() | ||
|
||
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/../src) # For rerun.hpp (Rerun C++ SDK) | ||
|
||
target_link_libraries(rerun_example PRIVATE loguru::loguru rerun_sdk) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <iostream> | ||
|
||
#define RERUN_WITH_ARROW 1 | ||
|
||
#include <loguru.hpp> | ||
#include <rerun.hpp> | ||
|
||
int main(int argc, char** argv) { | ||
loguru::g_preamble_uptime = false; | ||
loguru::g_preamble_thread = false; | ||
loguru::init(argc, argv); // installs signal handlers | ||
|
||
LOG_F(INFO, "Rerun C++ SDK version: %s", rr::version_string()); | ||
|
||
auto rr_stream = rr::RecordingStream{"c-example-app", "127.0.0.1:9876"}; | ||
|
||
float xyz[9] = {0.0, 0.0, 0.0, 1.0, 2.0, 3.0, 5.0, 5.0, 5.0}; | ||
auto points = rr::points3(3, xyz).ValueOrDie(); | ||
auto buffer = rr::ipc_from_table(*points).ValueOrDie(); | ||
|
||
const rr::DataCell data_cells[1] = {rr::DataCell{ | ||
.component_name = "rerun.point3d", | ||
.num_bytes = static_cast<size_t>(buffer->size()), | ||
.bytes = buffer->data(), | ||
}}; | ||
|
||
uint32_t num_instances = 3; | ||
rr_stream.log_data_row("points", num_instances, 1, data_cells); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
cmake_minimum_required(VERSION 3.16) | ||
|
||
# NOTE: CMake docs strongly discourages using GLOB, and instead suggests | ||
# manually listing all the files, like it's 1972. | ||
# However, that won't work for use since we auto-generate the source tree. | ||
# See https://cmake.org/cmake/help/latest/command/file.html#glob | ||
file(GLOB rerun_sdk_SRC CONFIGURE_DEPENDS | ||
"*.hpp" | ||
"*.cpp" | ||
) | ||
|
||
add_library(rerun_sdk ${rerun_sdk_SRC}) | ||
|
||
# ------------------------------------------------------------------------------ | ||
|
||
# For rerun.h (Rerun C SDK): | ||
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/../../crates/rerun_c/src) | ||
|
||
# Make sure the compiler can find include files for rerun | ||
# when other libraries or executables link to rerun: | ||
target_include_directories(rerun_sdk PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
||
# ------------------------------------------------------------------------------ | ||
# Loguru logging library (https://github.com/emilk/loguru): | ||
set(CMAKE_DL_LIBS "dl") # Required by Loguru for backtraces | ||
|
||
# Loguru, see https://github.com/emilk/loguru/blob/master/loguru_cmake_example/CMakeLists.txt | ||
include(FetchContent) | ||
FetchContent_Declare(LoguruGitRepo | ||
GIT_REPOSITORY "https://github.com/emilk/loguru" # can be a filesystem path | ||
GIT_TAG "master" | ||
) | ||
|
||
# set any loguru compile-time flags before calling MakeAvailable() | ||
set(LOGURU_STACKTRACES 1) | ||
FetchContent_MakeAvailable(LoguruGitRepo) # defines target 'loguru::loguru' | ||
|
||
target_link_libraries(rerun_sdk PRIVATE loguru::loguru) | ||
|
||
# ------------------------------------------------------------------------------ | ||
if(APPLE) | ||
target_link_libraries(rerun_sdk PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../target/debug/librerun_c.a) | ||
target_link_libraries(rerun_sdk PRIVATE "-framework CoreFoundation" "-framework IOKit") | ||
endif() | ||
|
||
if(LINUX) | ||
target_link_libraries(rerun_sdk PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../target/debug/librerun_c.a) | ||
target_link_libraries(rerun_sdk PRIVATE "-lm") | ||
endif() | ||
|
||
# ----------------------------------------------------------------------------- | ||
# Arrow: | ||
option(ARROW_LINK_SHARED "Link to the Arrow shared library" ON) | ||
|
||
find_package(Arrow REQUIRED) | ||
|
||
# Arrow requires a C++17 compliant compiler | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
message(STATUS "Arrow version: ${ARROW_VERSION}") | ||
message(STATUS "Arrow SO version: ${ARROW_FULL_SO_VERSION}") | ||
|
||
if(ARROW_LINK_SHARED) | ||
target_link_libraries(rerun_sdk PRIVATE Arrow::arrow_shared) | ||
else() | ||
target_link_libraries(rerun_sdk PRIVATE Arrow::arrow_static) | ||
endif() |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes 😆