1const std = @import("std");
2
3pub const requires_symlinks = true;
4pub const requires_ios_sdk = true;
5
6pub fn build(b: *std.Build) void {
7 const test_step = b.step("test", "Test it");
8 b.default_step = test_step;
9
10 const target = b.resolveTargetQuery(.{
11 .cpu_arch = .aarch64,
12 .os_tag = .ios,
13 });
14
15 const exe = b.addExecutable(.{
16 .name = "main",
17 .root_module = b.createModule(.{
18 .root_source_file = b.path("panic.zig"),
19 .optimize = .debug,
20 .target = target,
21 .link_libc = true,
22 }),
23 });
24
25 const io = b.graph.io;
26
27 if (std.zig.system.darwin.getSdk(b.allocator, io, &target.result)) |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.addSystemFrameworkPath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/System/Library/SubFrameworks" }) });
31 exe.root_module.addLibraryPath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/usr/lib" }) });
32 } else {
33 exe.step.dependOn(&b.addFail("no iOS SDK found").step);
34 }
35
36 exe.root_module.addCSourceFile(.{ .file = b.path("main.m"), .flags = &.{} });
37 exe.root_module.linkFramework("Foundation", .{});
38 exe.root_module.linkFramework("UIKit", .{});
39
40 test_step.dependOn(&b.addInstallArtifact(exe, .{}).step);
41}