-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.zig
42 lines (31 loc) · 1.26 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
const std = @import("std");
const zbs = std.build;
const process = std.process;
const Builder = zbs.Builder;
pub fn build(b: *Builder) void {
const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();
const exe = b.addExecutable("kana", "src/main.zig");
exe.setTarget(target);
exe.setBuildMode(mode);
exe.strip = b.option(bool, "strip", "Omit debug information") orelse false;
exe.pie = b.option(bool, "pie", "Build a Position Independent Executable") orelse false;
const version = b.option([]const u8, "version", "Set program version") orelse "unknown";
const compdata = b.addOptions();
compdata.addOption([]const u8, "version", version);
exe.addOptions("compdata", compdata);
exe.addPackagePath("zig-clap", "deps/zig-clap/clap.zig");
exe.install();
const run = exe.run();
if (b.args) |args| {
run.addArgs(args);
}
run.step.dependOn(b.getInstallStep());
const run_step = b.step("run", "Run program");
run_step.dependOn(&run.step);
const tests = b.addTest("src/tests.zig");
tests.addPackagePath("zig-scfg", "deps/zig-scfg/scfg.zig");
tests.setBuildMode(exe.build_mode);
const test_step = b.step("test", "Run tests");
test_step.dependOn(&tests.step);
}