From 6cb0d6236f226e4aaa7d2994f631430c88ea5ba3 Mon Sep 17 00:00:00 2001 From: Dominic <4678790+dweiller@users.noreply.github.com> Date: Sun, 16 Oct 2022 19:19:12 +1100 Subject: [PATCH] glfw: fix native import (#583) Co-authored-by: Ali Chraghi <63465728+alichraghi@users.noreply.github.com> Co-authored-by: dweiller <4678790+dweiller@users.noreplay.github.com> Co-authored-by: Stephen Gutekanst --- libs/glfw/.gitignore | 1 - libs/glfw/src/native.zig | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/libs/glfw/.gitignore b/libs/glfw/.gitignore index 6b117e78..feda423c 100644 --- a/libs/glfw/.gitignore +++ b/libs/glfw/.gitignore @@ -16,4 +16,3 @@ zig-out/ /build/ /build-*/ /docgen_tmp/ -src/c_native.zig diff --git a/libs/glfw/src/native.zig b/libs/glfw/src/native.zig index 04dd6e40..a2efb9fd 100644 --- a/libs/glfw/src/native.zig +++ b/libs/glfw/src/native.zig @@ -40,7 +40,20 @@ pub const BackendOptions = struct { /// The chosen backends must match those the library was compiled for. Failure to do so /// will cause a link-time error. pub fn Native(comptime options: BackendOptions) type { - const native = @import("c_native.zig").import(options); + 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"); + if (options.nsgl) @cDefine("GLFW_EXPOSE_NATIVE_NGSL", "1"); + if (options.x11) @cDefine("GLFW_EXPOSE_NATIVE_X11", "1"); + if (options.glx) @cDefine("GLFW_EXPOSE_NATIVE_GLX", "1"); + 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"); + }); return struct { /// Returns the adapter device name of the specified monitor.