forked from hspak/brightnessztl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.zig
36 lines (28 loc) · 986 Bytes
/
build.zig
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
const Builder = @import("std").build.Builder;
pub fn build(b: *Builder) void {
const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();
if (!target.isLinux()) {
@panic("Currently, only Linux is supported as the target OS");
}
const logind = b.option(
bool,
"logind",
"Set to true to to enable logind D-Bus support. Defaults to true.",
) orelse true;
const exe = b.addExecutable("brightnessztl", "src/main.zig");
const exe_options = b.addOptions();
exe.addOptions("build_options", exe_options);
exe_options.addOption(bool, "logind", logind);
if (logind) {
exe.linkLibC();
exe.linkSystemLibrary("libsystemd");
}
exe.setTarget(target);
exe.setBuildMode(mode);
exe.install();
const run_cmd = exe.run();
run_cmd.step.dependOn(b.getInstallStep());
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
}