build: only build/run tests and libmach on non-wasm targets
This commit is contained in:
parent
f750f752ef
commit
728582c75e
1 changed files with 70 additions and 70 deletions
86
build.zig
86
build.zig
|
|
@ -36,6 +36,7 @@ pub fn build(b: *std.build.Builder) void {
|
||||||
};
|
};
|
||||||
const options = Options{ .gpu_dawn_options = gpu_dawn_options };
|
const options = Options{ .gpu_dawn_options = gpu_dawn_options };
|
||||||
|
|
||||||
|
if (target.getCpuArch() != .wasm32) {
|
||||||
const all_tests_step = b.step("test", "Run library tests");
|
const all_tests_step = b.step("test", "Run library tests");
|
||||||
const glfw_test_step = b.step("test-glfw", "Run GLFW library tests");
|
const glfw_test_step = b.step("test-glfw", "Run GLFW library tests");
|
||||||
const gpu_test_step = b.step("test-gpu", "Run GPU library tests");
|
const gpu_test_step = b.step("test-gpu", "Run GPU library tests");
|
||||||
|
|
@ -66,6 +67,48 @@ pub fn build(b: *std.build.Builder) void {
|
||||||
all_tests_step.dependOn(sysaudio_test_step);
|
all_tests_step.dependOn(sysaudio_test_step);
|
||||||
all_tests_step.dependOn(mach_test_step);
|
all_tests_step.dependOn(mach_test_step);
|
||||||
|
|
||||||
|
const shaderexp_app = App.init(
|
||||||
|
b,
|
||||||
|
.{
|
||||||
|
.name = "shaderexp",
|
||||||
|
.src = "shaderexp/main.zig",
|
||||||
|
.target = target,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
shaderexp_app.setBuildMode(mode);
|
||||||
|
shaderexp_app.link(options);
|
||||||
|
shaderexp_app.install();
|
||||||
|
|
||||||
|
const shaderexp_compile_step = b.step("shaderexp", "Compile shaderexp");
|
||||||
|
shaderexp_compile_step.dependOn(&shaderexp_app.getInstallStep().?.step);
|
||||||
|
|
||||||
|
const shaderexp_run_cmd = shaderexp_app.run();
|
||||||
|
shaderexp_run_cmd.dependOn(&shaderexp_app.getInstallStep().?.step);
|
||||||
|
const shaderexp_run_step = b.step("run-shaderexp", "Run shaderexp");
|
||||||
|
shaderexp_run_step.dependOn(shaderexp_run_cmd);
|
||||||
|
|
||||||
|
// compiles the `libmach` shared library
|
||||||
|
const lib = b.addSharedLibrary("mach", "src/platform/libmach.zig", .unversioned);
|
||||||
|
lib.setTarget(target);
|
||||||
|
lib.setBuildMode(mode);
|
||||||
|
lib.main_pkg_path = "src/";
|
||||||
|
const app_pkg = std.build.Pkg{
|
||||||
|
.name = "app",
|
||||||
|
.source = .{ .path = "src/platform/libmach.zig" },
|
||||||
|
};
|
||||||
|
lib.addPackage(app_pkg);
|
||||||
|
lib.addPackage(gpu.pkg);
|
||||||
|
lib.addPackage(glfw.pkg);
|
||||||
|
lib.addPackage(sysaudio.pkg);
|
||||||
|
if (target.toTarget().os.tag == .linux)
|
||||||
|
lib.addPackage(gamemode.pkg);
|
||||||
|
glfw.link(b, lib, options.glfw_options);
|
||||||
|
gpu.link(b, lib, options.gpuOptions());
|
||||||
|
gamemode.link(lib);
|
||||||
|
lib.setOutputDir("./libmach/build");
|
||||||
|
lib.install();
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: we need a way to test wasm stuff
|
// TODO: we need a way to test wasm stuff
|
||||||
// const sysjs_test_step = b.step( "test-sysjs", "Run sysjs library tests");
|
// const sysjs_test_step = b.step( "test-sysjs", "Run sysjs library tests");
|
||||||
// sysjs_test_step.dependOn(&sysjs.testStep(b, mode, target).step);
|
// sysjs_test_step.dependOn(&sysjs.testStep(b, mode, target).step);
|
||||||
|
|
@ -137,51 +180,8 @@ pub fn build(b: *std.build.Builder) void {
|
||||||
example_run_step.dependOn(example_run_cmd);
|
example_run_step.dependOn(example_run_cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.toTarget().cpu.arch != .wasm32) {
|
|
||||||
const shaderexp_app = App.init(
|
|
||||||
b,
|
|
||||||
.{
|
|
||||||
.name = "shaderexp",
|
|
||||||
.src = "shaderexp/main.zig",
|
|
||||||
.target = target,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
shaderexp_app.setBuildMode(mode);
|
|
||||||
shaderexp_app.link(options);
|
|
||||||
shaderexp_app.install();
|
|
||||||
|
|
||||||
const shaderexp_compile_step = b.step("shaderexp", "Compile shaderexp");
|
|
||||||
shaderexp_compile_step.dependOn(&shaderexp_app.getInstallStep().?.step);
|
|
||||||
|
|
||||||
const shaderexp_run_cmd = shaderexp_app.run();
|
|
||||||
shaderexp_run_cmd.dependOn(&shaderexp_app.getInstallStep().?.step);
|
|
||||||
const shaderexp_run_step = b.step("run-shaderexp", "Run shaderexp");
|
|
||||||
shaderexp_run_step.dependOn(shaderexp_run_cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
const compile_all = b.step("compile-all", "Compile all examples and applications");
|
const compile_all = b.step("compile-all", "Compile all examples and applications");
|
||||||
compile_all.dependOn(b.getInstallStep());
|
compile_all.dependOn(b.getInstallStep());
|
||||||
|
|
||||||
// compiles the `libmach` shared library
|
|
||||||
const lib = b.addSharedLibrary("mach", "src/platform/libmach.zig", .unversioned);
|
|
||||||
lib.setTarget(target);
|
|
||||||
lib.setBuildMode(mode);
|
|
||||||
lib.main_pkg_path = "src/";
|
|
||||||
const app_pkg = std.build.Pkg{
|
|
||||||
.name = "app",
|
|
||||||
.source = .{ .path = "src/platform/libmach.zig" },
|
|
||||||
};
|
|
||||||
lib.addPackage(app_pkg);
|
|
||||||
lib.addPackage(gpu.pkg);
|
|
||||||
lib.addPackage(glfw.pkg);
|
|
||||||
lib.addPackage(sysaudio.pkg);
|
|
||||||
if (target.toTarget().os.tag == .linux)
|
|
||||||
lib.addPackage(gamemode.pkg);
|
|
||||||
glfw.link(b, lib, options.glfw_options);
|
|
||||||
gpu.link(b, lib, options.gpuOptions());
|
|
||||||
gamemode.link(lib);
|
|
||||||
lib.setOutputDir("./libmach/build");
|
|
||||||
lib.install();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn testStep(b: *std.build.Builder, mode: std.builtin.Mode, target: std.zig.CrossTarget) *std.build.RunStep {
|
fn testStep(b: *std.build.Builder, mode: std.builtin.Mode, target: std.zig.CrossTarget) *std.build.RunStep {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue