for iOS simulator builds for apple M1 as base CPU model

pull/6699/head
Mitchell Hashimoto 2025-03-12 20:00:33 -07:00
parent 6613a695f0
commit bdb66984b6
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
2 changed files with 8 additions and 22 deletions

View File

@ -2,27 +2,7 @@ const std = @import("std");
pub fn build(b: *std.Build) !void {
const optimize = b.standardOptimizeOption(.{});
const target = target: {
var query = b.standardTargetOptionsQueryOnly(.{});
// This works around a Zig 0.14 bug where targeting an iOS
// simulator sets our CPU model to be "apple_a7" which is
// too outdated to support SIMD features and is also wrong.
// Simulator binaries run on the host CPU so target native.
//
// We can remove this when the following builds without
// issue without this line:
//
// zig build -Dtarget=aarch64-ios.17.0-simulator
//
if (query.abi) |abi| {
if (abi == .simulator) {
query.cpu_model = .native;
}
}
break :target b.resolveTargetQuery(query);
};
const target = b.standardTargetOptions(.{});
const lib = b.addStaticLibrary(.{
.name = "simdutf",

View File

@ -29,10 +29,16 @@ pub fn init(b: *std.Build, deps: *const SharedDeps) !GhosttyXCFramework {
b,
b.resolveTargetQuery(.{
.cpu_arch = .aarch64,
.cpu_model = .native,
.os_tag = .ios,
.os_version_min = Config.osVersionMin(.ios),
.abi = .simulator,
// We force the Apple CPU model because the simulator
// doesn't support the generic CPU model as of Zig 0.14 due
// to missing "altnzcv" instructions, which is false. This
// surely can't be right but we can fix this if/when we get
// back to running simulator builds.
.cpu_model = .{ .explicit = &std.Target.aarch64.cpu.apple_a17 },
}),
));