~andreafeletto/levee

ref: ae55230ec4895a224104a266195278ff23a8d44b levee/build.zig -rw-r--r-- 1.6 KiB
ae55230eAndrea Feletto correct rendering of clock 3 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
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 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");

    const wayland = scanner.getPkg();
    const pixman = Pkg{
        .name = "pixman",
        .path = "deps/zig-pixman/pixman.zig",
    };
    const fcft = Pkg{
        .name = "fcft",
        .path = "deps/zig-fcft/fcft.zig",
        .dependencies = &[_]Pkg{pixman},
    };
    const datetime = Pkg{
        .name = "datetime",
        .path = "deps/zig-datetime/src/main.zig",
    };

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

    exe.linkLibC();

    exe.addPackage(wayland);
    exe.linkSystemLibrary("wayland-client");
    exe.step.dependOn(&scanner.step);
    scanner.addCSource(exe);

    exe.addPackage(pixman);
    exe.linkSystemLibrary("pixman-1");

    exe.addPackage(fcft);
    exe.linkSystemLibrary("fcft");

    exe.addPackage(datetime);

    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 the app");
    run_step.dependOn(&run_cmd.step);
}