aboutsummaryrefslogtreecommitdiff
path: root/build.rs
diff options
context:
space:
mode:
authorGravatar bors[bot] <26634292+bors[bot]@users.noreply.github.com> 2021-12-29 18:32:38 +0000
committerGravatar Adam Greig <adam@adamgreig.com> 2021-12-31 17:23:19 +0000
commit2f0593ea25023e992acd6e6629ba3727222bee99 (patch)
tree5aa0a85306f3cca97b53470dd02725ca8413e53d /build.rs
parent9631347812a536f00f00c6698b8da2af98237ce6 (diff)
downloadcortex-m-2f0593ea25023e992acd6e6629ba3727222bee99.tar.gz
cortex-m-2f0593ea25023e992acd6e6629ba3727222bee99.tar.zst
cortex-m-2f0593ea25023e992acd6e6629ba3727222bee99.zip
Merge #369
369: Switch "native" check from being x86_64 only to checking `HOST` r=adamgreig a=TDHolmes If `HOST==TARGET`, we know we're compiling natively. Set a new `rustc` cfg for this and use it where we previously checked for `x86_64`. I was trying to run tests on my M1 MacBook Pro and couldn't since it isn't `x86_64`. Also, the currently configured nightly compiler for asm doesn't have M1 support, so I updated that. I'm fine reverting that change though, I can just do that locally, but I'm sure others will hit the same issue and it's a bit old... Co-authored-by: Tyler Holmes <tyler@holmesengineering.com>
Diffstat (limited to 'build.rs')
-rw-r--r--build.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/build.rs b/build.rs
index dc9b3a0..23ceeba 100644
--- a/build.rs
+++ b/build.rs
@@ -3,9 +3,14 @@ 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();
+ if host_triple == target {
+ println!("cargo:rustc-cfg=native");
+ }
+
if target.starts_with("thumb") {
let suffix = if env::var_os("CARGO_FEATURE_LINKER_PLUGIN_LTO").is_some() {
"-lto"