File tree 4 files changed +32
-0
lines changed
4 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,10 @@ fn addMachOCases(cases: *tests.StandaloneContext) void {
74
74
.build_modes = true ,
75
75
});
76
76
77
+ cases .addBuildFile ("test/link/macho/empty/build.zig" , .{
78
+ .build_modes = true ,
79
+ });
80
+
77
81
cases .addBuildFile ("test/link/macho/entry/build.zig" , .{
78
82
.build_modes = true ,
79
83
});
Original file line number Diff line number Diff line change
1
+ const std = @import ("std" );
2
+ const Builder = std .build .Builder ;
3
+ const LibExeObjectStep = std .build .LibExeObjStep ;
4
+
5
+ pub fn build (b : * Builder ) void {
6
+ const mode = b .standardReleaseOptions ();
7
+ const target : std.zig.CrossTarget = .{ .os_tag = .macos };
8
+
9
+ const test_step = b .step ("test" , "Test the program" );
10
+ test_step .dependOn (b .getInstallStep ());
11
+
12
+ const exe = b .addExecutable ("test" , null );
13
+ exe .addCSourceFile ("main.c" , &[0 ][]const u8 {});
14
+ exe .addCSourceFile ("empty.c" , &[0 ][]const u8 {});
15
+ exe .setBuildMode (mode );
16
+ exe .setTarget (target );
17
+ exe .linkLibC ();
18
+
19
+ const run_cmd = exe .run ();
20
+ run_cmd .expectStdOutEqual ("Hello!\n " );
21
+ test_step .dependOn (& run_cmd .step );
22
+ }
Original file line number Diff line number Diff line change
1
+ #include <stdio.h>
2
+
3
+ int main (int argc , char * argv []) {
4
+ printf ("Hello!\n" );
5
+ return 0 ;
6
+ }
You can’t perform that action at this time.
0 commit comments