-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.zig
72 lines (50 loc) · 1.82 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
63
64
65
66
67
68
69
70
71
72
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const strip = b.option(bool, "strip", "Strip debug info from the output binary");
const bdwgc = b.dependency("bdwgc", .{
.target = target,
.optimize = optimize,
.BUILD_SHARED_LIBS = false,
});
const bdwgc_artifact = bdwgc.artifact("gc");
const ffi = b.dependency("ffi", .{
.target = target,
.optimize = optimize,
});
const ffi_artifact = ffi.artifact("ffi");
const exe = b.addExecutable(.{
.name = "syphon",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.strip = strip,
});
const exe_options = b.addOptions();
exe_options.addOption([]const u8, "version", "0.1.0");
exe.root_module.addOptions("build_options", exe_options);
exe.addIncludePath(bdwgc.path("include"));
exe.linkLibrary(bdwgc_artifact);
exe.linkLibrary(ffi_artifact);
b.installArtifact(exe);
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
const exe_check = b.addExecutable(.{
.name = "syphon",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
exe_check.root_module.addOptions("build_options", exe_options);
exe_check.addIncludePath(bdwgc.path("include"));
exe_check.linkLibrary(bdwgc_artifact);
exe_check.linkLibrary(ffi_artifact);
const check_step = b.step("check", "Checks if the app can compile");
check_step.dependOn(&exe_check.step);
}