-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.zig
More file actions
48 lines (45 loc) · 1.29 KB
/
build.zig
File metadata and controls
48 lines (45 loc) · 1.29 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
const std = @import("std");
const fmt = std.fmt;
pub fn build(b: *std.Build) void {
const mainFileName = "zigmodule";
const src_dir = "src";
const mainFilePath = fmt.comptimePrint("{s}/{s}.zig", .{
src_dir,
mainFileName,
});
const kernelFilePath = fmt.comptimePrint("{s}/{s}.zig", .{
src_dir,
"kernel",
});
const main_tests = b.addTest(.{
.root_source_file = .{
.path = mainFilePath,
},
});
const kernel_tests = b.addTest(.{
.root_source_file = .{
.path = kernelFilePath,
},
});
kernel_tests.linkLibC();
const test_step = b.step("test", "Run library tests");
test_step.dependOn(&main_tests.step);
test_step.dependOn(&kernel_tests.step);
const obj = b.addObject(.{
.name = mainFileName,
.target = .{ .os_tag = .freestanding },
.optimize = .ReleaseSmall,
.root_source_file = .{
.path = mainFilePath,
},
});
obj.addSystemIncludePath("include");
obj.bundle_compiler_rt = false;
obj.code_model = .kernel;
obj.export_table = false;
obj.disable_stack_probing = false;
obj.disable_sanitize_c = false;
obj.strip = true;
obj.override_dest_dir = .{ .custom = "obj" };
b.installArtifact(obj);
}