glfw: do not set sysroot (prevents linking libs not in our system SDKs) (#47)
* glfw: do not set sysroot (prevents linking libs not in our system SDKs) Fixes hexops/mach#40 Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
8466a5ff08
commit
3d38f56af6
1 changed files with 17 additions and 10 deletions
|
|
@ -215,6 +215,14 @@ fn linkGLFWDependencies(b: *Builder, step: *std.build.LibExeObjStep, options: Op
|
|||
if (options.opengl) {
|
||||
step.linkFramework("OpenGL");
|
||||
}
|
||||
|
||||
// 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");
|
||||
},
|
||||
else => {
|
||||
// Assume Linux-like
|
||||
|
|
@ -241,17 +249,16 @@ fn linkGLFWDependencies(b: *Builder, step: *std.build.LibExeObjStep, options: Op
|
|||
}
|
||||
|
||||
fn includeSdkMacOS(b: *Builder, step: *std.build.LibExeObjStep) void {
|
||||
step.addFrameworkDir("/System/Library/Frameworks");
|
||||
step.addSystemIncludeDir("/usr/include");
|
||||
step.addLibPath("/usr/lib");
|
||||
|
||||
// Add the SDK as a sysroot. Using this instead of, say, absolute framework/include/lib paths
|
||||
// to the SDK without a sysroot ensures that we use the same libraries/frameworks/headers on
|
||||
// Mac hosts and non-Mac hosts.
|
||||
const sdk_root_dir = getSdkRoot(b.allocator, "sdk-macos-11.3") catch unreachable;
|
||||
defer b.allocator.free(sdk_root_dir);
|
||||
var sdk_sysroot = std.fs.path.join(b.allocator, &.{ sdk_root_dir, "root/" }) catch unreachable;
|
||||
b.sysroot = sdk_sysroot;
|
||||
|
||||
var sdk_framework_dir = std.fs.path.join(b.allocator, &.{ sdk_root_dir, "root/System/Library/Frameworks" }) catch unreachable;
|
||||
step.addFrameworkDir(sdk_framework_dir);
|
||||
|
||||
var sdk_include_dir = std.fs.path.join(b.allocator, &.{ sdk_root_dir, "root/usr/include" }) catch unreachable;
|
||||
step.addSystemIncludeDir(sdk_include_dir);
|
||||
|
||||
var sdk_lib_dir = std.fs.path.join(b.allocator, &.{ sdk_root_dir, "root/usr/lib" }) catch unreachable;
|
||||
step.addLibPath(sdk_lib_dir);
|
||||
}
|
||||
|
||||
fn includeSdkLinuxX8664(b: *Builder, step: *std.build.LibExeObjStep) void {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue