Sha256: 6ee139579dc2e6c4dab1bd59df0bcefd85d1cbc7512154eaab297914331da428

Contents?: true

Size: 1.4 KB

Versions: 1

Compression:

Stored size: 1.4 KB

Contents

const std = @import("std");

pub fn build(b: *std.Build) void {
    const optimize = b.standardOptimizeOption(.{});
    const target = b.standardTargetOptions(.{});

    ////////////////////////////////////////////////////////////////
    // lib

    const clib = b.addStaticLibrary(.{
        .name = "zigrb_lucas_lehmer",
        .root_source_file = .{ .path = "src/lucas_lehmer.c" },
        .target = target,
        .optimize = optimize,
    });
    clib.force_pic = true;

    clib.linkSystemLibrary("gmp");

    const lib = b.addSharedLibrary(.{
        .name = "zigrb_lucas_lehmer",
        .root_source_file = .{ .path = "src/wrapper.zig" },
        .target = target,
        .optimize = optimize,
    });

    lib.linkSystemLibrary("ruby");
    lib.linkSystemLibrary("c");

    lib.addIncludePath("src");
    lib.linkLibrary(clib);

    b.installArtifact(lib);

    ////////////////////////////////////////////////////////////////
    // test

    const unit_tests = b.addTest(.{
        .root_source_file = .{ .path = "src/wrapper.zig" },
        .target = target,
        .optimize = optimize,
    });

    unit_tests.linkSystemLibrary("ruby");
    unit_tests.linkSystemLibrary("c");

    unit_tests.addIncludePath("src");
    unit_tests.linkLibrary(clib);

    const run_unit_tests = b.addRunArtifact(unit_tests);
    const test_step = b.step("test", "Run unit tests");
    test_step.dependOn(&run_unit_tests.step);
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zig_example-0.3.1 ext/zigrb_lucas_lehmer/build.zig