aboutsummaryrefslogtreecommitdiff
path: root/build.rs
diff options
context:
space:
mode:
authorrsdy <[email protected]>2021-10-07 12:23:36 +0100
committerrsdy <[email protected]>2021-10-07 12:41:53 +0100
commit0a0bb7126e9207d3bb3d9af0f0b5ae646d532cf2 (patch)
tree60a4c85dcc6a705a1ab03580fd401a183fcfd3f8 /build.rs
parentdb436a50c2385550e7a0d54b24c7c6b47a6ca037 (diff)
Implement better target detection for NEON
Diffstat (limited to 'build.rs')
-rw-r--r--build.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/build.rs b/build.rs
index 4fd3bae..c5677f6 100644
--- a/build.rs
+++ b/build.rs
@@ -44,6 +44,14 @@ fn is_x86_32() -> bool {
arch == "i386" || arch == "i586" || arch == "i686"
}
+fn is_arm() -> bool {
+ is_armv7() || is_aarch64() || target_components()[0] == "arm"
+}
+
+fn is_aarch64() -> bool {
+ target_components()[0] == "aarch64"
+}
+
fn is_armv7() -> bool {
target_components()[0] == "armv7"
}
@@ -237,7 +245,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}
}
- if is_neon() {
+ if (is_arm() && is_neon()) || (is_aarch64() && !is_pure()) {
+ println!("cargo:rustc-cfg=blake3_neon");
build_neon_c_intrinsics();
}