all: use std.Build.installArtifact

This commit is contained in:
Vivek Roy 2023-04-13 16:53:31 -07:00 committed by Stephen Gutekanst
parent beef56a023
commit ff0258f27d
16 changed files with 53 additions and 53 deletions

View file

@ -64,9 +64,9 @@ pub fn build(b: *std.Build) !void {
});
app.addModule("mach", module(b));
if (app.target.getOsTag() == .windows) app.linkLibC();
app.install();
b.installArtifact(app);
const app_run_cmd = app.run();
const app_run_cmd = b.addRunArtifact(app);
if (b.args) |args| app_run_cmd.addArgs(args);
const app_run_step = b.step("run", "Run Mach Engine Application");
app_run_step.dependOn(&app_run_cmd.step);
@ -142,8 +142,8 @@ fn testStep(b: *std.Build, optimize: std.builtin.OptimizeMode, target: std.zig.C
while (iter.next()) |e| {
main_tests.addModule(e.key_ptr.*, e.value_ptr.*);
}
main_tests.install();
return main_tests.run();
b.installArtifact(main_tests);
return b.addRunArtifact(main_tests);
}
pub const App = struct {

View file

@ -48,8 +48,8 @@ pub fn testStep(b: *Build, optimize: std.builtin.OptimizeMode, target: std.zig.C
.encoder = .{},
.transcoder = .{},
});
main_tests.install();
return main_tests.run();
b.installArtifact(main_tests);
return b.addRunArtifact(main_tests);
}
pub fn link(b: *Build, step: *std.build.CompileStep, target: std.zig.CrossTarget, optimize: std.builtin.OptimizeMode, options: Options) void {
@ -83,7 +83,7 @@ pub fn buildEncoder(b: *Build, target: std.zig.CrossTarget, optimize: std.builti
encoder.defineCMacro("BASISD_SUPPORT_KTX2_ZSTD", "0");
if (options.install_libs)
encoder.install();
b.installArtifact(encoder);
return encoder;
}
@ -106,7 +106,7 @@ pub fn buildTranscoder(b: *Build, target: std.zig.CrossTarget, optimize: std.bui
transcoder.defineCMacro("BASISD_SUPPORT_KTX2_ZSTD", "0");
if (options.install_libs)
transcoder.install();
b.installArtifact(transcoder);
return transcoder;
}

View file

@ -53,7 +53,7 @@ pub fn build(b: *std.Build) !void {
// Compiles the `libmachcore` shared library
const shared_lib = try core.buildSharedLib(b, optimize, target, options);
shared_lib.install();
b.installArtifact(shared_lib);
}
const compile_all = b.step("compile-all", "Compile Mach");

View file

@ -25,7 +25,7 @@ pub fn testStep(b: *std.Build, optimize: std.builtin.OptimizeMode, target: std.z
.target = target,
.optimize = optimize,
});
lib_tests.install();
b.installArtifact(lib_tests);
const main_tests = b.addTest(.{
.name = "dusk-tests",
@ -34,11 +34,11 @@ pub fn testStep(b: *std.Build, optimize: std.builtin.OptimizeMode, target: std.z
.optimize = optimize,
});
main_tests.addModule("dusk", module(b));
main_tests.install();
b.installArtifact(main_tests);
const run_step = main_tests.run();
run_step.step.dependOn(&lib_tests.run().step);
return main_tests.run();
const run_step = b.addRunArtifact(main_tests);
run_step.step.dependOn(&b.addRunArtifact(lib_tests).step);
return b.addRunArtifact(main_tests);
}
fn sdkPath(comptime suffix: []const u8) []const u8 {

View file

@ -9,7 +9,7 @@ pub fn build(b: *std.Build) void {
.target = target,
.optimize = optimize,
});
lib.install();
b.installArtifact(lib);
const main_tests = b.addTest(.{
.name = "earcut-tests",

View file

@ -24,8 +24,8 @@ pub fn testStep(b: *std.Build, optimize: std.builtin.OptimizeMode, target: std.z
.target = target,
.optimize = optimize,
});
main_tests.install();
return main_tests.run();
b.installArtifact(main_tests);
return b.addRunArtifact(main_tests);
}
fn sdkPath(comptime suffix: []const u8) []const u8 {

View file

@ -74,7 +74,7 @@ pub fn build(b: *std.Build) !void {
var example_compile_step = b.step("example-" ++ example, "Compile '" ++ example ++ "' example");
example_compile_step.dependOn(&example_install.step);
const example_run_cmd = example_exe.run();
const example_run_cmd = b.addRunArtifact(example_exe);
if (b.args) |args| {
example_run_cmd.addArgs(args);
}
@ -99,7 +99,7 @@ pub fn testStep(b: *Build, optimize: std.builtin.OptimizeMode, target: std.zig.C
.harfbuzz = .{},
});
main_tests.main_pkg_path = sdkPath("/");
main_tests.install();
b.installArtifact(main_tests);
const harfbuzz_tests = b.addTest(.{
.name = "harfbuzz-tests",
@ -115,10 +115,10 @@ pub fn testStep(b: *Build, optimize: std.builtin.OptimizeMode, target: std.zig.C
.harfbuzz = .{},
});
harfbuzz_tests.main_pkg_path = sdkPath("/");
harfbuzz_tests.install();
b.installArtifact(harfbuzz_tests);
const main_tests_run = main_tests.run();
main_tests_run.step.dependOn(&harfbuzz_tests.run().step);
const main_tests_run = b.addRunArtifact(main_tests);
main_tests_run.step.dependOn(&b.addRunArtifact(harfbuzz_tests).step);
return main_tests_run;
}
@ -135,7 +135,7 @@ pub fn linkFreetype(b: *Build, step: *std.build.CompileStep, options: FreetypeOp
if (options.brotli) {
const brotli_lib = buildBrotli(b, step.optimize, step.target);
if (options.install_libs)
brotli_lib.install();
b.installArtifact(brotli_lib);
step.linkLibrary(brotli_lib);
}
}
@ -187,7 +187,7 @@ pub fn buildFreetype(b: *Build, optimize: std.builtin.OptimizeMode, target: std.
lib.addCSourceFiles(freetype_base_sources, &.{});
if (options.install_libs)
lib.install();
b.installArtifact(lib);
return lib;
}
@ -204,7 +204,7 @@ pub fn buildHarfbuzz(b: *Build, optimize: std.builtin.OptimizeMode, target: std.
lib.defineCMacro("HAVE_FREETYPE", "1");
if (options.install_libs)
lib.install();
b.installArtifact(lib);
return lib;
}

View file

@ -23,8 +23,8 @@ pub fn testStep(b: *Build, optimize: std.builtin.OptimizeMode, target: std.zig.C
});
try link(b, main_tests, .{});
main_tests.install();
return main_tests.run();
b.installArtifact(main_tests);
return b.addRunArtifact(main_tests);
}
fn testStepShared(b: *Build, optimize: std.builtin.OptimizeMode, target: std.zig.CrossTarget) !*std.build.RunStep {
@ -37,8 +37,8 @@ fn testStepShared(b: *Build, optimize: std.builtin.OptimizeMode, target: std.zig
});
try link(b, main_tests, .{ .shared = true });
main_tests.install();
return main_tests.run();
b.installArtifact(main_tests);
return b.addRunArtifact(main_tests);
}
pub const Options = struct {
@ -110,7 +110,7 @@ fn buildLibrary(b: *Build, optimize: std.builtin.OptimizeMode, target: std.zig.C
linkGLFWDependencies(b, lib, options);
if (options.install_libs)
lib.install();
b.installArtifact(lib);
return lib;
}

View file

@ -28,5 +28,5 @@ pub fn build(b: *Build) !void {
try gpu_dawn.link(b, example, options);
try glfw.link(b, example, .{ .system_sdk = .{ .set_sysroot = false } });
example.addModule("glfw", glfw.module(b));
example.install();
b.installArtifact(example);
}

View file

@ -120,7 +120,7 @@ pub fn Sdk(comptime deps: anytype) type {
});
lib_dawn.linkLibCpp();
if (options.install_libs)
lib_dawn.install();
b.installArtifact(lib_dawn);
step.linkLibrary(lib_dawn);
_ = try buildLibMachDawnNative(b, lib_dawn, options);
@ -573,7 +573,7 @@ pub fn Sdk(comptime deps: anytype) type {
});
separate_lib.linkLibCpp();
if (options.install_libs)
separate_lib.install();
b.installArtifact(separate_lib);
break :blk separate_lib;
};
@ -607,7 +607,7 @@ pub fn Sdk(comptime deps: anytype) type {
});
separate_lib.linkLibCpp();
if (options.install_libs)
separate_lib.install();
b.installArtifact(separate_lib);
break :blk separate_lib;
};
@ -661,7 +661,7 @@ pub fn Sdk(comptime deps: anytype) type {
});
separate_lib.linkLibCpp();
if (options.install_libs)
separate_lib.install();
b.installArtifact(separate_lib);
break :blk separate_lib;
};
@ -734,7 +734,7 @@ pub fn Sdk(comptime deps: anytype) type {
});
separate_lib.linkLibCpp();
if (options.install_libs)
separate_lib.install();
b.installArtifact(separate_lib);
break :blk separate_lib;
};
deps.system_sdk.include(b, lib, .{});
@ -1020,7 +1020,7 @@ pub fn Sdk(comptime deps: anytype) type {
});
separate_lib.linkLibCpp();
if (options.install_libs)
separate_lib.install();
b.installArtifact(separate_lib);
break :blk separate_lib;
};
@ -1175,7 +1175,7 @@ pub fn Sdk(comptime deps: anytype) type {
});
separate_lib.linkLibCpp();
if (options.install_libs)
separate_lib.install();
b.installArtifact(separate_lib);
break :blk separate_lib;
};
@ -1244,7 +1244,7 @@ pub fn Sdk(comptime deps: anytype) type {
});
separate_lib.linkLibCpp();
if (options.install_libs)
separate_lib.install();
b.installArtifact(separate_lib);
break :blk separate_lib;
};
deps.system_sdk.include(b, lib, .{});
@ -1308,7 +1308,7 @@ pub fn Sdk(comptime deps: anytype) type {
});
separate_lib.linkLibCpp();
if (options.install_libs)
separate_lib.install();
b.installArtifact(separate_lib);
break :blk separate_lib;
};
@ -1346,7 +1346,7 @@ pub fn Sdk(comptime deps: anytype) type {
});
separate_lib.linkLibCpp();
if (options.install_libs)
separate_lib.install();
b.installArtifact(separate_lib);
break :blk separate_lib;
};
@ -1421,7 +1421,7 @@ pub fn Sdk(comptime deps: anytype) type {
});
separate_lib.linkLibCpp();
if (options.install_libs)
separate_lib.install();
b.installArtifact(separate_lib);
break :blk separate_lib;
};
deps.system_sdk.include(b, lib, .{});

