From 6c05a64bfe0e8d23ee24f03df1b69bbcc836d2f9 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Thu, 2 Nov 2023 06:51:29 +0100 Subject: [PATCH] Zig 0.12 compat --- build.zig | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/build.zig b/build.zig index b538da74..6296b4c5 100644 --- a/build.zig +++ b/build.zig @@ -103,9 +103,17 @@ pub fn build(b: *std.build.Builder) !void { lib.defineCMacro("HAVE_TI_MODE", "1"); if (target.cpu_arch) |arch| { - switch (arch.endian()) { - .Big => lib.defineCMacro("NATIVE_BIG_ENDIAN", "1"), - .Little => lib.defineCMacro("NATIVE_LITTLE_ENDIAN", "1"), + const endian = arch.endian(); + if (@hasField(@TypeOf(endian), "big")) { + switch (endian) { + .big => lib.defineCMacro("NATIVE_BIG_ENDIAN", "1"), + .little => lib.defineCMacro("NATIVE_LITTLE_ENDIAN", "1"), + } + } else { + switch (endian) { + .Big => lib.defineCMacro("NATIVE_BIG_ENDIAN", "1"), + .Little => lib.defineCMacro("NATIVE_LITTLE_ENDIAN", "1"), + } } }