-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
51 lines (44 loc) · 1.62 KB
/
Copy pathbuild.zig
File metadata and controls
51 lines (44 loc) · 1.62 KB
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
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
// library
const module = b.addModule("zencode", .{
.root_source_file = b.path("src/zencode.zig"),
.target = target,
.optimize = optimize,
});
// tests
const tests = b.addTest(.{
.target = target,
.root_source_file = b.path("src/zencode.zig"),
.optimize = optimize,
});
const run_tests = b.addRunArtifact(tests);
const test_step = b.step("test", "Run library tests");
test_step.dependOn(&run_tests.step);
// decode example
const example_decode = b.addExecutable(.{
.target = target,
.name = "example_decode",
.root_source_file = b.path("examples/decode.zig"),
.optimize = optimize,
});
example_decode.root_module.addImport("zencode", module);
b.installArtifact(example_decode);
const decode_cmd = b.addRunArtifact(example_decode);
const decode_step = b.step("example_decode", "Run decode example");
decode_step.dependOn(&decode_cmd.step);
// encode example
const example_encode = b.addExecutable(.{
.target = target,
.name = "example_encode",
.root_source_file = b.path("examples/encode.zig"),
.optimize = optimize,
});
example_encode.root_module.addImport("zencode", module);
b.installArtifact(example_encode);
const encode_cmd = b.addRunArtifact(example_encode);
const encode_step = b.step("example_encode", "Run encode example");
encode_step.dependOn(&encode_cmd.step);
}