View file

@ -33,9 +33,9 @@ pub fn build(b: *std.Build) !void {
example.addModule("glfw", glfw.module(b));
try gpu.link(b, example, .{ .gpu_dawn_options = gpu_dawn_options });
try glfw.link(b, example, .{});
example.install();
b.installArtifact(example);
const example_run_cmd = example.run();
const example_run_cmd = b.addRunArtifact(example);
example_run_cmd.step.dependOn(b.getInstallStep());
const example_run_step = b.step("run-example", "Run the example");
example_run_step.dependOn(&example_run_cmd.step);

View file

@ -11,8 +11,8 @@ pub fn Sdk(comptime deps: anytype) type {
.optimize = optimize,
});
try link(b, main_tests, options);
main_tests.install();
return main_tests.run();
b.installArtifact(main_tests);
return b.addRunArtifact(main_tests);
}
pub const Options = struct {

View file

@ -25,8 +25,8 @@ pub fn testStep(b: *std.Build, optimize: std.builtin.OptimizeMode, target: std.z
.optimize = optimize,
});
link(b, main_tests, target);
main_tests.install();
return main_tests.run();
b.installArtifact(main_tests);
return b.addRunArtifact(main_tests);
}
pub fn link(b: *std.Build, step: *std.build.CompileStep, target: std.zig.CrossTarget) void {

View file

@ -25,7 +25,7 @@ pub fn build(b: *std.Build) void {
});
example_exe.addModule("sysaudio", sysaudio.module(b));
sysaudio.link(b, example_exe, .{});
example_exe.install();
b.installArtifact(example_exe);
const example_compile_step = b.step("example-" ++ example, "Compile '" ++ example ++ "' example");
example_compile_step.dependOn(b.getInstallStep());

View file

@ -30,8 +30,8 @@ pub fn Sdk(comptime deps: anytype) type {
.optimize = optimize,
});
link(b, main_tests, .{});
main_tests.install();
return main_tests.run();
b.installArtifact(main_tests);
return b.addRunArtifact(main_tests);
}
pub fn link(b: *std.Build, step: *std.build.CompileStep, options: Options) void {
@ -48,7 +48,7 @@ pub fn Sdk(comptime deps: anytype) type {
}
}
if (options.install_libs) {
step.install();
b.installArtifact(step);
}
}

View file

@ -15,7 +15,7 @@ pub fn testStep(b: *std.Build, optimize: std.builtin.OptimizeMode, target: std.z
.target = target,
.optimize = optimize,
});
return main_tests.run();
return b.addRunArtifact(main_tests);
}
var _module: ?*std.build.Module = null;