mirror of
https://github.com/ziglang/zig.git
synced 2025-12-28 09:03:21 +00:00
32 lines
972 B
Zig
32 lines
972 B
Zig
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 target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
|
|
|
const exe = b.addExecutable(.{
|
|
.name = "test",
|
|
.optimize = optimize,
|
|
.target = target,
|
|
});
|
|
exe.addCSourceFile(.{ .file = .{ .path = "main.c" }, .flags = &[0][]const u8{} });
|
|
exe.addCSourceFile(.{ .file = .{ .path = "empty.c" }, .flags = &[0][]const u8{} });
|
|
exe.linkLibC();
|
|
|
|
const run_cmd = b.addRunArtifact(exe);
|
|
run_cmd.skip_foreign_checks = true;
|
|
run_cmd.expectStdOutEqual("Hello!\n");
|
|
test_step.dependOn(&run_cmd.step);
|
|
}
|