dotfiles/scripts/mzteriver/build.zig

78 lines
2.1 KiB
Zig
Raw Normal View History

2024-02-10 17:40:22 +01:00
const std = @import("std");
2024-03-20 20:45:59 +01:00
const common = @import("common");
2024-02-10 17:40:22 +01:00
const Scanner = @import("wayland").Scanner;
pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
2024-05-29 15:56:16 +02:00
const CgOpt = struct {
catppuccin: struct {
red: [:0]const u8,
sky: [:0]const u8,
},
nvidia: bool = false,
term: struct { command: [:0]const u8 },
commands: struct {
file_manager: [:0]const u8,
browser: [:0]const u8,
2024-05-29 15:56:16 +02:00
media: struct {
volume_up: [:0]const u8,
volume_down: [:0]const u8,
mute_sink: [:0]const u8,
mute_source: [:0]const u8,
play_pause: [:0]const u8,
stop: [:0]const u8,
next: [:0]const u8,
prev: [:0]const u8,
},
},
cursor: struct {
theme: [:0]const u8,
size: u32,
},
2024-05-29 15:56:16 +02:00
};
const cg_opt = try common.confgenGet(CgOpt, b.allocator);
2024-02-10 17:40:22 +01:00
const opts = b.addOptions();
2024-05-29 15:56:16 +02:00
opts.addOption(CgOpt, "cg", cg_opt);
2024-02-10 17:40:22 +01:00
const scanner = Scanner.create(b, .{});
const exe = b.addExecutable(.{
.name = "mzteriver",
2024-06-21 18:43:42 +02:00
.root_source_file = b.path("src/main.zig"),
2024-02-10 17:40:22 +01:00
.target = target,
.optimize = optimize,
2024-06-21 18:43:42 +02:00
.link_libc = true,
2024-02-10 17:40:22 +01:00
});
2024-06-21 18:43:42 +02:00
scanner.addCSource(exe);
2024-03-20 20:45:59 +01:00
exe.root_module.addImport("common", b.dependency("common", .{}).module("common"));
2024-02-10 17:40:22 +01:00
exe.root_module.addImport("opts", opts.createModule());
2024-06-21 18:43:42 +02:00
exe.root_module.addImport("wayland", b.createModule(.{ .root_source_file = scanner.result }));
2024-02-10 17:40:22 +01:00
scanner.addCustomProtocol("river-control-unstable-v1.xml");
scanner.generate("zriver_control_v1", 1);
scanner.generate("wl_seat", 7);
exe.root_module.linkSystemLibrary("wayland-client", .{});
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);
}