zig/test/standalone/ios/build.zig
Andrew Kelley bee8005fe6 std.heap.DebugAllocator: never detect TTY config
instead, allow the user to set it as a field.

this fixes a bug where leak printing and error printing would run tty
config detection for stderr, and then emit a log, which is not necessary
going to print to stderr.

however, the nice defaults are gone; the user must explicitly assign the
tty_config field during initialization or else the logging will not have
color.

related: https://github.com/ziglang/zig/issues/24510
2025-12-23 22:15:08 -08:00

46 lines
1.5 KiB
Zig

const std = @import("std");
pub const requires_symlinks = true;
pub const requires_ios_sdk = true;
pub fn build(b: *std.Build) void {
const test_step = b.step("test", "Test it");
b.default_step = test_step;
const optimize: std.builtin.OptimizeMode = .Debug;
const target = b.resolveTargetQuery(.{
.cpu_arch = .aarch64,
.os_tag = .ios,
});
const exe = b.addExecutable(.{
.name = "main",
.root_module = b.createModule(.{
.root_source_file = null,
.optimize = optimize,
.target = target,
.link_libc = true,
}),
});
const io = b.graph.io;
if (std.zig.system.darwin.getSdk(b.allocator, io, &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.linkFramework("Foundation", .{});
exe.root_module.linkFramework("UIKit", .{});
const check = exe.checkObject();
check.checkInHeaders();
check.checkExact("cmd BUILD_VERSION");
check.checkExact("platform IOS");
test_step.dependOn(&check.step);
}