2021-03-04 20:40:54 +00:00
|
|
|
use std::env;
|
|
|
|
|
|
|
|
fn main() {
|
2023-11-29 16:23:48 +00:00
|
|
|
println!("cargo:rerun-if-changed=build.rs");
|
|
|
|
|
2021-03-04 20:40:54 +00:00
|
|
|
let target = env::var("TARGET").unwrap();
|
|
|
|
|
|
|
|
if target.starts_with("thumbv6m-") {
|
|
|
|
println!("cargo:rustc-cfg=cortex_m");
|
|
|
|
println!("cargo:rustc-cfg=armv6m");
|
|
|
|
} else if target.starts_with("thumbv7m-") {
|
|
|
|
println!("cargo:rustc-cfg=cortex_m");
|
|
|
|
println!("cargo:rustc-cfg=armv7m");
|
|
|
|
} else if target.starts_with("thumbv7em-") {
|
|
|
|
println!("cargo:rustc-cfg=cortex_m");
|
|
|
|
println!("cargo:rustc-cfg=armv7m");
|
|
|
|
println!("cargo:rustc-cfg=armv7em"); // (not currently used)
|
|
|
|
} else if target.starts_with("thumbv8m.base") {
|
|
|
|
println!("cargo:rustc-cfg=cortex_m");
|
|
|
|
println!("cargo:rustc-cfg=armv8m");
|
|
|
|
println!("cargo:rustc-cfg=armv8m_base");
|
|
|
|
} else if target.starts_with("thumbv8m.main") {
|
|
|
|
println!("cargo:rustc-cfg=cortex_m");
|
|
|
|
println!("cargo:rustc-cfg=armv8m");
|
|
|
|
println!("cargo:rustc-cfg=armv8m_main");
|
|
|
|
}
|
|
|
|
|
|
|
|
if target.ends_with("-eabihf") {
|
|
|
|
println!("cargo:rustc-cfg=has_fpu");
|
|
|
|
}
|
|
|
|
}
|