-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
47 lines (38 loc) · 1.18 KB
/
build.zig
File metadata and controls
47 lines (38 loc) · 1.18 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
pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const protocols_opt = b.option(
[]std.Build.LazyPath,
"protocols",
"Paths to desired wayland protocols (e.g. wayland.xml, xdg-shell.xml, etc.)"
);
const debug_opt = b.option(
bool,
"debug",
"run generator with debug logging"
) orelse false;
const root = b.createModule(.{
.root_source_file = b.path("src/generator.zig"),
.target = target,
.optimize = optimize
});
const generator = b.addExecutable(.{
.name = "wl-protocol-codegen",
.root_module = root,
});
b.installArtifact(generator);
if (protocols_opt) |protocols| {
const wl_generate_cmd = b.addRunArtifact(generator);
for (protocols) |protocol| {
wl_generate_cmd.addFileArg(protocol);
}
if (debug_opt) wl_generate_cmd.addArg("--debug");
wl_generate_cmd.addArg("-o");
const protocols_zig = wl_generate_cmd.addOutputFileArg("protocols.zig");
const protocols_zig_module = b.addModule("wayland-protocols", .{
.root_source_file = protocols_zig,
});
_ = protocols_zig_module;
}
}
const std = @import("std");