mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
build: Use correct SDK for iOS Simulator shader build (#7636)
This PR makes the build script use the correct SDK and version flag for the iOS Simulator. Without this PR, the terminal fails to initialize on the iOS Simulator: ``` Compiler failed to build request metal error=Target OS is incompatible: library was not compiled for the simulator error initializing surface err=error.MetalFailed ``` <details> <summary>With the PR</summary>  </details> Fixes #7635.
This commit is contained in:
@ -24,9 +24,20 @@ output: LazyPath,
|
|||||||
pub fn create(b: *std.Build, opts: Options) ?*MetallibStep {
|
pub fn create(b: *std.Build, opts: Options) ?*MetallibStep {
|
||||||
const sdk = switch (opts.target.result.os.tag) {
|
const sdk = switch (opts.target.result.os.tag) {
|
||||||
.macos => "macosx",
|
.macos => "macosx",
|
||||||
.ios => "iphoneos",
|
.ios => switch (opts.target.result.abi) {
|
||||||
|
.simulator => "iphonesimulator",
|
||||||
|
else => "iphoneos",
|
||||||
|
},
|
||||||
else => return null,
|
else => return null,
|
||||||
};
|
};
|
||||||
|
const platform_version_arg = switch (opts.target.result.os.tag) {
|
||||||
|
.macos => "-mmacos-version-min",
|
||||||
|
.ios => switch (opts.target.result.abi) {
|
||||||
|
.simulator => "-mios-simulator-version-min",
|
||||||
|
else => "-mios-version-min",
|
||||||
|
},
|
||||||
|
else => null,
|
||||||
|
};
|
||||||
|
|
||||||
const self = b.allocator.create(MetallibStep) catch @panic("OOM");
|
const self = b.allocator.create(MetallibStep) catch @panic("OOM");
|
||||||
|
|
||||||
@ -46,16 +57,11 @@ pub fn create(b: *std.Build, opts: Options) ?*MetallibStep {
|
|||||||
const output_ir = run_ir.addOutputFileArg(b.fmt("{s}.ir", .{opts.name}));
|
const output_ir = run_ir.addOutputFileArg(b.fmt("{s}.ir", .{opts.name}));
|
||||||
run_ir.addArgs(&.{"-c"});
|
run_ir.addArgs(&.{"-c"});
|
||||||
for (opts.sources) |source| run_ir.addFileArg(source);
|
for (opts.sources) |source| run_ir.addFileArg(source);
|
||||||
switch (opts.target.result.os.tag) {
|
if (platform_version_arg) |arg| {
|
||||||
.ios => run_ir.addArgs(&.{b.fmt(
|
run_ir.addArgs(&.{b.fmt(
|
||||||
"-mios-version-min={s}",
|
"{s}={s}",
|
||||||
.{min_version},
|
.{ arg, min_version },
|
||||||
)}),
|
)});
|
||||||
.macos => run_ir.addArgs(&.{b.fmt(
|
|
||||||
"-mmacos-version-min={s}",
|
|
||||||
.{min_version},
|
|
||||||
)}),
|
|
||||||
else => {},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const run_lib = RunStep.create(
|
const run_lib = RunStep.create(
|
||||||
|
Reference in New Issue
Block a user