From 2b4b06cf7ba9d7b39f5dc88bbac16b51d005c681 Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Fri, 29 Oct 2021 12:24:40 -0700 Subject: [PATCH] glfw: workaround framework dependency inclusion bug for now Signed-off-by: Stephen Gutekanst --- glfw/build.zig | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/glfw/build.zig b/glfw/build.zig index 85fa4ff3..c3db8820 100644 --- a/glfw/build.zig +++ b/glfw/build.zig @@ -217,12 +217,17 @@ fn linkGLFWDependencies(b: *Builder, step: *std.build.LibExeObjStep, options: Op } // These are dependencies of the above frameworks, but are not properly picked by zld - // when cross-compiling Windows/Linux -> MacOS unless linked explicitly here. - step.linkFramework("CoreGraphics"); - step.linkFramework("CoreServices"); - step.linkFramework("AppKit"); - step.linkFramework("Foundation"); - step.linkSystemLibrary("objc"); + // when cross-compiling Windows/Linux -> MacOS, or on MacOS (no XCode) with `zig build test -Dtarget=aarch64-macos` + // unless linked explicitly here. + // + // If b.sysroot is set, however, these must NOT be specified. This is a bug in zld. + if (b.sysroot == null) { + step.linkFramework("CoreGraphics"); + step.linkFramework("CoreServices"); + step.linkFramework("AppKit"); + step.linkFramework("Foundation"); + step.linkSystemLibrary("objc"); + } }, else => { // Assume Linux-like