dotfiles/scripts/wlbg/build.zig

52 lines
1.7 KiB
Zig
Raw Normal View History

2023-10-27 00:54:07 +02:00
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, .{});
2024-06-21 18:43:42 +02:00
const wayland_mod = b.createModule(.{ .root_source_file = scanner.result });
2023-10-27 00:54:07 +02:00
const exe = b.addExecutable(.{
.name = "wlbg",
2024-06-21 18:43:42 +02:00
.root_source_file = b.path("src/main.zig"),
2023-10-27 00:54:07 +02:00
.target = target,
.optimize = optimize,
2024-06-21 18:43:42 +02:00
.link_libc = true,
2023-10-27 00:54:07 +02:00
});
2024-03-20 20:45:59 +01:00
exe.root_module.addImport("common", b.dependency("common", .{}).module("common"));
exe.root_module.addImport("wayland", wayland_mod);
2023-10-27 00:54:07 +02:00
scanner.addSystemProtocol("stable/xdg-shell/xdg-shell.xml");
scanner.addSystemProtocol("unstable/xdg-output/xdg-output-unstable-v1.xml");
scanner.addCustomProtocol("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);
2024-06-21 18:43:42 +02:00
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", .{});
2023-10-27 00:54:07 +02:00
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);
}