Commit f0a3df98d3
Changed files (1)
test
standalone
ios
test/standalone/ios/build.zig
@@ -12,9 +12,6 @@ pub fn build(b: *std.Build) void {
.cpu_arch = .aarch64,
.os_tag = .ios,
});
- const sdk = std.zig.system.darwin.getSdk(b.allocator, &target.result) orelse
- @panic("no iOS SDK found");
- b.sysroot = sdk;
const exe = b.addExecutable(.{
.name = "main",
@@ -25,10 +22,17 @@ pub fn build(b: *std.Build) void {
.link_libc = true,
}),
});
+
+ if (std.zig.system.darwin.getSdk(b.allocator, &target.result)) |sdk| {
+ b.sysroot = sdk;
+ exe.root_module.addSystemIncludePath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/usr/include" }) });
+ exe.root_module.addSystemFrameworkPath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/System/Library/Frameworks" }) });
+ exe.root_module.addLibraryPath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/usr/lib" }) });
+ } else {
+ exe.step.dependOn(&b.addFail("no iOS SDK found").step);
+ }
+
exe.root_module.addCSourceFile(.{ .file = b.path("main.m"), .flags = &.{} });
- exe.root_module.addSystemIncludePath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/usr/include" }) });
- exe.root_module.addSystemFrameworkPath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/System/Library/Frameworks" }) });
- exe.root_module.addLibraryPath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/usr/lib" }) });
exe.root_module.linkFramework("Foundation", .{});
exe.root_module.linkFramework("UIKit", .{});