glfw: workaround macOS zig libc __kernel_ptr_semantics

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2023-06-25 01:12:33 -07:00
parent 07e35d8d4d
commit 148b2fcc6b
3 changed files with 7 additions and 2 deletions

View file

@ -116,6 +116,7 @@ fn buildLibrary(b: *Build, optimize: std.builtin.OptimizeMode, target: std.zig.C
fn addGLFWIncludes(step: *std.build.CompileStep) void {
step.addIncludePath(sdkPath("/upstream/glfw/include"));
step.addIncludePath(sdkPath("/upstream/vulkan_headers/include"));
step.addIncludePath(sdkPath("/src"));
}
fn addGLFWSources(b: *Build, lib: *std.build.CompileStep, options: Options) std.mem.Allocator.Error!void {

5
src/glfw_native.h Normal file
View file

@ -0,0 +1,5 @@
// MacOS: this must be defined for system-sdk-13.3 and older.
#define __kernel_ptr_semantics
#include <GLFW/glfw3.h>
#include <GLFW/glfw3native.h>

View file

@ -40,7 +40,6 @@ pub const BackendOptions = struct {
pub fn Native(comptime options: BackendOptions) type {
const native = @cImport({
@cDefine("GLFW_INCLUDE_VULKAN", "1");
@cInclude("GLFW/glfw3.h");
if (options.win32) @cDefine("GLFW_EXPOSE_NATIVE_WIN32", "1");
if (options.wgl) @cDefine("GLFW_EXPOSE_NATIVE_WGL", "1");
if (options.cocoa) @cDefine("GLFW_EXPOSE_NATIVE_COCOA", "1");
@ -50,7 +49,7 @@ pub fn Native(comptime options: BackendOptions) type {
if (options.wayland) @cDefine("GLFW_EXPOSE_NATIVE_WAYLAND", "1");
if (options.egl) @cDefine("GLFW_EXPOSE_NATIVE_EGL", "1");
if (options.osmesa) @cDefine("GLFW_EXPOSE_NATIVE_OSMESA", "1");
@cInclude("GLFW/glfw3native.h");
@cInclude("glfw_native.h");
});
return struct {