From b23691032b69c2cedb0934e5f6ae039869bf38a1 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 19 Apr 2023 14:45:48 -0500 Subject: [PATCH] Fix default architecture for winch (#6242) * Fix default architecture for winch This updates the `winch/codegen/build.rs` script to default to the target architecture being compiled for as opposed to the host architecture that's performing the compile. Closes #6241 * Auto-enable other future architectures --- winch/codegen/build.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/winch/codegen/build.rs b/winch/codegen/build.rs index 9f18db48a0..378ac51732 100644 --- a/winch/codegen/build.rs +++ b/winch/codegen/build.rs @@ -3,10 +3,14 @@ fn main() { return; } - if cfg!(target_arch = "x86_64") { + let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap(); + + if arch == "x86_64" { println!("cargo:rustc-cfg=feature=\"x64\""); - } else if cfg!(target_arch = "aarch64") { + } else if arch == "aarch64" { println!("cargo:rustc-cfg=feature=\"arm64\""); + } else { + println!("cargo:rustc-cfg=feature=\"{arch}\""); } println!("cargo:rerun-if-changed=build.rs"); }