-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.zig
37 lines (32 loc) · 1.15 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
const std = @import("std");
pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});
const target = b.standardTargetOptions(.{});
const mod = b.addModule("prism", .{ .root_source_file = b.path("src/root.zig") });
const lib = b.addStaticLibrary(.{
.name = "prism",
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
});
b.installArtifact(lib);
const test_step = b.step("test", "Run tests");
const main_tests = b.addTest(.{
.name = "tests",
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
});
test_step.dependOn(&b.addRunArtifact(main_tests).step);
const example_option = b.option(bool, "examples", "Build examples") orelse false;
if (example_option) {
const rainbow = b.addExecutable(.{
.name = "rainbow",
.root_source_file = b.path("src/examples/rainbow.zig"),
.target = target,
.optimize = optimize,
});
b.installArtifact(rainbow);
rainbow.root_module.addImport("prism", mod);
}
}