41 lines
1.2 KiB
Zig
41 lines
1.2 KiB
Zig
const std = @import("std");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const target = b.standardTargetOptions(.{});
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
|
_ = static_build;
|
|
|
|
const mod = b.addModule("watcher", .{
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.root_source_file = b.path("src/watcher.zig"),
|
|
.link_libc = true,
|
|
.link_libcpp = true,
|
|
});
|
|
|
|
mod.addCSourceFile(.{ .file = b.path("src/watcher.cpp") });
|
|
|
|
if (target.result.os.tag == .macos) {
|
|
mod.linkFramework("CoreFoundation", .{});
|
|
mod.linkFramework("CoreServices", .{});
|
|
}
|
|
|
|
mod.addIncludePath(b.path("src/include"));
|
|
|
|
const test_exe = b.addTest(.{
|
|
.root_module = b.createModule(.{
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.root_source_file = b.path("tests/test.zig"),
|
|
}),
|
|
});
|
|
test_exe.root_module.addImport("watcher", mod);
|
|
|
|
const test_step = b.step("test", "runs sample unit tests for watcher");
|
|
test_step.dependOn(&b.addRunArtifact(test_exe).step);
|
|
|
|
b.installArtifact(test_exe);
|
|
}
|