xous-core/services/kernel-test/build.rs
Jean-Pierre De Jesus DIAZ 955fbc8788
xous: Use CARGO_CFG_TARGET_OS in build scripts.
This allows for a more reliable detection of target_os configuration
in build scripts. The target is inconsistent between some architectures,
notably armv7a is `armv7a-none-eabi` skipping the `unknown` (the vendor,
I guess) part. This happen with some of the unrelated Cortex-M targets
present, and others may also be.

Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2022-10-12 19:03:46 +02:00

15 lines
443 B
Rust

// NOTE: Adapted from cortex-m/build.rs
use std::env;
fn main() {
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
// If we're not running on a desktop-class operating system, emit the "baremetal"
// config setting. This will enable software to do tasks such as
// managing memory.
if target_os == "none" {
println!("cargo:rustc-cfg=baremetal");
}
println!("cargo:rerun-if-changed=build.rs");
}