mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
link-test: add test for entry in a static archive for MachO
This commit is contained in:
parent
6f83a741d8
commit
3874df839d
@ -104,6 +104,10 @@ pub const cases = [_]Case{
|
||||
.build_root = "test/link/macho/entry",
|
||||
.import = @import("link/macho/entry/build.zig"),
|
||||
},
|
||||
.{
|
||||
.build_root = "test/link/macho/entry_in_archive",
|
||||
.import = @import("link/macho/entry_in_archive/build.zig"),
|
||||
},
|
||||
.{
|
||||
.build_root = "test/link/macho/headerpad",
|
||||
.import = @import("link/macho/headerpad/build.zig"),
|
||||
|
||||
35
test/link/macho/entry_in_archive/build.zig
Normal file
35
test/link/macho/entry_in_archive/build.zig
Normal file
@ -0,0 +1,35 @@
|
||||
const std = @import("std");
|
||||
|
||||
pub const requires_symlinks = true;
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const test_step = b.step("test", "Test it");
|
||||
b.default_step = test_step;
|
||||
|
||||
add(b, test_step, .Debug);
|
||||
add(b, test_step, .ReleaseFast);
|
||||
add(b, test_step, .ReleaseSmall);
|
||||
add(b, test_step, .ReleaseSafe);
|
||||
}
|
||||
|
||||
fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
|
||||
const lib = b.addStaticLibrary(.{
|
||||
.name = "main",
|
||||
.optimize = optimize,
|
||||
.target = .{ .os_tag = .macos },
|
||||
});
|
||||
lib.addCSourceFile("main.c", &.{});
|
||||
lib.linkLibC();
|
||||
|
||||
const exe = b.addExecutable(.{
|
||||
.name = "main",
|
||||
.optimize = optimize,
|
||||
.target = .{ .os_tag = .macos },
|
||||
});
|
||||
exe.linkLibrary(lib);
|
||||
exe.linkLibC();
|
||||
|
||||
const run = exe.run();
|
||||
run.expectExitCode(0);
|
||||
test_step.dependOn(&run.step);
|
||||
}
|
||||
5
test/link/macho/entry_in_archive/main.c
Normal file
5
test/link/macho/entry_in_archive/main.c
Normal file
@ -0,0 +1,5 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
return 0;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user