commit f0a3df98d35417313854d77e671f35ea9e86d82c (tree)
parent d2b1aa48abf5ac14fbfc37c95561a3db4507f1c9
Author: Tobias Simetsreiter <dasimmet@gmail.com>
Date: Mon, 17 Nov 2025 12:14:09 +0100
replace @panic with b.addFail in standalone test build.zig
Diffstat:
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/test/standalone/ios/build.zig b/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", .{});