Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Zig 0.14.0-dev.2534+12d64c456 #34

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@ pub fn build(b: *std.Build) void {
const use_gles = b.option(bool, "gles", "Build with GLES; not supported on MacOS") orelse false;
const use_metal = b.option(bool, "metal", "Build with Metal; only supported on MacOS") orelse true;

const lib = std.Build.Step.Compile.create(b, .{
.name = "glfw",
.kind = .lib,
.linkage = if (shared) .dynamic else .static,
.root_module = .{
const lib: *std.Build.Step.Compile = switch (shared) {
inline else => |x| switch (x) {
false => std.Build.addStaticLibrary,
true => std.Build.addSharedLibrary,
}(b, .{
.name = "glfw",
.target = target,
.optimize = optimize,
},
});
}),
};
lib.addIncludePath(b.path("include"));
lib.linkLibC();

if (shared) lib.defineCMacro("_GLFW_BUILD_DLL", "1");
if (shared) lib.root_module.addCMacro("_GLFW_BUILD_DLL", "1");

lib.installHeadersDirectory(b.path("include/GLFW"), "GLFW", .{});
// GLFW headers depend on these headers, so they must be distributed too.
Expand Down Expand Up @@ -53,7 +54,7 @@ pub fn build(b: *std.Build) void {

if (target.result.isDarwin()) {
// MacOS: this must be defined for macOS 13.3 and older.
lib.defineCMacro("__kernel_ptr_semantics", "");
lib.root_module.addCMacro("__kernel_ptr_semantics", "");

if (b.lazyDependency("xcode_frameworks", .{
.target = target,
Expand Down Expand Up @@ -142,7 +143,7 @@ pub fn build(b: *std.Build) void {
}

if (use_wl) {
lib.defineCMacro("WL_MARSHAL_FLAG_DESTROY", "1");
lib.root_module.addCMacro("WL_MARSHAL_FLAG_DESTROY", "1");

sources.appendSlice(&linux_wl_sources) catch unreachable;
flags.append("-D_GLFW_WAYLAND") catch unreachable;
Expand Down
Loading