master
 1const std = @import("std");
 2
 3pub fn build(b: *std.Build) void {
 4    const target = b.standardTargetOptions(.{});
 5    const optimize = b.standardOptimizeOption(.{});
 6
 7    const link_step = b.step("link", "Link with libcxx");
 8    const run_step = b.step("run", "Run executables");
 9    b.default_step = link_step;
10
11    {
12        const exe = b.addExecutable(.{
13            .name = "mt",
14            .root_module = b.createModule(.{
15                .root_source_file = b.path("mt.zig"),
16                .target = target,
17                .optimize = optimize,
18                .link_libcpp = true,
19            }),
20        });
21        exe.root_module.addCSourceFile(.{ .file = b.path("mt_doit.cpp") });
22        link_step.dependOn(&exe.step);
23        b.installArtifact(exe);
24        run_step.dependOn(&b.addRunArtifact(exe).step);
25    }
26    {
27        const exe = b.addExecutable(.{
28            .name = "st",
29            .root_module = b.createModule(.{
30                .root_source_file = b.path("st.zig"),
31                .target = target,
32                .optimize = optimize,
33                .link_libcpp = true,
34                .single_threaded = true,
35            }),
36        });
37        exe.root_module.addCSourceFile(.{ .file = b.path("st_doit.cpp") });
38        link_step.dependOn(&exe.step);
39        b.installArtifact(exe);
40        run_step.dependOn(&b.addRunArtifact(exe).step);
41    }
42}