| author | |
| committer | |
| log | 105655857f02c8bd59f5c0250f124a064df400cf |
| tree | 8011d253e5f769da3ace6654b2dd90078c3096cc |
| parent | e96f8b817a889abecc86a71961ba9a95c13c315e |
4 files changed, 20 insertions(+), 41 deletions(-)
test/link.zig-4| ... | ... | @@ -171,8 +171,4 @@ pub const cases = [_]Case{ |
| 171 | 171 | .build_root = "test/link/macho/unwind_info", |
| 172 | 172 | .import = @import("link/macho/unwind_info/build.zig"), |
| 173 | 173 | }, |
| 174 | .{ | |
| 175 | .build_root = "test/link/macho/weak_framework", | |
| 176 | .import = @import("link/macho/weak_framework/build.zig"), | |
| 177 | }, | |
| 178 | 174 | }; |
test/link/macho.zig+20| ... | ... | @@ -32,6 +32,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { |
| 32 | 32 | if (build_opts.has_macos_sdk) { |
| 33 | 33 | macho_step.dependOn(testHeaderpad(b, .{ .target = b.host })); |
| 34 | 34 | macho_step.dependOn(testNeededFramework(b, .{ .target = b.host })); |
| 35 | macho_step.dependOn(testWeakFramework(b, .{ .target = b.host })); | |
| 35 | 36 | } |
| 36 | 37 | } |
| 37 | 38 | |
| ... | ... | @@ -767,6 +768,25 @@ fn testWeakBind(b: *Build, opts: Options) *Step { |
| 767 | 768 | return test_step; |
| 768 | 769 | } |
| 769 | 770 | |
| 771 | fn testWeakFramework(b: *Build, opts: Options) *Step { | |
| 772 | const test_step = addTestStep(b, "macho-weak-framework", opts); | |
| 773 | ||
| 774 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = "int main() { return 0; }" }); | |
| 775 | exe.root_module.linkFramework("Cocoa", .{ .weak = true }); | |
| 776 | ||
| 777 | const run = addRunArtifact(exe); | |
| 778 | run.expectExitCode(0); | |
| 779 | test_step.dependOn(&run.step); | |
| 780 | ||
| 781 | const check = exe.checkObject(); | |
| 782 | check.checkInHeaders(); | |
| 783 | check.checkExact("cmd LOAD_WEAK_DYLIB"); | |
| 784 | check.checkContains("Cocoa"); | |
| 785 | test_step.dependOn(&check.step); | |
| 786 | ||
| 787 | return test_step; | |
| 788 | } | |
| 789 | ||
| 770 | 790 | fn testWeakLibrary(b: *Build, opts: Options) *Step { |
| 771 | 791 | const test_step = addTestStep(b, "macho-weak-library", opts); |
| 772 | 792 |
test/link/macho/weak_framework/build.zig deleted-34| ... | ... | @@ -1,34 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | ||
| 3 | pub const requires_symlinks = true; | |
| 4 | pub const requires_macos_sdk = true; | |
| 5 | ||
| 6 | pub fn build(b: *std.Build) void { | |
| 7 | const test_step = b.step("test", "Test it"); | |
| 8 | b.default_step = test_step; | |
| 9 | ||
| 10 | add(b, test_step, .Debug); | |
| 11 | add(b, test_step, .ReleaseFast); | |
| 12 | add(b, test_step, .ReleaseSmall); | |
| 13 | add(b, test_step, .ReleaseSafe); | |
| 14 | } | |
| 15 | ||
| 16 | fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { | |
| 17 | const exe = b.addExecutable(.{ | |
| 18 | .name = "test", | |
| 19 | .optimize = optimize, | |
| 20 | .target = b.host, | |
| 21 | }); | |
| 22 | exe.addCSourceFile(.{ .file = .{ .path = "main.c" }, .flags = &[0][]const u8{} }); | |
| 23 | exe.linkLibC(); | |
| 24 | exe.linkFrameworkWeak("Cocoa"); | |
| 25 | ||
| 26 | const check = exe.checkObject(); | |
| 27 | check.checkInHeaders(); | |
| 28 | check.checkExact("cmd LOAD_WEAK_DYLIB"); | |
| 29 | check.checkContains("Cocoa"); | |
| 30 | test_step.dependOn(&check.step); | |
| 31 | ||
| 32 | const run_cmd = b.addRunArtifact(exe); | |
| 33 | test_step.dependOn(&run_cmd.step); | |
| 34 | } |
test/link/macho/weak_framework/main.c deleted-3| ... | ... | @@ -1,3 +0,0 @@ |
| 1 | int main(int argc, char* argv[]) { | |
| 2 | return 0; | |
| 3 | } |