zig-015-shared-bug/build.zig

41 lines
1.0 KiB
Zig

const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const lib = b.addLibrary(.{
.name = "shared",
.root_module = b.createModule(.{
.root_source_file = b.path("lib.zig"),
.target = target,
.link_libc = true,
.optimize = optimize,
}),
.linkage = .dynamic,
});
lib.linkLibC();
b.installArtifact(lib);
const exe = b.addExecutable(.{
.name = "repro",
.root_module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.link_libc = true,
.target = target,
.optimize = optimize,
}),
});
b.installArtifact(exe);
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run the test program");
run_step.dependOn(&run_cmd.step);
}