Skip to content

Commit

Permalink
Add map_view to the default features and improve how the nasm fea…
Browse files Browse the repository at this point in the history
…ture is handled and documented (#8243)

This PR:
- adds the `map_view` feature to `default`
- removes everywhere the `map_view` was explicitly added that is no
longer necessary
- prints a warning when building in release mode with the `nasm` feature
disabled (which is still the default)
- document that `nasm` thing everywhere we talk about `cargo install
rerun-cli`
- tries to make people think before they add stuff to the `release`
feature instead of the `default` feature

---------

Co-authored-by: Clement Rey <[email protected]>
  • Loading branch information
abey79 and teh-cmc authored Nov 28, 2024
1 parent e5bad3b commit d2b45d5
Show file tree
Hide file tree
Showing 13 changed files with 64 additions and 22 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,12 @@ rr.log("path/to/points", rr.Points3D(positions, colors=colors))

### Installing the Rerun Viewer binary
To stream log data over the network or load our `.rrd` data files you also need the `rerun` binary.
It can be installed with `pip install rerun-sdk` or with `cargo install rerun-cli --locked`.
It can be installed with `pip install rerun-sdk` or with `cargo install rerun-cli --locked --features nasm` (see note below).
Note that only the Python SDK comes bundled with the Viewer whereas C++ & Rust always rely on a separate install.

**Note**: the `nasm` Cargo feature requires the [`nasm`](https://www.nasm.us) CLI to be installed and available in your path.
Alternatively, you may skip enabling this feature, but this may result in inferior video decoding performance.

You should now be able to run `rerun --help` in any terminal.


Expand Down
26 changes: 22 additions & 4 deletions crates/top/rerun-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,30 @@ doc = false
## so we have all the bells and wistles here, except those that may require extra tools
## (like "nasm").
## That is: `cargo install rerun-cli --locked` should work for _everyone_.
default = ["native_viewer", "web_viewer"]
default = ["native_viewer", "web_viewer", "map_view"]


# !!!IMPORTANT!!!
#
# Do you _really_ want to add features in `release` that are not in `default`?
#
# Here are some reasons not to:
# - These features will be missing from the `cargo install rerun-cli` command our users will inevitably use.
# - These features will not be picked up in places where we cannot use the `release` feature set (e.g. rerun_js).
# - This list is not exhaustive and will unexpectedly grow in the future.
#
# If you insist on adding a feature here, please make sure you address all the concerns above.
#
# `nasm`
# ------
#
# This requires external build tools (the `nasm` cli) and would break any build on a system without it. Mitigation: a
# warning with instructions is printed when building `rerun-cli` in release mode without the `nasm` feature (see
# `build.rs`).

## The features we enable when we build the pre-built binaries during our releases.
## This may enable features that require extra build tools that not everyone heas.
release = ["default", "nasm", "map_view"]
## This may enable features that require extra build tools that not everyone has.
release = ["default", "nasm"]

## Enable faster native video decoding with assembly.
## You need to install [nasm](https://nasm.us/) to compile with this feature.
Expand All @@ -51,7 +70,6 @@ native_viewer = ["rerun/native_viewer"]

## Support the map view.
## This adds a lot of extra dependencies.
#TODO(#7876): remove this feature when we have fewer dependencies
map_view = ["rerun/map_view"]

## Enable the gRPC Rerun Data Platform data source.
Expand Down
7 changes: 5 additions & 2 deletions crates/top/rerun-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
</h1>

## Rerun command-line tool
You can install the binary with `cargo install rerun-cli --locked`
You can install the binary with `cargo install rerun-cli --locked --features nasm`.

This can act either as a server, a viewer, or both, depending on which options you use when you start it.
**Note**: this requires the [`nasm`](https://www.nasm.us) CLI to be installed and available in your path.
Alternatively, you may skip enabling the `nasm` feature, but this may result in inferior video decoding performance.

The `rerun` CLI can act either as a server, a viewer, or both, depending on which options you use when you start it.

Running `rerun` with no arguments will start the viewer, waiting for an SDK to connect to it over TCP.

Expand Down
11 changes: 11 additions & 0 deletions crates/top/rerun-cli/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
fn main() {
re_build_tools::export_build_info_vars_for_crate("rerun-cli");

// Warn about not using the `nasm` feature in a release build.
let is_release = std::env::var("PROFILE") == Ok("release".to_owned());
let has_nasm_feature = std::env::var("CARGO_FEATURE_NASM").is_ok();
if is_release && !has_nasm_feature {
println!(
"cargo:warning=Rerun is compiled in release mode without the `nasm` feature activated. \
Enabling the `nasm` feature is recommended for better video decoding performance. \
This requires that the `nasm` CLI is installed and available in the current PATH."
);
}
}
4 changes: 2 additions & 2 deletions crates/top/rerun/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ default = [
"glam",
"image",
"log",
"map_view",
"sdk",
"server",
]
Expand Down Expand Up @@ -85,11 +86,10 @@ native_viewer = ["dep:re_viewer"]

## Support the map view.
## This adds a lot of extra dependencies.
#TODO(#7876): remove this feature when we have fewer dependencies
map_view = ["re_viewer?/map_view"]

## Enable the gRPC Rerun Data Platform data source.
grpc = ["re_viewer/grpc"]
grpc = ["re_viewer?/grpc"]

## Add support for the [`run()`] function, which acts like a main-function for a CLI,
## acting the same as [the `rerun` binary](https://crates.io/crates/rerun-cli).
Expand Down
8 changes: 5 additions & 3 deletions crates/top/rerun/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@ You can add the `rerun` crate to your project with `cargo add rerun`.
To get started, see [the examples](https://github.com/rerun-io/rerun/tree/latest/examples/rust).

## Binary
You can install the binary with `cargo install rerun-cli --locked`
You can install the binary with `cargo install rerun-cli --locked --features nasm`.

This can act either as a server, a viewer, or both, depending on which options you use when you start it.
**Note**: this requires the [`nasm`](https://www.nasm.us) CLI to be installed and available in your path.
Alternatively, you may skip enabling the `nasm` feature, but this may result in inferior video decoding performance.

The `rerun` CLI can act either as a server, a viewer, or both, depending on which options you use when you start it.

Running `rerun` with no arguments will start the viewer, waiting for an SDK to connect to it over TCP.

Run `rerun --help` for more.


### Running a web viewer
The web viewer is an experimental feature, but you can try it out with:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
The Rerun C++ SDK works by connecting to an awaiting Rerun Viewer over TCP.

If you need to install the viewer, follow the [installation guide](https://www.rerun.io/docs/getting-started/installing-viewer). Two of the more common ways to install the Rerun are:
* Via cargo: `cargo install rerun-cli --locked`
* Via cargo: `cargo install rerun-cli --locked --features nasm` (see note below)
* Via pip: `pip install rerun-sdk`

**Note**: the `nasm` Cargo feature requires the [`nasm`](https://www.nasm.us) CLI to be installed and available in your path.
Alternatively, you may skip enabling this feature, but this may result in inferior video decoding performance.

After you have installed it, you should be able to type `rerun` in your terminal to start the viewer.

## Using the Rerun C++ SDK with CMake
Expand Down
5 changes: 4 additions & 1 deletion crates/viewer/re_viewer/data/quick_start_guides/cpp_spawn.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
The Rerun C++ SDK works by connecting to an awaiting Rerun Viewer over TCP.

If you need to install the viewer, follow the [installation guide](https://www.rerun.io/docs/getting-started/installing-viewer). Two of the more common ways to install the Rerun are:
* Via cargo: `cargo install rerun-cli --locked`
* Via cargo: `cargo install rerun-cli --locked --features nasm` (see note below)
* Via pip: `pip install rerun-sdk`

**Note**: the `nasm` Cargo feature requires the [`nasm`](https://www.nasm.us) CLI to be installed and available in your path.
Alternatively, you may skip enabling this feature, but this may result in inferior video decoding performance.

After you have installed it, you should be able to type `rerun` in your terminal to start the viewer.

## Using the Rerun C++ SDK with CMake
Expand Down
1 change: 0 additions & 1 deletion crates/viewer/re_viewer/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,6 @@ impl App {
.archetype_reflection_from_short_name(&archetype_name)
{
for &view_type in archetype.view_types {
// TODO(#7876): remove once `map_view` feature is gone
if !cfg!(feature = "map_view") && view_type == "MapView" {
re_log::warn_once!("Found map-related archetype, but viewer was not compiled with the `map_view` feature.");
}
Expand Down
1 change: 0 additions & 1 deletion deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ deny = [
{ name = "egui_glow" }, # We use wgpu
{ name = "openssl-sys" }, # We prefer rustls
{ name = "openssl" }, # We prefer rustls
# { name = "reqwest" }, # We prefer ureq - less dependencies TODO(#7876): reenable that when `walkers` is updated
]
skip = [
{ name = "ahash" }, # Popular crate + fast release schedule = lots of crates still using old versions
Expand Down
5 changes: 3 additions & 2 deletions lychee.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ exclude = [
# Local links that require further setup.
'http://127.0.0.1',
'http://localhost',
'recording:/', # rrd recording link.
'recording:/', # rrd recording link.
'ws:/',
're_viewer.js', # Build artifact that html is linking to.
're_viewer.js', # Build artifact that html is linking to.
'http://0.0.0.0:51234',

# Api endpoints.
'https://fonts.googleapis.com/', # Font API entrypoint, not a link.
Expand Down
6 changes: 3 additions & 3 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@ rerun-web = { cmd = "cargo run --package rerun-cli --no-default-features --featu
#
# This installs the `wasm32-unknown-unknown` rust target if it's not already installed.
# (this looks heavy but takes typically below 0.1s!)
rerun-build-web = "rustup target add wasm32-unknown-unknown && cargo run -p re_dev_tools -- build-web-viewer --features analytics,map_view,grpc --debug"
rerun-build-web = "rustup target add wasm32-unknown-unknown && cargo run -p re_dev_tools -- build-web-viewer --features analytics,grpc --debug"

# Compile the web-viewer wasm and the cli.
#
# This installs the `wasm32-unknown-unknown` rust target if it's not already installed.
# (this looks heavy but takes typically below 0.1s!)
rerun-build-web-cli = "rustup target add wasm32-unknown-unknown && cargo run -p re_dev_tools -- build-web-viewer --features analytics,map_view,grpc --debug && cargo build --package rerun-cli --no-default-features --features web_viewer"
rerun-build-web-cli = "rustup target add wasm32-unknown-unknown && cargo run -p re_dev_tools -- build-web-viewer --features analytics,grpc --debug && cargo build --package rerun-cli --no-default-features --features web_viewer"

# Compile and run the web-viewer in release mode via rerun-cli.
#
Expand All @@ -197,7 +197,7 @@ rerun-web-release = { cmd = "cargo run --package rerun-cli --no-default-features
#
# This installs the `wasm32-unknown-unknown` rust target if it's not already installed.
# (this looks heavy but takes typically below 0.1s!)
rerun-build-web-release = "rustup target add wasm32-unknown-unknown && cargo run -p re_dev_tools -- build-web-viewer --features analytics,map_view,grpc --release -g"
rerun-build-web-release = "rustup target add wasm32-unknown-unknown && cargo run -p re_dev_tools -- build-web-viewer --features analytics,grpc --release -g"

rs-check = { cmd = "rustup target add wasm32-unknown-unknown && python scripts/ci/rust_checks.py", depends_on = [
"rerun-build-web", # The checks require the web viewer wasm to be around.
Expand Down
2 changes: 1 addition & 1 deletion rerun_js/web-viewer/build-wasm.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function buildWebViewer(mode) {
"cargo run -p re_dev_tools -- build-web-viewer",
modeFlags,
"--target no-modules-base",
"--features map_view,grpc",
"--features grpc",
"-o rerun_js/web-viewer",
].join(" "),
);
Expand Down

0 comments on commit d2b45d5

Please sign in to comment.