diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d849bc90b..8933cc57c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -140,7 +140,7 @@ jobs: # TODO: we'll eventually want to enable relevant features - name: "rustdoc" - run: cargo rustdoc -p riot-rs --features no-boards -- -D warnings + run: cargo rustdoc -p riot-rs --features no-boards,bench -- -D warnings - name: rustfmt run: cargo fmt --check --all diff --git a/src/riot-rs-bench/src/lib.rs b/src/riot-rs-bench/src/lib.rs index 1d5b062bd..c4f381c0a 100644 --- a/src/riot-rs-bench/src/lib.rs +++ b/src/riot-rs-bench/src/lib.rs @@ -9,6 +9,10 @@ cfg_if::cfg_if! { if #[cfg(context = "cortex-m")] { mod cortexm; use cortexm as bench; + } + else if #[cfg(context = "riot-rs")] { + // When run with laze but the architecture is not supported + compile_error!("benchmarking is not supported for this architecture"); } else { // Provide a default bench module, for arch-independent tooling mod bench { diff --git a/src/riot-rs/Cargo.toml b/src/riot-rs/Cargo.toml index 67a7adafe..8dcfbce73 100644 --- a/src/riot-rs/Cargo.toml +++ b/src/riot-rs/Cargo.toml @@ -10,7 +10,7 @@ workspace = true [dependencies] document-features = { workspace = true } linkme = { workspace = true } -riot-rs-bench = { workspace = true } +riot-rs-bench = { workspace = true, optional = true } riot-rs-boards = { path = "../riot-rs-boards" } riot-rs-buildinfo = { path = "../riot-rs-buildinfo" } riot-rs-debug = { workspace = true } @@ -75,6 +75,8 @@ wifi-esp = ["riot-rs-embassy/wifi-esp"] ## Enables the debug console, required to use ## [`println!`](riot_rs_debug::println). debug-console = ["riot-rs-rt/debug-console"] +## Enables benchmarking facilities. +bench = ["dep:riot-rs-bench"] ## Prints nothing in case of panics (may help reduce binary size). silent-panic = ["riot-rs-rt/silent-panic"] ## Allows to have no boards selected, useful to run target-independent tooling. diff --git a/src/riot-rs/src/lib.rs b/src/riot-rs/src/lib.rs index a93e565d9..b96b94851 100644 --- a/src/riot-rs/src/lib.rs +++ b/src/riot-rs/src/lib.rs @@ -7,6 +7,8 @@ #![no_std] #![feature(doc_cfg)] +#[cfg(feature = "bench")] +#[doc(cfg(feature = "bench"))] #[doc(inline)] pub use riot_rs_bench as bench; pub use riot_rs_buildinfo as buildinfo;