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

Provide CMake setup for using the C++ sdk with pre-built rerun_c #3759

Closed
Tracked by #2919
Wumpf opened this issue Oct 10, 2023 · 0 comments · Fixed by #3875
Closed
Tracked by #2919

Provide CMake setup for using the C++ sdk with pre-built rerun_c #3759

Wumpf opened this issue Oct 10, 2023 · 0 comments · Fixed by #3875
Assignees
Labels
🌊 C++ API C/C++ API specific
Milestone

Comments

@Wumpf
Copy link
Member

Wumpf commented Oct 10, 2023

We already have rerun_c binaries uploaded on every devlopment build.
With these it should be possible to provide a CMake setup where a user no longer needs to do any rust build

@Wumpf Wumpf mentioned this issue Oct 10, 2023
33 tasks
@Wumpf Wumpf added the 🌊 C++ API C/C++ API specific label Oct 10, 2023
@Wumpf Wumpf added this to the 0.10 C++ milestone Oct 10, 2023
@Wumpf Wumpf changed the title Documented CMake setup for using the C++ sdk with pre-built rerun_c Provide CMake setup for using the C++ sdk with pre-built rerun_c Oct 10, 2023
@Wumpf Wumpf self-assigned this Oct 13, 2023
Wumpf added a commit that referenced this issue Oct 17, 2023
…tent (#3875)

### What

* Fixes #3759

Change CMakeLists.txt in rerun_cpp to work standalone with
add_directory.
When used in this fashion it expects the `RERUN_C_LIB` variable to be
set. The default for it points to a local `lib` folder with
appropriately named libs.
This in turn gives rise to a very trivial bundling strategy:
* copy src
* copy CMakeLists.txt
* copy libs

This is done in the new `build_and_upload_rerun_cpp` script which on top
of the above also takes care of testing the resulting artifact by
running the now also compatible minimal example outside of the repo.

Another smaller necessary change is that the rerun.h C header is now
copied into the rerun_cpp sdk with a patched version number in the
comment. This is primarily so to keep the above process super simple and
shave of an additional include directory.

~Draft until PR ci confirmed to be working.~
(PR checks only the linux artifact, main ci checks the full artifact and
puts it on the Development Release notes)


With this change, the minimal possible cmake script for a project using
Rerun is:
```cmake
project(hello_rerun)

include(FetchContent)
FetchContent_Declare(rerun_sdk URL https://build.rerun.io/commit/f4e5ad6/rerun_cpp.zip DOWNLOAD_EXTRACT_TIMESTAMP YES)
FetchContent_MakeAvailable(rerun_sdk)

add_executable(hello_rerun main.cpp)
set_property(TARGET hello_rerun PROPERTY CXX_STANDARD 20) # Rerun requires C++17, but you can of course use an ever newer version.
target_link_libraries(hello_rerun PRIVATE rerun_sdk)
```
⚠️ **this STILL requires libarrow to be installed somewhere where cmake
can find it** ⚠️

### 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/3875) (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/3875)
- [Docs
preview](https://rerun.io/preview/9ddbc213c8f4bd2ea288590f9ab2f2b9d48ae552/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/9ddbc213c8f4bd2ea288590f9ab2f2b9d48ae552/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://ref.rerun.io/dev/bench/)
- [Wasm size tracking](https://ref.rerun.io/dev/sizes/)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌊 C++ API C/C++ API specific
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant