2023-01-18 22:00:27 -09:00
|
|
|
// SPDX-FileCopyrightText: 2021-2023 Yoran Heling <projects@yorhel.nl>
|
2021-07-18 01:36:05 -08:00
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
|
2021-04-29 02:48:45 -08:00
|
|
|
const std = @import("std");
|
|
|
|
|
|
|
|
|
|
pub fn build(b: *std.build.Builder) void {
|
|
|
|
|
const target = b.standardTargetOptions(.{});
|
|
|
|
|
const mode = b.standardReleaseOptions();
|
|
|
|
|
|
|
|
|
|
const exe = b.addExecutable("ncdu", "src/main.zig");
|
|
|
|
|
exe.setTarget(target);
|
|
|
|
|
exe.setBuildMode(mode);
|
2023-02-21 20:51:08 -09:00
|
|
|
// https://github.com/ziglang/zig/blob/b52be973dfb7d1408218b8e75800a2da3dc69108/build.zig#L551-L554
|
|
|
|
|
if (exe.target.isDarwin()) {
|
|
|
|
|
// useful for package maintainers
|
|
|
|
|
exe.headerpad_max_install_names = true;
|
|
|
|
|
}
|
2021-05-04 08:01:49 -08:00
|
|
|
exe.addCSourceFile("src/ncurses_refs.c", &[_][]const u8{});
|
2021-05-02 22:01:09 -08:00
|
|
|
exe.linkLibC();
|
2021-05-04 08:01:49 -08:00
|
|
|
exe.linkSystemLibrary("ncursesw");
|
2021-04-29 02:48:45 -08:00
|
|
|
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);
|
2021-05-04 08:01:49 -08:00
|
|
|
|
|
|
|
|
const tst = b.addTest("src/main.zig");
|
|
|
|
|
tst.linkLibC();
|
|
|
|
|
tst.linkSystemLibrary("ncursesw");
|
2021-07-16 09:13:02 -08:00
|
|
|
tst.addCSourceFile("src/ncurses_refs.c", &[_][]const u8{});
|
2021-05-04 08:01:49 -08:00
|
|
|
const tst_step = b.step("test", "Run tests");
|
|
|
|
|
tst_step.dependOn(&tst.step);
|
2021-04-29 02:48:45 -08:00
|
|
|
}
|