From 35e1fdf5dad8e14d1df44d7d206dbf0d1d94d07b Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sun, 13 Nov 2022 20:50:27 +0100 Subject: [PATCH] Zig build: enable ARM Crypto --- build.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build.zig b/build.zig index 20a31d37..faa019d8 100644 --- a/build.zig +++ b/build.zig @@ -54,7 +54,12 @@ pub fn build(b: *std.build.Builder) !void { lib.defineCMacro("HAVE_PMMINTRIN_H", "1"); }, .aarch64, .aarch64_be => { - lib.defineCMacro("HAVE_ARMCRYTO", "1"); + const cpu_features = target.getCpuFeatures(); + const has_neon = cpu_features.isEnabled(@enumToInt(std.Target.aarch64.Feature.neon)); + const has_crypto = cpu_features.isEnabled(@enumToInt(std.Target.aarch64.Feature.crypto)); + if (has_neon and has_crypto) { + lib.defineCMacro("HAVE_ARMCRYPTO", "1"); + } }, .wasm32, .wasm64 => { lib.defineCMacro("__wasm__", "1");