const std = @import("std"); pub fn build(b: *std.Build) void { const optimize = b.standardOptimizeOption(.{}); const target = b.standardTargetOptions(.{}); var rubylibdir = std.os.getenv("RUBYLIBDIR") orelse ""; var rubyhdrdir = std.os.getenv("RUBYHDRDIR") orelse ""; var rubyarchhdrdir = std.os.getenv("RUBYARCHHDRDIR") orelse ""; //////////////////////////////////////////////////////////////// // lib const lib = b.addSharedLibrary(.{ .name = "zigrb_100doors", .root_source_file = .{ .path = "src/main.zig" }, .target = target, .optimize = optimize, }); lib.addLibraryPath(rubylibdir); lib.addIncludePath(rubyhdrdir); lib.addIncludePath(rubyarchhdrdir); lib.linkSystemLibrary("ruby"); lib.linkSystemLibrary("c"); b.installArtifact(lib); //////////////////////////////////////////////////////////////// // test const unit_tests = b.addTest(.{ .root_source_file = .{ .path = "src/main.zig" }, .target = target, .optimize = optimize, }); unit_tests.addLibraryPath(rubylibdir); unit_tests.addIncludePath(rubyhdrdir); unit_tests.addIncludePath(rubyarchhdrdir); unit_tests.linkSystemLibrary("ruby"); unit_tests.linkSystemLibrary("c"); const run_unit_tests = b.addRunArtifact(unit_tests); const test_step = b.step("test", "Run unit tests"); test_step.dependOn(&run_unit_tests.step); }