From 5f382f93658585d176bff75672412e4c57aa2f17 Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Sun, 6 Mar 2022 01:52:59 -0700 Subject: [PATCH] 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 --- glfw/system_sdk.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/glfw/system_sdk.zig b/glfw/system_sdk.zig index 76e8575d..53357b19 100644 --- a/glfw/system_sdk.zig +++ b/glfw/system_sdk.zig @@ -77,7 +77,7 @@ fn includeSdkMacOS(b: *Builder, step: *std.build.LibExeObjStep, options: Options if (options.set_sysroot) { step.addFrameworkDir("/System/Library/Frameworks"); - step.addSystemIncludeDir("/usr/include"); + step.addIncludeDir("/usr/include"); step.addLibPath("/usr/lib"); 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); 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; 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(sdk_root_libs); } - step.addSystemIncludeDir(sdk_root_includes); - step.addSystemIncludeDir(wayland_protocols_include); + step.addIncludeDir(sdk_root_includes); + step.addIncludeDir(wayland_protocols_include); step.addLibPath(sdk_root_libs); }