zig/example/shared_library/build.zig
Andrew Kelley fb492d19eb zig build system supports building a library
See #329

Supporting work:
 * move std.cstr.Buffer0 to std.buffer.Buffer
 * add build.zig to example/shared_library/ and add an automated test
   for it
 * add std.list.List.resizeDown
 * improve std.os.makePath
   - no longer recursive
   - takes into account . and ..
 * add std.os.path.isAbsolute
 * add std.os.path.resolve
 * reimplement std.os.path.dirname
   - no longer requires an allocator
   - handles edge cases correctly
2017-04-21 01:56:12 -04:00

21 lines
590 B
Zig

const Builder = @import("std").build.Builder;
pub fn build(b: &Builder) {
const lib = b.addSharedLibrary("mathtest", "mathtest.zig", b.version(1, 0, 0));
const exe = b.addCExecutable("test");
exe.addCompileFlags([][]const u8 {
"-std=c99",
});
exe.addSourceFile("test.c");
exe.linkLibrary(lib);
b.default_step.dependOn(&exe.step);
const run_cmd = b.addCommand(b.out_dir, b.env_map, "./test", [][]const u8{});
run_cmd.step.dependOn(&exe.step);
const test_step = b.step("test", "Test the program");
test_step.dependOn(&run_cmd.step);
}