-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.zig
62 lines (49 loc) · 1.72 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
54
55
56
57
58
59
60
61
62
const std = @import("std");
const Builder = @import("std").build.Builder;
pub fn build(b: *Builder) void {
const mode = b.standardReleaseOptions();
// Exe building
{
const exe = b.addExecutable("example", "example.zig");
exe.setBuildMode(mode);
exe.install();
const run_cmd = exe.run();
run_cmd.step.dependOn(b.getInstallStep());
const run_step = b.step("run", "Run example.zig");
run_step.dependOn(&run_cmd.step);
const run_step2 = b.step("example", "Run example.zig");
run_step2.dependOn(&run_cmd.step);
}
// hello example
{
const exe = b.addExecutable("example-hello", "example-hello.zig");
exe.setBuildMode(mode);
exe.linkSystemLibrary("c");
exe.install();
const run_cmd = exe.run();
run_cmd.step.dependOn(b.getInstallStep());
const run_step = b.step("example-hello", "Run the hello example");
run_step.dependOn(&run_cmd.step);
}
// mmx example
{
const exe = b.addExecutable("example-mmx", "example-mmx.zig");
exe.setBuildMode(mode);
exe.linkSystemLibrary("c");
exe.install();
const run_cmd = exe.run();
run_cmd.step.dependOn(b.getInstallStep());
const run_step = b.step("example-mmx", "Run the mmx example");
run_step.dependOn(&run_cmd.step);
}
// Library building
{
const lib = b.addStaticLibrary("x86-zig", "src/x86.zig");
lib.setBuildMode(mode);
lib.install();
var main_tests = b.addTest("src/x86.zig");
main_tests.setBuildMode(mode);
const test_step = b.step("test", "Run library tests");
test_step.dependOn(&main_tests.step);
}
}