forked from swaywm/zig-wlroots
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.zig
49 lines (37 loc) · 1.5 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
const std = @import("std");
const Builder = std.build.Builder;
const Pkg = std.build.Pkg;
const ScanProtocolsStep = @import("deps/zig-wayland/build.zig").ScanProtocolsStep;
pub fn build(b: *Builder) void {
const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();
const scanner = ScanProtocolsStep.create(b);
scanner.addSystemProtocol("stable/xdg-shell/xdg-shell.xml");
const wayland = scanner.getPkg();
const xkbcommon = Pkg{ .name = "xkbcommon", .path = "deps/zig-xkbcommon/src/xkbcommon.zig" };
const pixman = Pkg{ .name = "pixman", .path = "deps/zig-pixman/pixman.zig" };
const wlroots = Pkg{
.name = "wlroots",
.path = "../src/wlroots.zig",
.dependencies = &[_]Pkg{ wayland, xkbcommon, pixman },
};
const exe = b.addExecutable("tinywl", "tinywl.zig");
exe.setTarget(target);
exe.setBuildMode(mode);
exe.linkLibC();
exe.addPackage(wayland);
exe.linkSystemLibrary("wayland-server");
exe.step.dependOn(&scanner.step);
// TODO: remove when https://github.com/ziglang/zig/issues/131 is implemented
scanner.addCSource(exe);
exe.addPackage(xkbcommon);
exe.linkSystemLibrary("xkbcommon");
exe.addPackage(wlroots);
exe.linkSystemLibrary("wlroots");
exe.linkSystemLibrary("pixman-1");
exe.install();
const run_cmd = exe.run();
run_cmd.step.dependOn(b.getInstallStep());
const run_step = b.step("run", "Run the compositor");
run_step.dependOn(&run_cmd.step);
}