const std = @import("std"); pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); const catch2 = b.dependency("Catch2", .{ .target = target, .optimize = optimize }); const tests = b.addExecutable(.{ .name = "tests", .target = target, .optimize = optimize, .link_libc = true, .pic = true, }); tests.addIncludePath(b.path("include")); tests.linkLibCpp(); tests.linkLibrary(catch2.artifact("Catch2Main")); tests.addIncludePath(catch2.artifact("Catch2").getEmittedIncludeTree()); tests.addCSourceFiles(.{ .files = &.{ "tests/test_Term.cpp", }, .flags = &.{ "-std=c++17", "-Wall", "-Werror", }, }); b.installArtifact(tests); const run_tests = b.addRunArtifact(tests); run_tests.step.dependOn(b.getInstallStep()); if (b.args) |args| { run_tests.addArgs(args); } b.step("tests", "Run the tests").dependOn(&run_tests.step); }