sysjs: update to latest Zig build API
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
ae06ca541f
commit
4e9fbbdd4d
1 changed files with 16 additions and 12 deletions
|
|
@ -1,24 +1,28 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *std.build.Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const mode = b.standardReleaseOptions();
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
const test_step = b.step("test", "Run library tests");
|
const test_step = b.step("test", "Run library tests");
|
||||||
test_step.dependOn(&testStep(b, mode, target).step);
|
test_step.dependOn(&testStep(b, optimize, target).step);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn testStep(b: *std.build.Builder, mode: std.builtin.Mode, target: std.zig.CrossTarget) *std.build.RunStep {
|
pub fn testStep(b: *std.Build, optimize: std.builtin.OptimizeMode, target: std.zig.CrossTarget) *std.build.RunStep {
|
||||||
const main_tests = b.addTestExe("sysjs-tests", sdkPath("/src/main.zig"));
|
const main_tests = b.addTest(.{
|
||||||
main_tests.setBuildMode(mode);
|
.name = "sysjs-tests",
|
||||||
main_tests.setTarget(target);
|
.kind = .test_exe,
|
||||||
|
.root_source_file = .{ .path = sdkPath("/src/main.zig") },
|
||||||
|
.target = target,
|
||||||
|
.optimize = optimize,
|
||||||
|
});
|
||||||
return main_tests.run();
|
return main_tests.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const pkg = std.build.Pkg{
|
pub fn module(b: *std.Build) *std.build.Module {
|
||||||
.name = "sysjs",
|
return b.createModule(.{
|
||||||
.source = .{ .path = sdkPath("/src/main.zig") },
|
.source_file = .{ .path = sdkPath("/src/main.zig") },
|
||||||
.dependencies = &[_]std.build.Pkg{},
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
fn sdkPath(comptime suffix: []const u8) []const u8 {
|
fn sdkPath(comptime suffix: []const u8) []const u8 {
|
||||||
if (suffix[0] != '/') @compileError("suffix must be an absolute path");
|
if (suffix[0] != '/') @compileError("suffix must be an absolute path");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue