Skip to content

Commit cece620

Browse files
committed
zwin32: change test to comptime check
Also cleanup of redundent specification of dependency target option
1 parent 2f34c19 commit cece620

File tree

22 files changed

+22
-117
lines changed

22 files changed

+22
-117
lines changed

build.zig

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ pub fn build(b: *std.Build) void {
8383
{ // Tests
8484
const test_step = b.step("test", "Run all tests");
8585
tests(b, target, optimize, test_step);
86-
if (builtin.os.tag == .windows) {
87-
testsWindows(b, target, optimize, test_step);
88-
}
8986
}
9087

9188
{ // Benchmarks
@@ -308,19 +305,6 @@ fn tests(
308305
test_step.dependOn(&b.addRunArtifact(ztracy.artifact("ztracy-tests")).step);
309306
}
310307

311-
fn testsWindows(
312-
b: *std.Build,
313-
target: std.Build.ResolvedTarget,
314-
optimize: std.builtin.OptimizeMode,
315-
test_step: *std.Build.Step,
316-
) void {
317-
const zwin32 = b.dependency("zwin32", .{
318-
.target = target,
319-
.optimize = optimize,
320-
});
321-
test_step.dependOn(&b.addRunArtifact(zwin32.artifact("zwin32-tests")).step);
322-
}
323-
324308
// TODO: Delete this once Zig checks minimum_zig_version in build.zig.zon
325309
fn ensureZigVersion() !void {
326310
var installed_ver = builtin.zig_version;

libs/zd3d12/build.zig

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ const std = @import("std");
33
const default_upload_heap_capacity: u32 = 32 * 1024 * 1024;
44

55
pub fn build(b: *std.Build) void {
6-
const target = b.standardTargetOptions(.{});
7-
86
const options = .{
97
.debug_layer = b.option(
108
bool,
@@ -31,9 +29,7 @@ pub fn build(b: *std.Build) void {
3129

3230
const options_module = options_step.createModule();
3331

34-
const zwin32 = b.dependency("zwin32", .{
35-
.target = target,
36-
});
32+
const zwin32 = b.dependency("zwin32", .{});
3733
const zwin32_module = zwin32.module("root");
3834

3935
_ = b.addModule("root", .{

libs/zopenvr/build.zig

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
const std = @import("std");
22

33
pub fn build(b: *std.Build) void {
4-
const target = b.standardTargetOptions(.{});
5-
6-
const zwin32 = b.dependency("zwin32", .{
7-
.target = target,
8-
});
4+
const zwin32 = b.dependency("zwin32", .{});
95
_ = b.addModule("root", .{
106
.root_source_file = b.path("src/openvr.zig"),
117
.imports = &.{

libs/zwin32/build.zig

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,9 @@ const std = @import("std");
22
const builtin = @import("builtin");
33

44
pub fn build(b: *std.Build) !void {
5-
const optimize = b.standardOptimizeOption(.{});
6-
const target = b.standardTargetOptions(.{});
7-
85
_ = b.addModule("root", .{
96
.root_source_file = b.path("src/zwin32.zig"),
107
});
11-
12-
const test_step = b.step("test", "Run zwin32 tests");
13-
14-
const tests = b.addTest(.{
15-
.name = "zwin32-tests",
16-
.root_source_file = b.path("src/zwin32.zig"),
17-
.target = target,
18-
.optimize = optimize,
19-
});
20-
21-
b.installArtifact(tests);
22-
23-
test_step.dependOn(&b.addRunArtifact(tests).step);
248
}
259

2610
pub fn install_xaudio2(

libs/zwin32/src/zwin32.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub const xinput = @import("xinput.zig");
1919
pub const dds_loader = @import("dds_loader.zig");
2020
pub const d3dcompiler = @import("d3dcompiler.zig");
2121

22-
test {
22+
comptime {
2323
std.testing.refAllDeclsRecursive(@This());
2424
}
2525

libs/zxaudio2/build.zig

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
const std = @import("std");
22

33
pub fn build(b: *std.Build) void {
4-
const target = b.standardTargetOptions(.{});
5-
64
const options = .{
75
.debug_layer = b.option(bool, "debug_layer", "Enables debug layer") orelse false,
86
};
@@ -14,9 +12,7 @@ pub fn build(b: *std.Build) void {
1412

1513
const options_module = options_step.createModule();
1614

17-
const zwin32 = b.dependency("zwin32", .{
18-
.target = target,
19-
});
15+
const zwin32 = b.dependency("zwin32", .{});
2016

2117
_ = b.addModule("root", .{
2218
.root_source_file = b.path("src/zxaudio2.zig"),

samples/audio_experiments/build.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,11 @@ pub fn build(b: *std.Build, options: anytype) *std.Build.Step.Compile {
3232
});
3333
exe.root_module.addImport("zxaudio2", zxaudio2.module("root"));
3434

35-
const zwin32 = b.dependency("zwin32", .{
36-
.target = options.target,
37-
});
35+
const zwin32 = b.dependency("zwin32", .{});
3836
const zwin32_module = zwin32.module("root");
3937
exe.root_module.addImport("zwin32", zwin32_module);
4038

4139
const zd3d12 = b.dependency("zd3d12", .{
42-
.target = options.target,
4340
.debug_layer = options.zd3d12_enable_debug_layer,
4441
.gbv = options.zd3d12_enable_gbv,
4542
});

samples/audio_playback_test/build.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,11 @@ pub fn build(b: *std.Build, options: anytype) *std.Build.Step.Compile {
2121

2222
@import("system_sdk").addLibraryPathsTo(exe);
2323

24-
const zwin32 = b.dependency("zwin32", .{
25-
.target = options.target,
26-
});
24+
const zwin32 = b.dependency("zwin32", .{});
2725
const zwin32_module = zwin32.module("root");
2826
exe.root_module.addImport("zwin32", zwin32_module);
2927

3028
const zd3d12 = b.dependency("zd3d12", .{
31-
.target = options.target,
3229
.debug_layer = options.zd3d12_enable_debug_layer,
3330
.gbv = options.zd3d12_enable_gbv,
3431
});

samples/bindless/build.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,11 @@ pub fn build(b: *std.Build, options: anytype) *std.Build.Step.Compile {
3333
exe.root_module.addImport("zstbi", zstbi.module("root"));
3434
exe.linkLibrary(zstbi.artifact("zstbi"));
3535

36-
const zwin32 = b.dependency("zwin32", .{
37-
.target = options.target,
38-
});
36+
const zwin32 = b.dependency("zwin32", .{});
3937
const zwin32_module = zwin32.module("root");
4038
exe.root_module.addImport("zwin32", zwin32_module);
4139

4240
const zd3d12 = b.dependency("zd3d12", .{
43-
.target = options.target,
4441
.debug_layer = options.zd3d12_enable_debug_layer,
4542
.gbv = options.zd3d12_enable_gbv,
4643
});

samples/directml_convolution_test/build.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,11 @@ pub fn build(b: *std.Build, options: anytype) *std.Build.Step.Compile {
2020

2121
@import("system_sdk").addLibraryPathsTo(exe);
2222

23-
const zwin32 = b.dependency("zwin32", .{
24-
.target = options.target,
25-
});
23+
const zwin32 = b.dependency("zwin32", .{});
2624
const zwin32_module = zwin32.module("root");
2725
exe.root_module.addImport("zwin32", zwin32_module);
2826

2927
const zd3d12 = b.dependency("zd3d12", .{
30-
.target = options.target,
3128
.debug_layer = options.zd3d12_enable_debug_layer,
3229
.gbv = options.zd3d12_enable_gbv,
3330
});

0 commit comments

Comments
 (0)