diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-04-04 19:22:04 +0300 |
|---|---|---|
| committer | Can Celik <ogulcancelik@gmail.com> | 2026-04-05 01:23:06 +0300 |
| commit | 41dd733ca7123c9ac4bfc6c781697a660e95b052 (patch) | |
| tree | 3fc91815ca139ef2e0b281bba0abda4ef15175f4 /vendor/libghostty-vt/pkg/macos/build.zig | |
| parent | 55c138263e190a1e79d4b997bfb9397306c0ec1f (diff) | |
feat: finish ghostty pane backend integration
Diffstat (limited to 'vendor/libghostty-vt/pkg/macos/build.zig')
| -rw-r--r-- | vendor/libghostty-vt/pkg/macos/build.zig | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/vendor/libghostty-vt/pkg/macos/build.zig b/vendor/libghostty-vt/pkg/macos/build.zig new file mode 100644 index 00000000..0525e481 --- /dev/null +++ b/vendor/libghostty-vt/pkg/macos/build.zig @@ -0,0 +1,82 @@ +const std = @import("std"); +const builtin = @import("builtin"); +const apple_sdk = @import("apple_sdk"); + +pub fn build(b: *std.Build) !void { + const target = b.standardTargetOptions(.{}); + const optimize = b.standardOptimizeOption(.{}); + + const module = b.addModule("macos", .{ + .root_source_file = b.path("main.zig"), + .target = target, + .optimize = optimize, + }); + + const lib = b.addLibrary(.{ + .name = "macos", + .root_module = b.createModule(.{ + .target = target, + .optimize = optimize, + }), + .linkage = .static, + }); + + lib.addCSourceFile(.{ + .file = b.path("os/zig_macos.c"), + .flags = &.{"-std=c99"}, + }); + lib.addCSourceFile(.{ + .file = b.path("text/ext.c"), + }); + lib.linkFramework("CoreFoundation"); + lib.linkFramework("CoreGraphics"); + lib.linkFramework("CoreText"); + lib.linkFramework("CoreVideo"); + lib.linkFramework("QuartzCore"); + lib.linkFramework("IOSurface"); + if (target.result.os.tag == .macos) { + lib.linkFramework("Carbon"); + module.linkFramework("Carbon", .{}); + } + + if (target.result.os.tag.isDarwin()) { + module.linkFramework("CoreFoundation", .{}); + module.linkFramework("CoreGraphics", .{}); + module.linkFramework("CoreText", .{}); + module.linkFramework("CoreVideo", .{}); + module.linkFramework("QuartzCore", .{}); + module.linkFramework("IOSurface", .{}); + + try apple_sdk.addPaths(b, lib); + } + b.installArtifact(lib); + + { + const test_exe = b.addTest(.{ + .name = "test", + .root_module = b.createModule(.{ + .root_source_file = b.path("main.zig"), + .target = target, + .optimize = optimize, + }), + }); + if (target.result.os.tag.isDarwin()) { + try apple_sdk.addPaths(b, test_exe); + } + test_exe.linkLibrary(lib); + + var it = module.import_table.iterator(); + while (it.next()) |entry| { + test_exe.root_module.addImport( + entry.key_ptr.*, + entry.value_ptr.*, + ); + } + + b.installArtifact(test_exe); + + const tests_run = b.addRunArtifact(test_exe); + const test_step = b.step("test", "Run tests"); + test_step.dependOn(&tests_run.step); + } +} |
