rtic/rtic/build.rs
2023-03-01 00:35:20 +01:00

24 lines
879 B
Rust

use std::env;
fn main() {
let target = env::var("TARGET").unwrap();
// These targets all have know support for the BASEPRI register.
if target.starts_with("thumbv7m")
| target.starts_with("thumbv7em")
| target.starts_with("thumbv8m.main")
{
println!("cargo:rustc-cfg=cortex_m_basepri");
} else if target.starts_with("thumbv6m") | target.starts_with("thumbv8m.base") {
println!("cargo:rustc-cfg=cortex_m_source_masking");
} else if target.starts_with("riscv32i") {
panic!("No RISC-V support yet.");
// TODO: Add feature here for risc-v targets
// println!("cargo:rustc-cfg=riscv");
} else if target.starts_with("thumb") || target.starts_with("riscv32") {
panic!("Unknown target '{target}'. Need to update logic in build.rs.");
}
println!("cargo:rerun-if-changed=build.rs");
}