mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
replace @panic with b.addFail in standalone test build.zig
This commit is contained in:
parent
d2b1aa48ab
commit
f0a3df98d3
1 changed files with 10 additions and 6 deletions
|
|
@ -12,9 +12,6 @@ pub fn build(b: *std.Build) void {
|
||||||
.cpu_arch = .aarch64,
|
.cpu_arch = .aarch64,
|
||||||
.os_tag = .ios,
|
.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(.{
|
const exe = b.addExecutable(.{
|
||||||
.name = "main",
|
.name = "main",
|
||||||
|
|
@ -25,10 +22,17 @@ pub fn build(b: *std.Build) void {
|
||||||
.link_libc = true,
|
.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.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("Foundation", .{});
|
||||||
exe.root_module.linkFramework("UIKit", .{});
|
exe.root_module.linkFramework("UIKit", .{});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue