build: add -Dxcframework-target to specify the target for builds

This commit is contained in:
Mitchell Hashimoto
2025-07-04 15:01:14 -07:00
parent 3793dac313
commit 91ee75ae4d
2 changed files with 11 additions and 1 deletions

View File

@ -98,7 +98,7 @@ pub fn build(b: *std.Build) !void {
const xcframework = try buildpkg.GhosttyXCFramework.init(
b,
&deps,
.universal,
config.xcframework_target,
);
xcframework.install();

View File

@ -9,6 +9,7 @@ const apprt = @import("../apprt.zig");
const font = @import("../font/main.zig");
const rendererpkg = @import("../renderer.zig");
const Command = @import("../Command.zig");
const XCFramework = @import("GhosttyXCFramework.zig");
const WasmTarget = @import("../os/wasm/target.zig").Target;
const gtk = @import("gtk.zig");
@ -24,6 +25,7 @@ const app_version: std.SemanticVersion = .{ .major = 1, .minor = 1, .patch = 4 }
/// Standard build configuration options.
optimize: std.builtin.OptimizeMode,
target: std.Build.ResolvedTarget,
xcframework_target: XCFramework.Target = .universal,
wasm_target: WasmTarget,
/// Comptime interfaces
@ -109,6 +111,14 @@ pub fn init(b: *std.Build) !Config {
.env = env,
};
//---------------------------------------------------------------
// Target-specific properties
config.xcframework_target = b.option(
XCFramework.Target,
"xcframework-target",
"The target for the xcframework.",
) orelse .universal;
//---------------------------------------------------------------
// Comptime Interfaces
config.font_backend = b.option(