-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.zig
More file actions
31 lines (25 loc) · 1.15 KB
/
build.zig
File metadata and controls
31 lines (25 loc) · 1.15 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
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
// Zterm module
const zterm_mod = b.addModule("zterm", .{ .root_source_file = .{ .cwd_relative = "src/zterm.zig" } });
// Examples
const examples = [_][]const u8{ "text_effects", "cursor", "raw_mode", "clear_screen", "game_base", "alt_screen", "mouse_input" };
for (examples) |example_name| {
const example_mod = b.addModule(b.fmt("example_{s}", .{example_name}), .{
.root_source_file = .{ .cwd_relative = b.fmt("examples/{s}.zig", .{example_name}) },
.target = target,
.optimize = optimize,
});
example_mod.addImport("zterm", zterm_mod);
const example = b.addExecutable(.{
.name = example_name,
.root_module = example_mod,
});
const install_example = b.addRunArtifact(example);
const example_step = b.step(example_name, b.fmt("Run {s} example", .{example_name}));
example_step.dependOn(&install_example.step);
example_step.dependOn(&example.step);
}
}