Skip to content

Commit

Permalink
Merge branch 'arm-only-enable-neon-if-in-features'
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed May 30, 2024
2 parents 414ca0a + cf9e1ab commit 50dfd55
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion zng/cc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ pub fn build_zlib_ng(target: &str, compat: bool) {

let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
let arch = env::var("CARGO_CFG_TARGET_ARCH").expect("failed to retrieve target arch");
let features = env::var("CARGO_CFG_TARGET_FEATURE").unwrap();

let is_linux_or_android = matches!(target_os.as_str(), "linux" | "android");
if is_linux_or_android {
Expand Down Expand Up @@ -311,7 +312,11 @@ pub fn build_zlib_ng(target: &str, compat: bool) {
}

// neon
cfg.define("ARM_NEON", None);
// Fix armv7-unknown-linux-musleabi and arm-unknown-linux-musleabi by only
// passing in ARM_NEON if that target is enabled.
if features.split(",").any(|name| name == "neon") {
cfg.define("ARM_NEON", None);
}

// NOTE: These intrinsics were only added in gcc 9.4, which is _relatively_
// recent, and if the define is not set zlib-ng just provides its
Expand Down

0 comments on commit 50dfd55

Please sign in to comment.