From 1f7018103261a54e63302e47c63f47adf88e6cff Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 12 Feb 2023 21:58:43 -0800 Subject: [PATCH] build: can build the app using Swift (noop) --- build.zig | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/build.zig b/build.zig index 2c0fb4bc2..3999754b7 100644 --- a/build.zig +++ b/build.zig @@ -131,6 +131,31 @@ pub fn build(b: *std.build.Builder) !void { b.installFile("dist/macos/Ghostty.icns", "Ghostty.app/Contents/Resources/Ghostty.icns"); } + // Mac App based on Swift + { + // Build the swift binary (TODO: debug vs release modes) + const swift_build = b.addSystemCommand(&.{ "swift", "build" }); + swift_build.cwd = "macos"; + + const macapp = b.step("macapp", "Build macOS app"); + macapp.dependOn(&swift_build.step); + macapp.dependOn(&b.addInstallFileWithDir( + .{ .path = "macos/.build/arm64-apple-macosx/debug/Ghostty" }, + .prefix, + "Ghostty.app/Contents/MacOS/ghostty", + ).step); + macapp.dependOn(&b.addInstallFileWithDir( + .{ .path = "dist/macos/Info.plist" }, + .prefix, + "Ghostty.app/Contents/Info.plist", + ).step); + macapp.dependOn(&b.addInstallFileWithDir( + .{ .path = "dist/macos/Ghostty.icns" }, + .prefix, + "Ghostty.app/Contents/Resources/Ghostty.icns", + ).step); + } + // wasm { // Build our Wasm target.