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

Update C++ docs for auto-downloaded arrow #4064

Merged
merged 7 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
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,20 +15,17 @@ 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/download/prerelease/rerun_cpp_sdk.zip) # TODO(#3962): update link
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
19 changes: 6 additions & 13 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_minimum_required(VERSION 3.16)
```cmake
cmake_minimum_required(VERSION 3.16...3.27)
project(example_minimal LANGUAGES CXX)

add_executable(example_minimal main.cpp)
Expand All @@ -35,7 +25,10 @@ include(FetchContent)
FetchContent_Declare(rerun_sdk URL https://github.com/rerun-io/rerun/releases/download/prerelease/rerun_cpp_sdk.zip) # TODO(#3962): update link
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) 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