@@ -12,13 +12,13 @@ pub fn install_xaudio2(
12
12
install_dir : std.Build.InstallDir ,
13
13
) void {
14
14
const b = step .owner ;
15
- const source_path_prefix = comptime std .fs .path .dirname (@src ().file ) orelse "." ;
16
15
step .dependOn (
17
16
& b .addInstallFileWithDir (
18
17
.{
19
- .cwd_relative = b .pathJoin (
20
- &.{ source_path_prefix , "bin/x64/xaudio2_9redist.dll" },
21
- ),
18
+ .dependency = .{
19
+ .dependency = b .dependency ("zwin32" , .{}),
20
+ .sub_path = "bin/x64/xaudio2_9redist.dll" ,
21
+ },
22
22
},
23
23
install_dir ,
24
24
"xaudio2_9redist.dll" ,
@@ -31,13 +31,14 @@ pub fn install_d3d12(
31
31
install_dir : std.Build.InstallDir ,
32
32
) void {
33
33
const b = step .owner ;
34
- const source_path_prefix = comptime std . fs . path . dirname ( @src (). file ) orelse "." ;
34
+ const zwin32 = b . dependency ( "zwin32" , .{}) ;
35
35
step .dependOn (
36
36
& b .addInstallFileWithDir (
37
37
.{
38
- .cwd_relative = b .pathJoin (
39
- &.{ source_path_prefix , "bin/x64/D3D12Core.dll" },
40
- ),
38
+ .dependency = .{
39
+ .dependency = zwin32 ,
40
+ .sub_path = "bin/x64/D3D12Core.dll" ,
41
+ },
41
42
},
42
43
install_dir ,
43
44
"d3d12/D3D12Core.dll" ,
@@ -46,9 +47,10 @@ pub fn install_d3d12(
46
47
step .dependOn (
47
48
& b .addInstallFileWithDir (
48
49
.{
49
- .cwd_relative = b .pathJoin (
50
- &.{ source_path_prefix , "bin/x64/D3D12SDKLayers.dll" },
51
- ),
50
+ .dependency = .{
51
+ .dependency = zwin32 ,
52
+ .sub_path = "bin/x64/D3D12SDKLayers.dll" ,
53
+ },
52
54
},
53
55
install_dir ,
54
56
"d3d12/D3D12SDKLayers.dll" ,
@@ -61,13 +63,13 @@ pub fn install_directml(
61
63
install_dir : std.Build.InstallDir ,
62
64
) void {
63
65
const b = step .owner ;
64
- const source_path_prefix = comptime std .fs .path .dirname (@src ().file ) orelse "." ;
65
66
step .dependOn (
66
67
& b .addInstallFileWithDir (
67
68
.{
68
- .cwd_relative = b .pathJoin (
69
- &.{ source_path_prefix , "bin/x64/DirectML.dll" },
70
- ),
69
+ .dependency = .{
70
+ .dependency = b .dependency ("zwin32" , .{}),
71
+ .sub_path = "bin/x64/DirectML.dll" ,
72
+ },
71
73
},
72
74
install_dir ,
73
75
"DirectML.dll" ,
@@ -76,9 +78,10 @@ pub fn install_directml(
76
78
step .dependOn (
77
79
& b .addInstallFileWithDir (
78
80
.{
79
- .cwd_relative = b .pathJoin (
80
- &.{ source_path_prefix , "bin/x64/DirectML.Debug.dll" },
81
- ),
81
+ .dependency = .{
82
+ .dependency = b .dependency ("zwin32" , .{}),
83
+ .sub_path = "bin/x64/DirectML.Debug.dll" ,
84
+ },
82
85
},
83
86
install_dir ,
84
87
"DirectML.Debug.dll" ,
@@ -163,10 +166,11 @@ pub const CompileShaders = struct {
163
166
) void {
164
167
const b = self .step .owner ;
165
168
166
- const zwin32_path = comptime std .fs .path .dirname (@src ().file ) orelse "." ;
169
+ const zwin32 = b .dependency ("zwin32" , .{});
170
+
167
171
const dxc_path = switch (builtin .target .os .tag ) {
168
- .windows = > zwin32_path ++ "/ bin/x64/dxc.exe" ,
169
- .linux = > zwin32_path ++ "/ bin/x64/dxc" ,
172
+ .windows = > zwin32 . path ( " bin/x64/dxc.exe"). getPath ( b ) ,
173
+ .linux = > zwin32 . path ( " bin/x64/dxc"). getPath ( b ) ,
170
174
else = > @panic ("Unsupported target" ),
171
175
};
172
176
@@ -184,10 +188,7 @@ pub const CompileShaders = struct {
184
188
185
189
const cmd_step = b .addSystemCommand (& dxc_command );
186
190
if (builtin .target .os .tag == .linux ) {
187
- cmd_step .setEnvironmentVariable (
188
- "LD_LIBRARY_PATH" ,
189
- zwin32_path ++ "/bin/x64" ,
190
- );
191
+ cmd_step .setEnvironmentVariable ("LD_LIBRARY_PATH" , zwin32 .path ("bin/x64" ).getPath (b ));
191
192
}
192
193
self .step .dependOn (& cmd_step .step );
193
194
}
0 commit comments