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

Fix #3891 breaking builds for Zig v0.11.0 #3896

Merged
merged 1 commit into from
Apr 5, 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
41 changes: 23 additions & 18 deletions src/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ pub fn build(b: *std.Build) !void {
.rshapes = b.option(bool, "rshapes", "Compile with shapes support") orelse defaults.rshapes,
.raygui = b.option(bool, "raygui", "Compile with raygui support") orelse defaults.raygui,
.shared = b.option(bool, "shared", "Compile as shared library") orelse defaults.shared,
.linux_display_backend = b.option(LinuxDisplayBackend, "linux_display_backend", "Linux display backend to use") orelse defaults.linux_display_backend,
};

const lib = try addRaylib(b, target, optimize, options);
Expand Down Expand Up @@ -306,24 +307,28 @@ fn addCSourceFilesVersioned(
}

fn waylandGenerate(allocator: std.mem.Allocator, comptime protocol: []const u8, comptime basename: []const u8) !void {
_ = try std.process.Child.run(.{
.allocator = allocator,
.argv = &[_][]const u8{
"wayland-scanner",
"client-header",
waylandDir ++ "/" ++ protocol,
srcdir ++ "/" ++ basename ++ ".h",
},
});
_ = try std.process.Child.run(.{
.allocator = allocator,
.argv = &[_][]const u8{
"wayland-scanner",
"private-code",
waylandDir ++ "/" ++ protocol,
srcdir ++ "/" ++ basename ++ "-code.h",
},
});
const protocolDir = waylandDir ++ "/" ++ protocol;
const clientHeader = srcdir ++ "/" ++ basename ++ ".h";
const privateCode = srcdir ++ "/" ++ basename ++ "-code.h";
if (comptime builtin.zig_version.minor >= 12) {
_ = try std.process.Child.run(.{
.allocator = allocator,
.argv = &[_][]const u8{ "wayland-scanner", "client-header", protocolDir, clientHeader },
});
_ = try std.process.Child.run(.{
.allocator = allocator,
.argv = &[_][]const u8{ "wayland-scanner", "private-code", protocolDir, privateCode },
});
} else {
_ = try std.process.Child.exec(.{
.allocator = allocator,
.argv = &[_][]const u8{ "wayland-scanner", "client-header", protocolDir, clientHeader },
});
_ = try std.process.Child.exec(.{
.allocator = allocator,
.argv = &[_][]const u8{ "wayland-scanner", "private-code", protocolDir, privateCode },
});
}
}

fn join2(allocator: std.mem.Allocator, path1: []const u8, path2: []const u8) ![]u8 {
Expand Down