1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-20 02:25:14 -07:00

Zig build: enable ARM Crypto

This commit is contained in:
Frank Denis 2022-11-13 20:50:27 +01:00
parent fd5cbe9e69
commit 35e1fdf5da

View File

@ -54,7 +54,12 @@ pub fn build(b: *std.build.Builder) !void {
lib.defineCMacro("HAVE_PMMINTRIN_H", "1"); lib.defineCMacro("HAVE_PMMINTRIN_H", "1");
}, },
.aarch64, .aarch64_be => { .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 => { .wasm32, .wasm64 => {
lib.defineCMacro("__wasm__", "1"); lib.defineCMacro("__wasm__", "1");