-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.zig
56 lines (43 loc) · 1.65 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
const std = @import("std");
pub fn build(b: *std.build.Builder) void {
const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();
const lib = b.addStaticLibrary("projavu-lib", "src/lib.zig");
const exe = b.addExecutable("projavu", "src/cli.zig");
const tests = b.addTest("src/tests.zig");
const zig_csv = std.build.Pkg{
.name = "zig-csv",
.source = .{ .path = "lib/zig-csv/src/zig-csv.zig" },
};
const zig_argtic = std.build.Pkg{
.name = "zig-argtic",
.source = .{ .path = "lib/zig-argtic/src/zig-argtic.zig" },
};
lib.addPackage(zig_csv);
exe.addPackage(zig_csv);
exe.addPackage(zig_argtic);
tests.addPackage(zig_csv);
exe.addIncludePath("lib/ctable/src");
exe.addCSourceFile("lib/ctable/src/table.c", &[_][]const u8{});
exe.addCSourceFile("lib/ctable/src/string_builder.c", &[_][]const u8{});
exe.addCSourceFile("lib/ctable/src/string_util.c", &[_][]const u8{});
exe.addCSourceFile("lib/ctable/src/vector.c", &[_][]const u8{});
exe.addIncludePath("lib/levenshtein.c");
exe.addCSourceFile("lib/levenshtein.c/levenshtein.c", &[_][]const u8{});
exe.linkLibC();
lib.setBuildMode(mode);
exe.setBuildMode(mode);
lib.setTarget(target);
exe.setTarget(target);
lib.emit_docs = .emit;
lib.install();
exe.install();
const exe_run = exe.run();
if (b.args) |args| {
exe_run.addArgs(args);
}
const tests_step = b.step("test", "Run all unit tests");
const exe_run_step = b.step("run", "Run the executable");
tests_step.dependOn(&tests.step);
exe_run_step.dependOn(&exe_run.step);
}