Skip to content

Commit

Permalink
In debug builds, spawn the binary at target/debug/rerun, if it exis…
Browse files Browse the repository at this point in the history
…ts (#7437)

### What
This makes it easier to test examples with the latest built viewer,
without setting up a pixi environment or modifying `PATH`.

### 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 the web demo (if applicable):
* Using examples from latest `main` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/7437?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/7437?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!
* [x] If have noted any breaking changes to the log API in
`CHANGELOG.md` and the migration guide

- [PR Build Summary](https://build.rerun.io/pr/7437)
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

To run all checks from `main`, comment on the PR with `@rerun-bot
full-check`.
  • Loading branch information
emilk authored Sep 18, 2024
1 parent 80cde64 commit a48e1b9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ All Rust examples are set up as separate executables, so they can be run by spec
cargo run -p dna
```

They will either connect to an already running rerun viewer, or spawn a new one.
In debug builds, it will spawn `target/debug/rerun` if it exists, otherwise look for `rerun` on `PATH`.


## Building and installing the Rerun Python SDK

Expand Down
9 changes: 9 additions & 0 deletions crates/top/re_sdk/src/spawn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ impl SpawnOptions {
return path.to_owned();
}

#[cfg(debug_assertions)]
{
let local_build_path = format!("target/debug/{RERUN_BINARY}");
if std::fs::metadata(&local_build_path).is_ok() {
re_log::info!("Spawning the locally built rerun at {local_build_path}");
return local_build_path;
}
}

self.executable_name.clone()
}
}
Expand Down
1 change: 1 addition & 0 deletions examples/rust/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ These are examples of how to use the [`rerun`](https://github.com/rerun-io/rerun
To try out any example in the list that follows, simply run `cargo run -p <example_name>`; e.g. `cargo run -p minimal`.

By default, the examples spawn a Rerun Viewer and stream log data to it.
In debug builds, they will spawn `target/debug/rerun` if it exists, otherwise look for `rerun` on `PATH`.

You can instead save the log data to an `.rrd` file using `cargo run -p objectron -- --save data.rrd`. You can then open that `.rrd` file with `rerun data.rrd` or `cargo run -- data.rrd`.

Expand Down

0 comments on commit a48e1b9

Please sign in to comment.