From 7ece55475332deddc22d9e004979d1e98d065189 Mon Sep 17 00:00:00 2001 From: Gabor Lekeny Date: Wed, 13 Nov 2024 11:40:03 +0100 Subject: [PATCH] NO-JIRA: Fix build for library users Do not quit if the CPU and ABI does not match with the required ones, because the IDE will not recognize the referenced modules on other architectures (like Apple silicon). --- build.zig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build.zig b/build.zig index 0b797ce..2603c50 100644 --- a/build.zig +++ b/build.zig @@ -1,10 +1,12 @@ const std = @import("std"); +const log = std.log.scoped(.aeron); + pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); - if (target.result.cpu.arch != .x86_64) @panic("The target CPU architecture needs to be 'x86_64'"); + if (target.result.cpu.arch != .x86_64) log.err("The target CPU architecture needs to be 'x86_64': {s}", .{@tagName(target.result.cpu.arch)}); const options = b.addOptions(); const dynamic = b.option(bool, "dynamic", "link with dynamic library (default: false)") orelse false; @@ -20,6 +22,6 @@ pub fn build(b: *std.Build) void { switch (target.result.abi) { .gnu => lib.linkSystemLibrary(if (dynamic) "aeron_libc" else "aeron_static_libc", .{}), .musl => lib.linkSystemLibrary(if (dynamic) "aeron_musl" else "aeron_static_musl", .{}), - else => @panic("The target ABI needs to be 'musl' or 'gnu'"), + else => |abi| log.err("The target ABI needs to be 'musl' or 'gnu': {s}", .{@tagName(abi)}), } }