build: rename use_fsevents build option to macos_fsevents

This commit is contained in:
CJ van den Berg 2026-03-08 09:57:30 +01:00
parent 82344d475b
commit 4a8ab550e9
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 5 additions and 5 deletions

View file

@ -4,10 +4,10 @@ pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{}); const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{}); const optimize = b.standardOptimizeOption(.{});
const use_fsevents = if (target.result.os.tag == .macos) blk: { const macos_fsevents = if (target.result.os.tag == .macos) blk: {
break :blk b.option( break :blk b.option(
bool, bool,
"use_fsevents", "macos_fsevents",
"Use the FSEvents backend on macOS instead of kqueue (requires Xcode frameworks)", "Use the FSEvents backend on macOS instead of kqueue (requires Xcode frameworks)",
) orelse false; ) orelse false;
} else false; } else false;
@ -19,7 +19,7 @@ pub fn build(b: *std.Build) void {
) orelse true; ) orelse true;
const options = b.addOptions(); const options = b.addOptions();
options.addOption(bool, "use_fsevents", use_fsevents); options.addOption(bool, "macos_fsevents", macos_fsevents);
options.addOption(bool, "linux_read_thread", linux_read_thread); options.addOption(bool, "linux_read_thread", linux_read_thread);
const options_mod = options.createModule(); const options_mod = options.createModule();
@ -32,7 +32,7 @@ pub fn build(b: *std.Build) void {
}, },
}); });
if (use_fsevents) { if (macos_fsevents) {
const xcode_frameworks = b.lazyDependency("xcode-frameworks", .{}) orelse return; const xcode_frameworks = b.lazyDependency("xcode-frameworks", .{}) orelse return;
mod.addSystemFrameworkPath(xcode_frameworks.path("Frameworks")); mod.addSystemFrameworkPath(xcode_frameworks.path("Frameworks"));
mod.addLibraryPath(xcode_frameworks.path("lib")); mod.addLibraryPath(xcode_frameworks.path("lib"));

View file

@ -174,7 +174,7 @@ fn recurse_watch(backend: *Backend, allocator: std.mem.Allocator, dir_path: []co
const Backend = switch (builtin.os.tag) { const Backend = switch (builtin.os.tag) {
.linux => INotifyBackend, .linux => INotifyBackend,
.macos => if (build_options.use_fsevents) FSEventsBackend else KQueueBackend, .macos => if (build_options.macos_fsevents) FSEventsBackend else KQueueBackend,
.freebsd => KQueueBackend, .freebsd => KQueueBackend,
.windows => WindowsBackend, .windows => WindowsBackend,
else => @compileError("file_watcher: unsupported OS"), else => @compileError("file_watcher: unsupported OS"),