aboutsummaryrefslogtreecommitdiff
path: root/guile-zig-local/build.zig
blob: 24aeb3adb5ff40430c719833f9753dc6b0031fa7 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const std = @import("std");

pub fn build(b: *std.build.Builder) void {
    // Standard release options allow the person running `zig build` to select
    // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
    const mode = b.standardReleaseOptions();

    // const lib = b.addStaticLibrary("zig", "my.zig");
    const lib = b.addSharedLibrary("zig", "my.zig", .unversioned);
    lib.setBuildMode(mode);
    switch (mode) {
        .Debug, .ReleaseSafe => lib.bundle_compiler_rt = true,
        .ReleaseFast, .ReleaseSmall => lib.disable_stack_probing = true,
    }
    lib.force_pic = true;
    // lib.emit_h = true; future version of zig?
    lib.install();

    const main_tests = b.addTest("my.zig");
    main_tests.setBuildMode(mode);
    main_tests.addLibraryPath("build");
    main_tests.addObjectFile("build/libmy.so");

    const test_step = b.step("test", "Run library tests");
    test_step.dependOn(&main_tests.step);
}