mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
this is going to only work for very basic libraries; I plan to slowly add more features over time to support more complicated libraries
23 lines
636 B
Zig
23 lines
636 B
Zig
const Builder = @import("std").build.Builder;
|
|
|
|
pub fn build(b: *Builder) void {
|
|
const opts = b.standardReleaseOptions();
|
|
|
|
const lib = b.addSharedLibrary("add", "add.zig", b.version(1, 0, 0));
|
|
lib.setBuildMode(opts);
|
|
lib.linkSystemLibrary("c");
|
|
|
|
const main = b.addExecutable("main", "main.zig");
|
|
main.setBuildMode(opts);
|
|
|
|
const run = b.addCommand(".", b.env_map, [][]const u8{
|
|
main.getOutputPath(),
|
|
lib.getOutputPath(),
|
|
});
|
|
run.step.dependOn(&lib.step);
|
|
run.step.dependOn(&main.step);
|
|
|
|
const test_step = b.step("test", "Test the program");
|
|
test_step.dependOn(&run.step);
|
|
}
|