File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ pub fn build(b: *std.Build) void {
14
14
15
15
const exe = b .addExecutable (.{
16
16
.name = "zigglgen-example" ,
17
- .root_source_file = .{ . path = "main.zig" } ,
17
+ .root_source_file = b_path ( b , "main.zig" ) ,
18
18
.target = target ,
19
19
.optimize = optimize ,
20
20
});
@@ -28,7 +28,7 @@ pub fn build(b: *std.Build) void {
28
28
if (use_gles ) {
29
29
// Use the vendored OpenGL ES 3.0 bindings.
30
30
exe .root_module .addAnonymousImport ("gl" , .{
31
- .root_source_file = .{ . path = "gles3.zig" } ,
31
+ .root_source_file = b_path ( b , "gles3.zig" ) ,
32
32
});
33
33
} else {
34
34
// Generate OpenGL 4.1 bindings at build time.
@@ -59,3 +59,11 @@ pub fn build(b: *std.Build) void {
59
59
const update_gles = b .step ("update-gles-bindings" , "Update 'gles3.zig'" );
60
60
update_gles .dependOn (& copy_gles .step );
61
61
}
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
+ }
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ pub fn build(b: *std.Build) void {
6
6
7
7
const generator = b .addExecutable (.{
8
8
.name = "zigglgen-generator" ,
9
- .root_source_file = .{ . path = "generator.zig" } ,
9
+ .root_source_file = b_path ( b , "generator.zig" ) ,
10
10
.target = target ,
11
11
.optimize = optimize ,
12
12
});
@@ -62,3 +62,11 @@ fn thisDependency(b: *std.Build, args: anytype) *std.Build.Dependency {
62
62
}
63
63
std .debug .panic ("zigglgen is not a dependency in '{s}'" , .{b .pathFromRoot ("build.zig.zon" )});
64
64
}
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
+ }
You can’t perform that action at this time.
0 commit comments