diff options
| author | Andres Vahter <andres@vahter.me> | 2023-09-04 15:21:47 +0300 |
|---|---|---|
| committer | Emil Fresk <emil.fresk@gmail.com> | 2023-09-06 18:48:36 +0000 |
| commit | 7dcc59d4ed6921e8e94ab5f0fbe712216050b1fc (patch) | |
| tree | 761dfd4f4fcf88492adbacd2593247a0e3b716e1 /rtic-monotonics/build.rs | |
| parent | 7d223ffe57eede6a8b5ac266f14bfd4fd6aeba7c (diff) | |
expose all stm32-metapac chips as features
add more supported timers
Diffstat (limited to 'rtic-monotonics/build.rs')
| -rw-r--r-- | rtic-monotonics/build.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/rtic-monotonics/build.rs b/rtic-monotonics/build.rs new file mode 100644 index 0000000..a2ed570 --- /dev/null +++ b/rtic-monotonics/build.rs @@ -0,0 +1,22 @@ +fn main() { + // feature=["stm32g081kb"] etc. + let stm32_chip: Vec<_> = std::env::vars() + .map(|(a, _)| a) + .filter(|x| { + !x.starts_with("CARGO_FEATURE_STM32_METAPAC") + && !x.starts_with("CARGO_FEATURE_STM32_TIM") + && x.starts_with("CARGO_FEATURE_STM32") + }) + .collect(); + + match stm32_chip.len() { + 0 => { + // Not using stm32. + } + 1 => { + // Allows to just use #[cfg(stm32)] if one of the stm32 chips is used. + println!("cargo:rustc-cfg=stm32"); + } + _ => panic!("multiple stm32xx definitions {:?}", stm32_chip), + } +} |
