aboutsummaryrefslogtreecommitdiff
path: root/build.rs
diff options
context:
space:
mode:
Diffstat (limited to 'build.rs')
-rw-r--r--build.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/build.rs b/build.rs
index dc9b3a0..be5b48a 100644
--- a/build.rs
+++ b/build.rs
@@ -3,9 +3,12 @@ use std::{env, fs};
fn main() {
let target = env::var("TARGET").unwrap();
+ let host_triple = env::var("HOST").unwrap();
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
let name = env::var("CARGO_PKG_NAME").unwrap();
+ let native_compilation = host_triple == target;
+
if target.starts_with("thumb") {
let suffix = if env::var_os("CARGO_FEATURE_LINKER_PLUGIN_LTO").is_some() {
"-lto"
@@ -43,7 +46,7 @@ fn main() {
println!("cargo:rustc-cfg=armv8m_main");
}
- if target.ends_with("-eabihf") {
- println!("cargo:rustc-cfg=has_fpu");
+ if native_compilation {
+ println!("cargo:rustc-cfg=native");
}
}