Skip to content

Commit

Permalink
Update C++ docs for auto-downloaded arrow (#4064)
Browse files Browse the repository at this point in the history
### What

* Part of  #3962

### 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/4064) (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/4064)
- [Docs
preview](https://rerun.io/preview/ae3c74d303c64121864d9982c455b5cbd5dfb2ad/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/ae3c74d303c64121864d9982c455b5cbd5dfb2ad/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://ref.rerun.io/dev/bench/)
- [Wasm size tracking](https://ref.rerun.io/dev/sizes/)
  • Loading branch information
Wumpf authored Oct 30, 2023
1 parent 71ee099 commit 85e195a
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 22 deletions.
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"files.autoGuessEncoding": true,
"cSpell.ignorePaths": [
".vscode",
"pixi.lock"
],
"cSpell.words": [
"andreas",
"bbox",
Expand Down
13 changes: 5 additions & 8 deletions crates/re_viewer/data/quick_start_guides/cpp_connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,18 @@ Using `pip`:
After you have installed it, type `rerun` in your terminal to start the viewer.


#### Using the Rerun C++ SDK
First you need to install the `arrow-cpp` library on your system using your favorite package manager.
If you are using [Pixi](https://prefix.dev/docs/pixi/overview), you can simply type `pixi global install arrow-cpp`.
Find more information at the official Arrow Apache [install guide](https://arrow.apache.org/install/).

If you're using CMake, you can add the following to your `CMakeLists.txt`:

#### Using the Rerun C++ SDK with CMake
```cmake
include(FetchContent)
FetchContent_Declare(rerun_sdk URL
https://github.com/rerun-io/rerun/releases/latest/download/rerun_cpp_sdk.zip)
FetchContent_MakeAvailable(rerun_sdk)
```

This will download a bundle with pre-built Rerun C static libraries for most desktop platforms, all Rerun C++ sources and headers, as well as CMake build instructions for them.
This will download a bundle with pre-built Rerun C static libraries for most desktop platforms,
all Rerun C++ sources and headers, as well as CMake build instructions for them.
By default this will in turn download & build [Apache Arrow](https://arrow.apache.org/)'s C++ library which is required to build the Rerun C++.
See [Install arrow-cpp](https://www.rerun.io/docs/howto/arrow-cpp-install?speculative-link) to learn more about this step and how to use an existing install.

Make sure you link with `rerun_sdk`:
```cmake
Expand Down
17 changes: 5 additions & 12 deletions docs/content/getting-started/cpp.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,14 @@ order: 2
## Setup
Before adding Rerun to your application, start by [installing the viewer](installing-viewer.md).

The Rerun C++ SDK depends on an install of the `arrow-cpp` library on your system using.

🚧 In the future we want to make this part of the setup easier.

### Installing arrow-cpp with pixi
See our [how-to guide](../howto/arrow-cpp-pixi.md) on using pixi to install `arrow-cpp`.

### Installing arrow-cpp manually
Find more information about other package managers at the official Arrow Apache [install guide](https://arrow.apache.org/install/).

## Learning by example
If you prefer to learn by example, check out our example repository which uses the Rerun C++ SDK to log some data from Eigen and OpenCV: <https://github.com/rerun-io/cpp-example-opencv-eigen>.

## Using Rerun with CMake

Assuming you are starting with a bare-bones `CMakeLists.txt` such as:
```cmake
cmake_minimum_required(VERSION 3.16)
cmake_minimum_required(VERSION 3.16...3.27)
project(example_minimal LANGUAGES CXX)
add_executable(example_minimal main.cpp)
Expand All @@ -36,7 +26,10 @@ FetchContent_Declare(rerun_sdk URL
https://github.com/rerun-io/rerun/releases/latest/download/rerun_cpp_sdk.zip)
FetchContent_MakeAvailable(rerun_sdk)
```
This will download a bundle with pre-built Rerun C static libraries for most desktop platforms, all Rerun C++ sources and headers, as well as CMake build instructions for them.
This will download a bundle with pre-built Rerun C static libraries for most desktop platforms,
all Rerun C++ sources and headers, as well as CMake build instructions for them.
By default this will in turn download & build [Apache Arrow](https://arrow.apache.org/)'s C++ library which is required to build the Rerun C++.
See [Install arrow-cpp](../howto/arrow-cpp-install.md) to learn more about this step and how to use an existing install.

Currently, Rerun SDK works with C++17 or newer, so you need to add this property to your target:
```cmake
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
---
title: Install arrow-cpp with pixi
title: Install arrow-cpp
order: 6
---

# Automatically download & build arrow from source (default)

By default, the Rerun C++ SDK's CMake script (which is part of the SDK's zip artifact that can be fetched via `FetchContent`)
will download a known compatible version of Arrow from GitHub and add it to the build.
The build configuration is kept to the minimum required by the Rerun C++ SDK.

To instead use an existing install of Arrow, disable the CMake build option `RERUN_DOWNLOAD_AND_BUILD_ARROW`.
(by passing `-DRERUN_DOWNLOAD_AND_BUILD_ARROW=OFF` to your CMake configure step).
This will cause Rerun to instead use CMake's `find_package` to look for a ready-to-use install of the Arrow C++ library.

# Install arrow-cpp with Pixi

[Pixi](https://prefix.dev/docs/pixi/overview) is a convenient tool for managing cross-platform project dependencies. In
fact, Rerun uses it for our own internal development dependency management, and you will find `pixi.toml` files in most
of our external examples.

Make sure to use `-DRERUN_DOWNLOAD_AND_BUILD_ARROW=OFF` when building, otherwise Rerun's CMake script
will download & build arrow instead, ignoring your Pixi install.
The advantage of using Pixi is that you can rely on pre-built artifacts rather than adding Arrows build to your own.
Also, Pixi is of course also useful for managing other dependencies like Eigen or OpenCV,
as well as fr pinning the version of your build tooling.

## Installing Pixi
On Mac or Linux you can just run:
```
Expand Down Expand Up @@ -61,4 +80,6 @@ pixi run example
⚠️ [#4050](https://github.com/rerun-io/rerun/issues/4050) `arrow-cpp` needs to be held back to 10.0.1 to avoid conflicts
with the `rerun-sdk` package when installed in the same pixi environment.

⚠️ On Windows pixi only downloads release binaries which are **not** compatible with debug builds, causing runtime crashes. For debug builds you have to build Arrow yourself, see [Building Arrow C++](https://arrow.apache.org/docs/developers/cpp/building.html).
⚠️ On Windows pixi only downloads release binaries which are **not** compatible with debug builds, causing runtime crashes.
For debug builds you have to build Arrow yourself, see [Building Arrow C++](https://arrow.apache.org/docs/developers/cpp/building.html)
or stick with `RERUN_DOWNLOAD_AND_BUILD_ARROW=ON`.
1 change: 1 addition & 0 deletions docs/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"downscaled",
"downscaling",
"drawables",
"DRERUN",
"dtype",
"dtypes",
"eframe",
Expand Down
1 change: 1 addition & 0 deletions rerun_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ if(RERUN_DOWNLOAD_AND_BUILD_ARROW)
GIT_REPOSITORY https://github.com/apache/arrow.git
GIT_TAG apache-arrow-10.0.1
GIT_SHALLOW true
GIT_PROGRESS true
CMAKE_ARGS
--preset ninja-debug-minimal
-DARROW_IPC=ON
Expand Down

0 comments on commit 85e195a

Please sign in to comment.