aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2023-08-28 21:39:25 +0200
committerJakub Konka <kubkon@jakubkonka.com>2023-08-29 06:43:41 +0200
commit3b2b9fcbc5e162063febf989883f29e55cc64c65 (patch)
treec85bbce50c24a18df10e08889b1cb3cc3f69e335 /test
parentc429bb5d2feb36f83e33ef95a25dd5bb7455f16c (diff)
downloadzig-3b2b9fcbc5e162063febf989883f29e55cc64c65.tar.gz
zig-3b2b9fcbc5e162063febf989883f29e55cc64c65.zip
darwin: move inference of SDK version into the linker
`std.zig.system.darwin.getSdk` now pulls only the SDK path so we execute a child process only once and not twice as it was until now since we parse the SDK version directly from the pulled path. This is actually how `ld64` does it too.
Diffstat (limited to 'test')
-rw-r--r--test/link/macho/bugs/13056/build.zig6
-rw-r--r--test/standalone/ios/build.zig8
2 files changed, 7 insertions, 7 deletions
diff --git a/test/link/macho/bugs/13056/build.zig b/test/link/macho/bugs/13056/build.zig
index 50eb990583..5b19daab3c 100644
--- a/test/link/macho/bugs/13056/build.zig
+++ b/test/link/macho/bugs/13056/build.zig
@@ -23,13 +23,13 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
.name = "test",
.optimize = optimize,
});
- exe.addSystemIncludePath(.{ .path = b.pathJoin(&.{ sdk.path, "/usr/include" }) });
- exe.addIncludePath(.{ .path = b.pathJoin(&.{ sdk.path, "/usr/include/c++/v1" }) });
+ exe.addSystemIncludePath(.{ .path = b.pathJoin(&.{ sdk, "/usr/include" }) });
+ exe.addIncludePath(.{ .path = b.pathJoin(&.{ sdk, "/usr/include/c++/v1" }) });
exe.addCSourceFile(.{ .file = .{ .path = "test.cpp" }, .flags = &.{
"-nostdlib++",
"-nostdinc++",
} });
- exe.addObjectFile(.{ .path = b.pathJoin(&.{ sdk.path, "/usr/lib/libc++.tbd" }) });
+ exe.addObjectFile(.{ .path = b.pathJoin(&.{ sdk, "/usr/lib/libc++.tbd" }) });
const run_cmd = b.addRunArtifact(exe);
run_cmd.expectStdErrEqual("x: 5\n");
diff --git a/test/standalone/ios/build.zig b/test/standalone/ios/build.zig
index 4e409cb5a3..cd10af21cf 100644
--- a/test/standalone/ios/build.zig
+++ b/test/standalone/ios/build.zig
@@ -14,7 +14,7 @@ pub fn build(b: *std.Build) void {
};
const target_info = std.zig.system.NativeTargetInfo.detect(target) catch @panic("couldn't detect native target");
const sdk = std.zig.system.darwin.getSdk(b.allocator, target_info.target) orelse @panic("no iOS SDK found");
- b.sysroot = sdk.path;
+ b.sysroot = sdk;
const exe = b.addExecutable(.{
.name = "main",
@@ -22,9 +22,9 @@ pub fn build(b: *std.Build) void {
.target = target,
});
exe.addCSourceFile(.{ .file = .{ .path = "main.m" }, .flags = &.{} });
- exe.addSystemIncludePath(.{ .path = b.pathJoin(&.{ sdk.path, "/usr/include" }) });
- exe.addSystemFrameworkPath(.{ .path = b.pathJoin(&.{ sdk.path, "/System/Library/Frameworks" }) });
- exe.addLibraryPath(.{ .path = b.pathJoin(&.{ sdk.path, "/usr/lib" }) });
+ exe.addSystemIncludePath(.{ .path = b.pathJoin(&.{ sdk, "/usr/include" }) });
+ exe.addSystemFrameworkPath(.{ .path = b.pathJoin(&.{ sdk, "/System/Library/Frameworks" }) });
+ exe.addLibraryPath(.{ .path = b.pathJoin(&.{ sdk, "/usr/lib" }) });
exe.linkFramework("Foundation");
exe.linkFramework("UIKit");
exe.linkLibC();