dotfiles/scripts/wlbg/build.zig

51 lines
1.7 KiB
Zig

const std = @import("std");
const Scanner = @import("wayland").Scanner;
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const scanner = Scanner.create(b, .{});
const wayland_mod = b.createModule(.{ .root_source_file = scanner.result });
const exe = b.addExecutable(.{
.name = "wlbg",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
exe.root_module.addImport("common", b.dependency("common", .{}).module("common"));
exe.root_module.addImport("wayland", wayland_mod);
scanner.addSystemProtocol("stable/xdg-shell/xdg-shell.xml");
scanner.addSystemProtocol("unstable/xdg-output/xdg-output-unstable-v1.xml");
scanner.addCustomProtocol(b.pathFromRoot("wlr-layer-shell-unstable-v1.xml"));
scanner.generate("wl_compositor", 5);
scanner.generate("wl_shm", 1);
scanner.generate("zwlr_layer_shell_v1", 4);
scanner.generate("zxdg_output_manager_v1", 3);
scanner.generate("xdg_wm_base", 5); // dependency of layer shell
scanner.generate("wl_seat", 8);
scanner.generate("wl_output", 4);
scanner.addCSource(exe);
exe.root_module.linkSystemLibrary("wayland-client", .{});
exe.root_module.linkSystemLibrary("wayland-egl", .{});
exe.root_module.linkSystemLibrary("EGL", .{});
exe.root_module.linkSystemLibrary("GL", .{});
b.installArtifact(exe);
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
}