1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-19 10:05:05 -07:00

Zig build: enable ARM Crypto

This commit is contained in:
Frank Denis 2022-11-13 20:50:27 +01:00
parent f3cf71edd7
commit 77c676a9e1

View File

@ -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");