38 lines
1.0 KiB
Zig
38 lines
1.0 KiB
Zig
const std = @import("std");
|
|
const bh = @import("bh");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const opts = bh.declareOptions(b);
|
|
|
|
const mod = b.addModule("watcher", .{
|
|
.target = opts.target,
|
|
.optimize = opts.optimize,
|
|
.root_source_file = b.path("src/watcher.zig"),
|
|
.link_libc = true,
|
|
.link_libcpp = true,
|
|
});
|
|
|
|
mod.addCSourceFile(.{ .file = b.path("src/watcher.cpp") });
|
|
|
|
if (opts.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 = opts.target,
|
|
.optimize = opts.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);
|
|
}
|