-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.zig
37 lines (31 loc) · 1.15 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
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const module = b.addModule("sbi", .{
.root_source_file = .{ .path = "sbi.zig" },
.target = target,
.optimize = optimize,
});
_ = module;
buildTests(b, optimize);
}
fn buildTests(b: *std.Build, optimize: std.builtin.OptimizeMode) void {
const test_step = b.step("test", "Run library tests");
const target_64 = b.resolveTargetQuery(.{ .cpu_arch = .riscv64, .os_tag = .freestanding });
const build_test_64 = b.addStaticLibrary(.{
.name = "test_64",
.root_source_file = .{ .path = "sbi.zig" },
.target = target_64,
.optimize = optimize,
});
test_step.dependOn(&build_test_64.step);
const target_32 = b.resolveTargetQuery(.{ .cpu_arch = .riscv32, .os_tag = .freestanding });
const build_test_32 = b.addStaticLibrary(.{
.name = "test_32",
.root_source_file = .{ .path = "sbi.zig" },
.target = target_32,
.optimize = optimize,
});
test_step.dependOn(&build_test_32.step);
}