-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.zig
53 lines (49 loc) · 1.79 KB
/
build.zig
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
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.target = target,
.optimize = optimize,
.single_threaded = true,
.unwind_tables = .none,
});
const executable = b.addExecutable(.{
.name = "rva",
.root_module = module,
});
executable.error_limit = 0xff;
b.installArtifact(executable);
// if (optimize == .ReleaseSmall) {
// const strip_section_headers = b.addSystemCommand(&.{
// "objcopy",
// "--strip-section-headers",
// });
// strip_section_headers.addArg("zig-out/bin/rva");
// strip_section_headers.step.dependOn(&executable.step);
// b.getInstallStep().dependOn(&strip_section_headers.step);
// }
const test_step = b.step("test", "Run tests");
// Make sure we can build for these architectures.
const riscv32_executable = b.addExecutable(.{
.name = "rva",
.root_source_file = b.path("main.zig"),
.target = b.resolveTargetQuery(.{ .cpu_arch = .riscv32 }),
});
test_step.dependOn(&riscv32_executable.step);
const riscv64_executable = b.addExecutable(.{
.name = "rva",
.root_source_file = b.path("main.zig"),
.target = b.resolveTargetQuery(.{ .cpu_arch = .riscv64 }),
});
test_step.dependOn(&riscv64_executable.step);
const tests = b.addTest(.{
.root_source_file = b.path("tests.zig"),
.target = target,
.optimize = optimize,
});
const run_tests = b.addRunArtifact(tests);
run_tests.step.dependOn(b.getInstallStep());
test_step.dependOn(&run_tests.step);
}