all: employ self-hosted @cImport hack only on Darwin targets

This is an poor approximation for the host OS running Darwin, which
is good enough for now. In practice this means macOS works but can't
cross-compile (until the cImport issue is fixed in Zig itself), but
Windows/Linux are unaffected and should be able to build natively and
cross-compile.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-08-27 11:19:57 -07:00
parent 15463ed05a
commit f55bf99053
2 changed files with 2 additions and 2 deletions

View file

@ -1,4 +1,4 @@
pub const c = if (@import("builtin").zig_backend == .stage1)
pub const c = if (@import("builtin").zig_backend == .stage1 or !@import("builtin").target.isDarwin())
@cImport({
@cDefine("GLFW_INCLUDE_VULKAN", "1");
@cInclude("GLFW/glfw3.h");

View file

@ -40,7 +40,7 @@ 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 = if (@import("builtin").zig_backend == .stage1)
const native = if (@import("builtin").zig_backend == .stage1 or !@import("builtin").target.isDarwin())
@cImport({
@cDefine("GLFW_INCLUDE_VULKAN", "1");
@cInclude("GLFW/glfw3.h");