core: update to latest Zig build API

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2023-04-25 09:19:50 -07:00 committed by Stephen Gutekanst
parent ff0258f27d
commit 80a071be37
2 changed files with 7 additions and 9 deletions

View file

@ -46,8 +46,8 @@ pub fn Sdk(comptime deps: anytype) type {
deps.gamemode.link(main_tests);
}
main_tests.addIncludePath(sdkPath("/include"));
main_tests.install();
return main_tests.run();
b.installArtifact(main_tests);
return b.addRunArtifact(main_tests);
}
pub fn buildSharedLib(b: *std.Build, optimize: std.builtin.OptimizeMode, target: std.zig.CrossTarget, options: Options) !*std.build.CompileStep {
@ -176,7 +176,7 @@ pub fn Sdk(comptime deps: anytype) type {
}
pub fn install(app: *const App) void {
app.step.install();
app.b.installArtifact(app.step);
// Install additional files (mach.js and mach-sysjs.js)
// in case of wasm
@ -208,15 +208,15 @@ pub fn Sdk(comptime deps: anytype) type {
}
}
pub fn run(app: *const App) *std.build.RunStep {
pub fn addRunArtifact(app: *const App) *std.build.RunStep {
if (app.platform == .web) {
@panic("cannot run wasm binary; use mach app instead");
@panic("mach: to run wasm binaries, use `mach build` instead of `zig build`");
}
return app.step.run();
return app.b.addRunArtifact(app.step);
}
pub fn getInstallStep(app: *const App) ?*std.build.InstallArtifactStep {
return app.step.install_step;
return app.b.addInstallArtifact(app.step);
}
};
};