@@ -48,6 +48,30 @@ pub fn build(b: *std.Build) !void {
48
48
});
49
49
}
50
50
51
+ pub fn activateSdk (b : * std.Build , zwindows : * std.Build.Dependency ) * std.Build.Step {
52
+ const step = b .allocator .create (std .Build .Step ) catch unreachable ;
53
+ step .* = std .Build .Step .init (.{
54
+ .id = .custom ,
55
+ .name = "Activate zwindows" ,
56
+ .owner = b ,
57
+ .makeFn = & struct {
58
+ fn make (_ : * std.Build.Step , _ : std.Build.Step.MakeOptions ) anyerror ! void {}
59
+ }.make ,
60
+ });
61
+ switch (builtin .target .os .tag ) {
62
+ .windows = > {
63
+ const dxc_path = zwindows .path ("bin/x64/dxc.exe" ).getPath (b );
64
+ step .dependOn (& b .addSystemCommand (&.{ "takeown" , "/f" , dxc_path }).step );
65
+ },
66
+ .linux = > {
67
+ const dxc_path = zwindows .path ("bin/x64/dxc" ).getPath (b );
68
+ step .dependOn (& b .addSystemCommand (&.{ "chmod" , "+x" , dxc_path }).step );
69
+ },
70
+ else = > @panic ("Unsupported host OS." ),
71
+ }
72
+ return step ;
73
+ }
74
+
51
75
pub fn install_xaudio2 (
52
76
step : * std.Build.Step ,
53
77
zwindows : * std.Build.Dependency ,
@@ -203,7 +227,7 @@ pub const CompileShaders = struct {
203
227
const dxc_path = switch (builtin .target .os .tag ) {
204
228
.windows = > self .zwindows .path ("bin/x64/dxc.exe" ).getPath (b ),
205
229
.linux = > self .zwindows .path ("bin/x64/dxc" ).getPath (b ),
206
- else = > @panic ("Unsupported target " ),
230
+ else = > @panic ("Unsupported host OS. " ),
207
231
};
208
232
209
233
const dxc_command = [9 ][]const u8 {
@@ -236,26 +260,8 @@ pub fn addCompileShaders(
236
260
zwindows : * std.Build.Dependency ,
237
261
options : struct { shader_ver : []const u8 },
238
262
) 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
- .windows = > {
248
- const takeown = b .addSystemCommand (&.{ "takeown" , "/f" , dxc_path });
249
- build_shaders .dependOn (& takeown .step );
250
- },
251
- else = > {
252
- const chmod = b .addSystemCommand (&.{ "chmod" , "+x" , dxc_path });
253
- build_shaders .dependOn (& chmod .step );
254
- },
255
- }
256
-
257
263
return .{
258
- .step = build_shaders ,
264
+ .step = b . step ( name ++ "-dxc" , "Build shaders for '" ++ name ++ "'" ) ,
259
265
.zwindows = zwindows ,
260
266
.shader_ver = options .shader_ver ,
261
267
};
0 commit comments