-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.zig
40 lines (33 loc) · 1.14 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
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
// Export as module to be available for @import("pretty") on user site
_ = b.addModule("pretty", .{ .root_source_file = b.path("src/pretty.zig") });
// Compile library
const lib = b.addStaticLibrary(.{
.name = "pretty",
.root_source_file = b.path("src/pretty.zig"),
.target = target,
.optimize = optimize,
});
b.installArtifact(lib);
// Run tests
const tests = b.addTest(.{
.name = "tests",
.root_source_file = b.path("src/tests.zig"),
.target = target,
.optimize = optimize,
});
const step_tests = b.addRunArtifact(tests);
b.step("test", "Run pretty tests").dependOn(&step_tests.step);
// Run demo
const demo = b.addExecutable(.{
.name = "demo",
.root_source_file = b.path("src/demo.zig"),
.target = target,
.optimize = optimize,
});
const step_demo = b.addRunArtifact(demo);
b.step("run", "Run pretty demo").dependOn(&step_demo.step);
}