Skip to content

Commit c5b82a3

Browse files
committed
Remove native_viewer from the default features of rerun crate
Closes #1997 Most of our users only use the `rerun` library as a logging library but are still paying the cost of compiling the native viewer. With this PR, the `rerun` crate will not have the `native_viewer` (not `web_viewer`) feature on by default. This halves the compilation time on my computer. The `native_viewer` feature is only for users using the `show` or `spawn` features, which will hopefully be removed soon anyay: * #2109 To install the `rerun` binary with `native_viewer` and `web_viewer`, you now have to run `cargo install rerun --features binary`. This will be improved by: * #2108 To make things nicer for us developers, I've added `cargo rerun` as a shorthand for compiling and running `rerun` with the `native_viewer` feature, but NOT the `web_viewer` feature.
1 parent 3b72860 commit c5b82a3

File tree

14 files changed

+40
-21
lines changed

14 files changed

+40
-21
lines changed

.cargo/config.toml

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
[alias]
2+
# `cargo rerun` is short a convenient shorthand
3+
rerun = "run --package rerun --features native_viewer --features server --"
4+
25
# To easily run examples on the web, see https://github.com/rukai/cargo-run-wasm.
36
# Temporary solution while we wait for our own xtasks!
47
run-wasm = "run --release --package run_wasm --"

BUILD.md

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ This is a guide to how to build Rerun.
1717
* Run `./scripts/setup_dev.sh`.
1818
* Make sure `cargo --version` prints `1.69.0` once you are done
1919

20+
You should now be able run our Rust examples, e.g. with `cargo run -p dna`.
21+
22+
You can type `cargo rerun` to compile and run the `rerun` binary with most features enabled, thanks to a shortcut in `.cargo/config.toml`.
2023

2124
### Apple-silicon Macs
2225

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ rr.log_rect("car", bbox)
3939
### Rerun Viewer binary
4040
Both the Python and Rust library can start the Rerun Viewer, but to stream log data over the network or load our `.rrd` data files you also need the `rerun` binary.
4141

42-
It can be installed with `pip install rerun-sdk` or with `cargo install rerun`.
42+
It can be installed with `pip install rerun-sdk` or with `cargo install rerun --features binary`.
4343

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

crates/rerun/Cargo.toml

+8-10
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@ targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]
2121

2222

2323
[features]
24-
default = [
25-
"analytics",
26-
"demo",
27-
"glam",
28-
"image",
29-
"native_viewer",
30-
"server",
31-
"sdk",
32-
]
24+
default = ["library"]
25+
26+
## Default features when using `rerun` as a binary. Everything included.
27+
binary = ["library", "native_viewer", "server", "web_viewer"]
28+
29+
## Default features when using `rerun` as a logging library. Optimized for compilation speed.
30+
library = ["analytics", "demo", "glam", "image", "sdk", "server"]
3331

3432
## Enable telemetry using our analytics SDK.
3533
analytics = [
@@ -52,7 +50,7 @@ image = ["re_log_types/image", "re_sdk?/image"]
5250
## This adds a lot of extra dependencies, so only enable this feature if you need it!
5351
native_viewer = ["dep:re_viewer"]
5452

55-
## Support for running a HTTP server that listens to incoming log messages from a Rerun SDK.
53+
## Support for running a TCP server that listens to incoming log messages from a Rerun SDK.
5654
server = ["re_sdk_comms/server"]
5755

5856
## Embed the Rerun SDK and re-export all of its public symbols.

crates/rerun/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ You can add the `rerun` crate to your project with `cargo add rerun`.
4646
To get started, see [the examples](https://github.com/rerun-io/rerun/tree/latest/examples/rust).
4747
4848
## Binary
49-
You can install the binary with `cargo install rerun`
49+
You can install the binary with `cargo install rerun --features binary`
5050
5151
This can act either as a server, a viewer, or both, depending on which options you use when you start it.
5252

crates/rerun/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! There is also a `rerun` binary.
66
//! The binary is required in order to stream log data
77
//! over the networks, and to open our `.rrd` data files.
8-
//! If you need it, install the `rerun` binary with `cargo install rerun`.
8+
//! If you need it, install the `rerun` binary with `cargo install rerun --features binary`.
99
//!
1010
//! ## Feature flags
1111
#![doc = document_features::document_features!()]

crates/rerun/src/web_viewer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl crate::sink::LogSink for WebViewerSink {
9494
/// If the `open_browser` argument is `true`, your default browser
9595
/// will be opened with a connected web-viewer.
9696
///
97-
/// If not, you can connect to this server using the `rerun` binary (`cargo install rerun`).
97+
/// If not, you can connect to this server using the `rerun` binary (`cargo install rerun --features binary`).
9898
///
9999
/// NOTE: you can not connect one `Session` to another.
100100
///

examples/rust/api_demo/Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ license = "MIT OR Apache-2.0"
77
publish = false
88

99
[dependencies]
10-
rerun = { path = "../../../crates/rerun", features = ["web_viewer"] }
10+
rerun = { path = "../../../crates/rerun", features = [
11+
"native_viewer",
12+
"web_viewer",
13+
] }
1114

1215
anyhow = "1.0"
1316
clap = { version = "4.0", features = ["derive"] }

examples/rust/clock/Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ license = "MIT OR Apache-2.0"
77
publish = false
88

99
[dependencies]
10-
rerun = { path = "../../../crates/rerun", features = ["web_viewer"] }
10+
rerun = { path = "../../../crates/rerun", features = [
11+
"native_viewer",
12+
"web_viewer",
13+
] }
1114

1215
anyhow = "1.0"
1316
clap = { version = "4.0", features = ["derive"] }

examples/rust/dna/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0"
77
publish = false
88

99
[dependencies]
10-
rerun = { path = "../../../crates/rerun", features = ["web_viewer"] }
10+
rerun = { path = "../../../crates/rerun", features = ["native_viewer"] }
1111

1212
itertools = "0.10"
1313
rand = "0.8"

examples/rust/minimal/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ license = "MIT OR Apache-2.0"
77
publish = false
88

99
[dependencies]
10-
rerun = { path = "../../../crates/rerun" }
10+
rerun = { path = "../../../crates/rerun", features = ["native_viewer"] }

examples/rust/minimal_options/Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ license = "MIT OR Apache-2.0"
77
publish = false
88

99
[dependencies]
10-
rerun = { path = "../../../crates/rerun", features = ["web_viewer"] }
10+
rerun = { path = "../../../crates/rerun", features = [
11+
"native_viewer",
12+
"web_viewer",
13+
] }
1114

1215
anyhow = "1.0"
1316
clap = { version = "4.0", features = ["derive"] }

examples/rust/objectron/Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ publish = false
88

99

1010
[dependencies]
11-
rerun = { path = "../../../crates/rerun", features = ["web_viewer"] }
11+
rerun = { path = "../../../crates/rerun", features = [
12+
"native_viewer",
13+
"web_viewer",
14+
] }
1215

1316
anyhow = "1.0"
1417
clap = { version = "4.0", features = ["derive"] }

examples/rust/raw_mesh/Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ license = "MIT OR Apache-2.0"
77
publish = false
88

99
[dependencies]
10-
rerun = { path = "../../../crates/rerun", features = ["web_viewer"] }
10+
rerun = { path = "../../../crates/rerun", features = [
11+
"native_viewer",
12+
"web_viewer",
13+
] }
1114

1215
anyhow = "1.0"
1316
bytes = "1.3"

0 commit comments

Comments
 (0)