-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.zig
65 lines (51 loc) · 2.25 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
const std = @import("std");
const Scanner = @import("zig-wayland").Scanner;
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const pie = b.option(bool, "pie", "Build a position-independent executable") orelse false;
const scanner = Scanner.create(b, .{});
scanner.addSystemProtocol("stable/xdg-shell/xdg-shell.xml");
scanner.addSystemProtocol("stable/viewporter/viewporter.xml");
scanner.addSystemProtocol("staging/single-pixel-buffer/single-pixel-buffer-v1.xml");
scanner.addCustomProtocol("protocol/wlr-layer-shell-unstable-v1.xml");
scanner.addCustomProtocol("protocol/river-status-unstable-v1.xml");
scanner.addCustomProtocol("protocol/river-control-unstable-v1.xml");
scanner.generate("wl_compositor", 4);
scanner.generate("wl_subcompositor", 1);
scanner.generate("wl_shm", 1);
scanner.generate("wl_output", 3);
scanner.generate("wl_seat", 5);
scanner.generate("wp_single_pixel_buffer_manager_v1", 1);
scanner.generate("wp_viewporter", 1);
scanner.generate("zwlr_layer_shell_v1", 1);
scanner.generate("zriver_status_manager_v1", 2);
scanner.generate("zriver_control_v1", 1);
const wayland = b.createModule(.{ .root_source_file = scanner.result });
const pixman = b.dependency("zig-pixman", .{}).module("pixman");
const fcft = b.dependency("zig-fcft", .{}).module("fcft");
const exe = b.addExecutable(.{
.name = "creek",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
exe.pie = pie;
exe.linkLibC();
exe.root_module.addImport("wayland", wayland);
exe.linkSystemLibrary("wayland-client");
exe.root_module.addImport("pixman", pixman);
exe.linkSystemLibrary("pixman-1");
exe.root_module.addImport("fcft", fcft);
exe.linkSystemLibrary("fcft");
// TODO: remove when https://github.com/ziglang/zig/issues/131 is implemented
scanner.addCSource(exe);
b.installArtifact(exe);
const run = b.addRunArtifact(exe);
run.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run.addArgs(args);
}
const run_step = b.step("run", "Run creek");
run_step.dependOn(&run.step);
}