-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.zig
103 lines (85 loc) · 3.02 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
const std = @import("std");
// Although this function looks imperative, note that its job is to
// declaratively construct a build graph that will be executed by an external
// runner.
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const zap = b.dependency("zap", .{
.target = target,
.optimize = optimize,
});
const exe = b.addExecutable(.{
.name = "sycl2023app",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
exe.addModule("zap", zap.module("zap"));
exe.linkLibrary(zap.artifact("facil.io"));
b.installArtifact(exe);
const run = b.addRunArtifact(exe);
if (b.args) |args| {
run.addArgs(args);
}
const run_cmd = b.step("run", "Run the app");
run_cmd.dependOn(&run.step);
//
// frontend dev server
//
const devserver = b.addExecutable(.{
.name = "devserver",
.root_source_file = .{ .path = "src/frontend_dev_server.zig" },
.target = target,
.optimize = optimize,
});
devserver.addModule("zap", zap.module("zap"));
devserver.linkLibrary(zap.artifact("facil.io"));
b.installArtifact(devserver);
const run_devserver = b.addRunArtifact(devserver);
if (b.args) |args| {
run.addArgs(args);
}
const run_devserver_cmd = b.step("run-devserver", "Run the dev server");
run_devserver_cmd.dependOn(&run_devserver.step);
//
// particibot
//
const particibot = b.addExecutable(.{
.name = "particibot",
.root_source_file = .{ .path = "src/particibot/particibot.zig" },
.target = target,
.optimize = optimize,
});
b.installArtifact(particibot);
const particibot_step = b.step("particibot", "Build particibot");
particibot_step.dependOn(&particibot.step);
const run_particibot = b.addRunArtifact(particibot);
if (b.args) |args| {
run.addArgs(args);
}
const run_particibot_cmd = b.step("run-particibot", "Run the particibot");
run_particibot_cmd.dependOn(&run_particibot.step);
//
// TESTS
//
const participants_test = b.addTest(.{
.root_source_file = .{ .path = "src/participants.zig" },
.target = target,
.optimize = optimize,
});
const pwauth_test = b.addTest(.{
.root_source_file = .{ .path = "src/pwauth.zig" },
.target = target,
.optimize = optimize,
});
pwauth_test.addModule("zap", zap.module("zap"));
const run_participants_test = b.addRunArtifact(participants_test);
const run_pwauth_test = b.addRunArtifact(pwauth_test);
// Similar to creating the run step earlier, this exposes a `test` step to
// the `zig build --help` menu, providing a way for the participant to request
// running the unit tests.
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_pwauth_test.step);
test_step.dependOn(&run_participants_test.step);
}