From 7dcc59d4ed6921e8e94ab5f0fbe712216050b1fc Mon Sep 17 00:00:00 2001 From: Andres Vahter Date: Mon, 4 Sep 2023 15:21:47 +0300 Subject: expose all stm32-metapac chips as features add more supported timers --- rtic-monotonics/build.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 rtic-monotonics/build.rs (limited to 'rtic-monotonics/build.rs') 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), + } +} -- cgit v1.2.3