mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
30 lines
795 B
Zig
30 lines
795 B
Zig
const std = @import("std");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const lib = b.addLibrary(.{
|
|
.linkage = .dynamic,
|
|
.name = "mathtest",
|
|
.root_module = b.createModule(.{
|
|
.root_source_file = b.path("mathtest.zig"),
|
|
}),
|
|
.version = .{ .major = 1, .minor = 0, .patch = 0 },
|
|
});
|
|
const exe = b.addExecutable(.{
|
|
.name = "test",
|
|
.root_module = b.createModule(.{
|
|
.link_libc = true,
|
|
}),
|
|
});
|
|
exe.root_module.addCSourceFile(.{ .file = b.path("test.c"), .flags = &.{"-std=c99"} });
|
|
exe.root_module.linkLibrary(lib);
|
|
|
|
b.default_step.dependOn(&exe.step);
|
|
|
|
const run_cmd = exe.run();
|
|
|
|
const test_step = b.step("test", "Test the program");
|
|
test_step.dependOn(&run_cmd.step);
|
|
}
|
|
|
|
// syntax
|