aboutsummaryrefslogtreecommitdiff
path: root/test/c_abi/build.zig
blob: b9151f6dda121d65f63bd6c7ff0d48ba3b82c42f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const Builder = @import("std").build.Builder;

pub fn build(b: *Builder) void {
    const rel_opts = b.standardReleaseOptions();
    const target = b.standardTargetOptions(.{});

    const c_obj = b.addObject("cfuncs", null);
    c_obj.addCSourceFile("cfuncs.c", &[_][]const u8{"-std=c99"});
    c_obj.setBuildMode(rel_opts);
    c_obj.linkSystemLibrary("c");
    c_obj.target = target;

    const main = b.addTest("main.zig");
    main.setBuildMode(rel_opts);
    main.addObject(c_obj);
    main.target = target;

    const test_step = b.step("test", "Test the program");
    test_step.dependOn(&main.step);

    b.default_step.dependOn(test_step);
}