-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve rerun_cpp readme & CMakeLists.txt (#4126)
### What * Fixes #4117 * overhauled Readme.md for rerun_cpp * everything except is now part of rerun_cpp zip bundle * made rerun_cpp CMakeLists.txt smaller by splitting out the from-source rerun_c and the from-source arrow builds out * rerun_c is now built as a built action, meaning it's part of the buildgraph of whatever generator you use - e.g. Ninja will build it now in parallel to your C files 🥳 ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/4126) (if applicable) * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG - [PR Build Summary](https://build.rerun.io/pr/4126) - [Docs preview](https://rerun.io/preview/1f68439ed4731c219b116fd41e15638015b9d68b/docs) <!--DOCS-PREVIEW--> - [Examples preview](https://rerun.io/preview/1f68439ed4731c219b116fd41e15638015b9d68b/examples) <!--EXAMPLES-PREVIEW--> - [Recent benchmark results](https://ref.rerun.io/dev/bench/) - [Wasm size tracking](https://ref.rerun.io/dev/sizes/)
- Loading branch information
Showing
14 changed files
with
280 additions
and
208 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Builds rerun_c from source. | ||
|
||
# Determine Rust's librerun path. | ||
if(APPLE) | ||
set(RERUN_C_BUILD_ARTIFACT ${CMAKE_CURRENT_SOURCE_DIR}/../../target/release/librerun_c.a) | ||
elseif(UNIX) # if(LINUX) # CMake 3.25 | ||
set(RERUN_C_BUILD_ARTIFACT ${CMAKE_CURRENT_SOURCE_DIR}/../../target/release/librerun_c.a) | ||
elseif(WIN32) | ||
set(RERUN_C_BUILD_ARTIFACT ${CMAKE_CURRENT_SOURCE_DIR}/../../target/release/rerun_c.lib) | ||
else() | ||
message(FATAL_ERROR "Unsupported platform.") | ||
endif() | ||
|
||
# Setup rerun_c library | ||
add_library(rerun_c STATIC IMPORTED GLOBAL) | ||
set_target_properties(rerun_c PROPERTIES IMPORTED_LOCATION ${RERUN_C_BUILD_ARTIFACT}) | ||
|
||
# Just depend on all rust and toml files, it's hard to know which files exactly are relevant. | ||
file(GLOB_RECURSE RERUN_C_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/../crates/*.rs" "${CMAKE_CURRENT_SOURCE_DIR}/../crates/*.toml") | ||
add_custom_command( | ||
OUTPUT ${RERUN_C_BUILD_ARTIFACT} | ||
DEPENDS ${RERUN_C_SOURCES} | ||
COMMAND cargo build --release -p rerun_c | ||
COMMENT "Building rerun_c from source" | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../.. | ||
) | ||
|
||
# In CMake you can't depend on an output file directly. We have to wrap this in a target that rerun_c then depends on. | ||
add_custom_target(rerun_c_build DEPENDS "${RERUN_C_BUILD_ARTIFACT}") | ||
add_dependencies(rerun_c rerun_c_build) | ||
|
||
# Put `rerun.h` into the same place where it's on a user's machine and apply CMake variables like version number. | ||
configure_file( | ||
"${CMAKE_CURRENT_SOURCE_DIR}/src/rerun.h" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/../../rerun_cpp/src/rerun/c/rerun.h" | ||
NEWLINE_STYLE LF # Specify line endings, otherwise CMake wants to change them on Windows. | ||
) |
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
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
Oops, something went wrong.