File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -12,9 +12,6 @@ pub fn build(b: *std.Build) void {
1212 .cpu_arch = .aarch64 ,
1313 .os_tag = .ios ,
1414 });
15- const sdk = std .zig .system .darwin .getSdk (b .allocator , & target .result ) orelse
16- @panic ("no iOS SDK found" );
17- b .sysroot = sdk ;
1815
1916 const exe = b .addExecutable (.{
2017 .name = "main" ,
@@ -25,10 +22,17 @@ pub fn build(b: *std.Build) void {
2522 .link_libc = true ,
2623 }),
2724 });
25+
26+ if (std .zig .system .darwin .getSdk (b .allocator , & target .result )) | sdk | {
27+ b .sysroot = sdk ;
28+ exe .root_module .addSystemIncludePath (.{ .cwd_relative = b .pathJoin (&.{ sdk , "/usr/include" }) });
29+ exe .root_module .addSystemFrameworkPath (.{ .cwd_relative = b .pathJoin (&.{ sdk , "/System/Library/Frameworks" }) });
30+ exe .root_module .addLibraryPath (.{ .cwd_relative = b .pathJoin (&.{ sdk , "/usr/lib" }) });
31+ } else {
32+ exe .step .dependOn (& b .addFail ("no iOS SDK found" ).step );
33+ }
34+
2835 exe .root_module .addCSourceFile (.{ .file = b .path ("main.m" ), .flags = &.{} });
29- exe .root_module .addSystemIncludePath (.{ .cwd_relative = b .pathJoin (&.{ sdk , "/usr/include" }) });
30- exe .root_module .addSystemFrameworkPath (.{ .cwd_relative = b .pathJoin (&.{ sdk , "/System/Library/Frameworks" }) });
31- exe .root_module .addLibraryPath (.{ .cwd_relative = b .pathJoin (&.{ sdk , "/usr/lib" }) });
3236 exe .root_module .linkFramework ("Foundation" , .{});
3337 exe .root_module .linkFramework ("UIKit" , .{});
3438
You can’t perform that action at this time.
0 commit comments