~andreafeletto/levee

ref: 485b6cb9f94ffd7c7a057b3a7fc0bbb9460b2932 levee/build.zig -rw-r--r-- 1.8 KiB
485b6cb9Andrea Feletto make module creation dynamic 2 months ago
                                                                                
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
const std = @import("std");
const Pkg = std.build.Pkg;

const ScanProtocolsStep = @import("deps/zig-wayland/build.zig").ScanProtocolsStep;

pub fn build(b: *std.build.Builder) void {
    const target = b.standardTargetOptions(.{});
    const mode = b.standardReleaseOptions();

    const exe = b.addExecutable("levee", "src/main.zig");
    exe.setTarget(target);
    exe.setBuildMode(mode);

    const scanner = ScanProtocolsStep.create(b);
    scanner.addSystemProtocol("stable/xdg-shell/xdg-shell.xml");
    scanner.addProtocolPath("protocol/wlr-layer-shell-unstable-v1.xml");
    scanner.addProtocolPath("protocol/river-status-unstable-v1.xml");
    scanner.addProtocolPath("protocol/river-control-unstable-v1.xml");

    exe.step.dependOn(&scanner.step);
    scanner.addCSource(exe);

    const wayland = Pkg{
        .name = "wayland",
        .path = .{ .generated = &scanner.result },
    };
    const pixman = Pkg{
        .name = "pixman",
        .path = .{ .path = "deps/zig-pixman/pixman.zig" },
    };
    const fcft = Pkg{
        .name = "fcft",
        .path = .{ .path = "deps/zig-fcft/fcft.zig" },
        .dependencies = &[_]Pkg{pixman},
    };
    const udev = Pkg{
        .name = "udev",
        .path = .{ .path = "deps/zig-udev/udev.zig" },
    };

    exe.addPackage(fcft);
    exe.addPackage(pixman);
    exe.addPackage(udev);
    exe.addPackage(wayland);

    exe.linkLibC();
    exe.linkSystemLibrary("alsa");
    exe.linkSystemLibrary("fcft");
    exe.linkSystemLibrary("libudev");
    exe.linkSystemLibrary("pixman-1");
    exe.linkSystemLibrary("wayland-client");

    exe.install();

    const run_cmd = exe.run();
    run_cmd.step.dependOn(b.getInstallStep());
    if (b.args) |args| {
        run_cmd.addArgs(args);
    }

    const run_step = b.step("run", "Run levee");
    run_step.dependOn(&run_cmd.step);
}