-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
58 lines (54 loc) · 2.05 KB
/
Copy pathbuild.zig
File metadata and controls
58 lines (54 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// zig-half build script
//
// The previous version of this file had never compiled and could not have. It
// declared `pub fn test(b: *std.Build)`, and `test` is a keyword; it assigned
// `b.standardTargetOptions` without calling it; it passed two arguments to
// installArtifact and read `b.step` as a field. None of that is a version
// difference -- it is a sketch shaped like a build script, and nothing in this
// repository ever ran it, because there was no workflow that built anything.
//
// Rewritten for 0.15, the version the packages that would consume this are
// built with.
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const root = b.addModule("zig-half", .{
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
});
_ = root;
const lib = b.addLibrary(.{
.name = "zig-half",
.linkage = .static,
.root_module = b.createModule(.{
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
}),
});
b.installArtifact(lib);
// One test target per file, as before, plus the module root. The root was
// not tested at all previously, which is the surface every consumer gets:
// Zig analyses top-level declarations lazily, so a test run over the other
// files proves nothing about the declarations they do not reference.
const test_step = b.step("test", "Run the tests");
for ([_][]const u8{
"src/root.zig",
"src/f16_utils.zig",
"src/f16_shadow.zig",
"src/sparse_simd.zig",
"src/ternary_pack.zig",
"src/simd_config.zig",
}) |path| {
const t = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path(path),
.target = target,
.optimize = optimize,
}),
});
test_step.dependOn(&b.addRunArtifact(t).step);
}
}