-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.zig
More file actions
72 lines (58 loc) · 2.22 KB
/
Copy pathbuild.zig
File metadata and controls
72 lines (58 loc) · 2.22 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
const std = @import("std");
const name = "progress";
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const mod = b.addModule(name, .{
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
});
const progress = b.addLibrary(.{
.name = name,
.root_module = mod,
});
const docs = b.addInstallDirectory(.{
.source_dir = progress.getEmittedDocs(),
.install_dir = .prefix,
.install_subdir = "docs",
});
const docs_step = b.step("docs", "Generate docs");
docs_step.dependOn(&docs.step);
for ([_][]const u8{ "simple", "complex", "thread", "multibar", "multibar-static" }) |example| {
const run_step = b.step(b.fmt("run-bar-{s}", .{example}), b.fmt("Run bar/{s}.zig example", .{example}));
const exe = b.addExecutable(.{
.name = example,
.root_module = b.createModule(.{
.root_source_file = b.path(b.fmt("examples/bar/{s}.zig", .{example})),
.target = target,
.optimize = optimize,
}),
});
exe.root_module.addImport(name, mod);
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(&b.addInstallArtifact(exe, .{}).step);
if (b.args) |args| {
run_cmd.addArgs(args);
}
run_step.dependOn(&run_cmd.step);
}
for ([_][]const u8{ "simple", "complex" }) |example| {
const run_step = b.step(b.fmt("run-spinner-{s}", .{example}), b.fmt("Run spinner/{s}.zig example", .{example}));
const exe = b.addExecutable(.{
.name = example,
.root_module = b.createModule(.{
.root_source_file = b.path(b.fmt("examples/spinner/{s}.zig", .{example})),
.target = target,
.optimize = optimize,
}),
});
exe.root_module.addImport(name, mod);
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(&b.addInstallArtifact(exe, .{}).step);
if (b.args) |args| {
run_cmd.addArgs(args);
}
run_step.dependOn(&run_cmd.step);
}
}