glfw: system_sdk: use addIncludeDir over addSystemIncludeDir

Since we're not specifying a sysroot by default (as that prevents
making use of other libraries/headers on your system, if you wish to)
we can have conflicts with either the headers on your system or the
headers Zig itself ships (although that shouldn't happen, except for
cases like Windows where we ship more up-to-date DirectX headers.)

System include dirs are treated with the same relative priority as other
system include dirs, those actually on your system and the ones Zig
provides. But regular include dirs are given higher priority, and so
should give our headers a better chance of being included in the event
that there should be any conflict.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-03-06 01:52:59 -07:00
parent 98e9fe0e0c
commit 5f382f9365

View file

@ -77,7 +77,7 @@ fn includeSdkMacOS(b: *Builder, step: *std.build.LibExeObjStep, options: Options
if (options.set_sysroot) { if (options.set_sysroot) {
step.addFrameworkDir("/System/Library/Frameworks"); step.addFrameworkDir("/System/Library/Frameworks");
step.addSystemIncludeDir("/usr/include"); step.addIncludeDir("/usr/include");
step.addLibPath("/usr/lib"); step.addLibPath("/usr/lib");
var sdk_sysroot = std.fs.path.join(b.allocator, &.{ sdk_root_dir, "root/" }) catch unreachable; var sdk_sysroot = std.fs.path.join(b.allocator, &.{ sdk_root_dir, "root/" }) catch unreachable;
@ -89,7 +89,7 @@ fn includeSdkMacOS(b: *Builder, step: *std.build.LibExeObjStep, options: Options
step.addFrameworkDir(sdk_framework_dir); step.addFrameworkDir(sdk_framework_dir);
var sdk_include_dir = std.fs.path.join(b.allocator, &.{ sdk_root_dir, "root/usr/include" }) catch unreachable; var sdk_include_dir = std.fs.path.join(b.allocator, &.{ sdk_root_dir, "root/usr/include" }) catch unreachable;
step.addSystemIncludeDir(sdk_include_dir); step.addIncludeDir(sdk_include_dir);
var sdk_lib_dir = std.fs.path.join(b.allocator, &.{ sdk_root_dir, "root/usr/lib" }) catch unreachable; var sdk_lib_dir = std.fs.path.join(b.allocator, &.{ sdk_root_dir, "root/usr/lib" }) catch unreachable;
step.addLibPath(sdk_lib_dir); step.addLibPath(sdk_lib_dir);
@ -112,8 +112,8 @@ fn includeSdkLinuxX8664(b: *Builder, step: *std.build.LibExeObjStep, options: Op
b.allocator.free(wayland_protocols_include); b.allocator.free(wayland_protocols_include);
b.allocator.free(sdk_root_libs); b.allocator.free(sdk_root_libs);
} }
step.addSystemIncludeDir(sdk_root_includes); step.addIncludeDir(sdk_root_includes);
step.addSystemIncludeDir(wayland_protocols_include); step.addIncludeDir(wayland_protocols_include);
step.addLibPath(sdk_root_libs); step.addLibPath(sdk_root_libs);
} }