Skip to content

Commit 48433ca

Browse files
committed
chmod once for all shaders in build step
1 parent 299833b commit 48433ca

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

build.zig

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ pub fn build(b: *std.Build) !void {
4545
.{ .name = "options", .module = options_module },
4646
.{ .name = "zwindows", .module = zwindows_module },
4747
},
48-
4948
});
5049
}
5150

@@ -226,14 +225,6 @@ pub const CompileShaders = struct {
226225
self.zwindows.path("bin/x64").getPath(b),
227226
);
228227
}
229-
230-
switch (builtin.target.os.tag) {
231-
.linux, .macos => {
232-
const chmod = b.addSystemCommand(&.{ "chmod", "+x", dxc_path });
233-
cmd_step.step.dependOn(&chmod.step);
234-
},
235-
else => {},
236-
}
237228

238229
self.step.dependOn(&cmd_step.step);
239230
}
@@ -245,8 +236,23 @@ pub fn addCompileShaders(
245236
zwindows: *std.Build.Dependency,
246237
options: struct { shader_ver: []const u8 },
247238
) CompileShaders {
239+
const build_shaders = b.step(name ++ "-dxc", "Build shaders for '" ++ name ++ "'");
240+
241+
const dxc_path = switch (builtin.target.os.tag) {
242+
.windows => zwindows.path("bin/x64/dxc.exe").getPath(b),
243+
.linux => zwindows.path("bin/x64/dxc").getPath(b),
244+
else => @panic("Unsupported target"),
245+
};
246+
switch (builtin.target.os.tag) {
247+
.linux, .macos => {
248+
const chmod = b.addSystemCommand(&.{ "chmod", "+x", dxc_path });
249+
build_shaders.dependOn(&chmod.step);
250+
},
251+
else => {},
252+
}
253+
248254
return .{
249-
.step = b.step(name ++ "-dxc", "Build shaders for '" ++ name ++ "'"),
255+
.step = build_shaders,
250256
.zwindows = zwindows,
251257
.shader_ver = options.shader_ver,
252258
};

0 commit comments

Comments
 (0)