Skip to content

Commit ea3affa

Browse files
ryzechcastholm
authored andcommitted
fixed lazypath for zig 0.13.0 master
1 parent 9eb0e23 commit ea3affa

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

zigglgen-example/build.zig

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub fn build(b: *std.Build) void {
1414

1515
const exe = b.addExecutable(.{
1616
.name = "zigglgen-example",
17-
.root_source_file = .{ .path = "main.zig" },
17+
.root_source_file = b_path(b, "main.zig"),
1818
.target = target,
1919
.optimize = optimize,
2020
});
@@ -28,7 +28,7 @@ pub fn build(b: *std.Build) void {
2828
if (use_gles) {
2929
// Use the vendored OpenGL ES 3.0 bindings.
3030
exe.root_module.addAnonymousImport("gl", .{
31-
.root_source_file = .{ .path = "gles3.zig" },
31+
.root_source_file = b_path(b, "gles3.zig"),
3232
});
3333
} else {
3434
// Generate OpenGL 4.1 bindings at build time.
@@ -59,3 +59,11 @@ pub fn build(b: *std.Build) void {
5959
const update_gles = b.step("update-gles-bindings", "Update 'gles3.zig'");
6060
update_gles.dependOn(&copy_gles.step);
6161
}
62+
63+
// TODO 2024.5.0-mach: Replace with 'b.path'.
64+
fn b_path(b: *std.Build, sub_path: []const u8) std.Build.LazyPath {
65+
return if (@hasDecl(std.Build, "path"))
66+
b.path(sub_path)
67+
else
68+
.{ .path = sub_path };
69+
}

zigglgen/build.zig

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub fn build(b: *std.Build) void {
66

77
const generator = b.addExecutable(.{
88
.name = "zigglgen-generator",
9-
.root_source_file = .{ .path = "generator.zig" },
9+
.root_source_file = b_path(b, "generator.zig"),
1010
.target = target,
1111
.optimize = optimize,
1212
});
@@ -62,3 +62,11 @@ fn thisDependency(b: *std.Build, args: anytype) *std.Build.Dependency {
6262
}
6363
std.debug.panic("zigglgen is not a dependency in '{s}'", .{b.pathFromRoot("build.zig.zon")});
6464
}
65+
66+
// TODO 2024.5.0-mach: Replace with 'b.path'.
67+
fn b_path(b: *std.Build, sub_path: []const u8) std.Build.LazyPath {
68+
return if (@hasDecl(std.Build, "path"))
69+
b.path(sub_path)
70+
else
71+
.{ .path = sub_path };
72+
}

0 commit comments

Comments
 (0)