all: build: install tests exe
This commit is contained in:
parent
a6a678b912
commit
b500b04c41
8 changed files with 70 additions and 60 deletions
22
build.zig
22
build.zig
|
|
@ -18,25 +18,27 @@ pub fn build(b: *std.build.Builder) void {
|
|||
};
|
||||
const options = Options{ .gpu_dawn_options = gpu_dawn_options };
|
||||
|
||||
const main_tests = b.addTest("src/main.zig");
|
||||
const main_tests = b.addTestExe("mach-tests", "src/main.zig");
|
||||
main_tests.setBuildMode(mode);
|
||||
main_tests.setTarget(target);
|
||||
main_tests.addPackage(pkg);
|
||||
main_tests.addPackage(gpu.pkg);
|
||||
main_tests.addPackage(glfw.pkg);
|
||||
main_tests.install();
|
||||
|
||||
const test_step = b.step("test", "Run library tests");
|
||||
test_step.dependOn(&main_tests.step);
|
||||
test_step.dependOn(&main_tests.run().step);
|
||||
test_step.dependOn(&gpu.testStep(b, mode, target, @bitCast(gpu.Options, options)).step);
|
||||
test_step.dependOn(&gpu_dawn.testStep(b, mode, target).step);
|
||||
test_step.dependOn(&glfw.testStep(b, mode, target).step);
|
||||
test_step.dependOn(&ecs.testStep(b, mode, target).step);
|
||||
test_step.dependOn(&freetype.testStep(b, mode, target).step);
|
||||
test_step.dependOn(&sysaudio.testStep(b, mode, target, .{}).step);
|
||||
// TODO: we need a way to test wasm stuff
|
||||
// test_mach_step.dependOn(&sysjs.testStep(b, mode, target).step);
|
||||
|
||||
const test_mach_step = b.step("test-mach", "Run Mach Core library tests");
|
||||
test_mach_step.dependOn(&main_tests.step);
|
||||
test_mach_step.dependOn(&gpu.testStep(b, mode, @bitCast(gpu.Options, options)).step);
|
||||
test_mach_step.dependOn(&gpu_dawn.testStep(b, mode).step);
|
||||
test_mach_step.dependOn(&glfw.testStep(b, mode).step);
|
||||
test_mach_step.dependOn(&ecs.testStep(b, mode).step);
|
||||
test_mach_step.dependOn(&freetype.testStep(b, mode).step);
|
||||
test_mach_step.dependOn(&sysaudio.testStep(b, mode, .{}).step);
|
||||
test_mach_step.dependOn(&sysjs.testStep(b, mode).step);
|
||||
test_mach_step.dependOn(&main_tests.run().step);
|
||||
|
||||
// TODO(build-system): https://github.com/hexops/mach/issues/229#issuecomment-1100958939
|
||||
ensureGit(b.allocator);
|
||||
|
|
|
|||
|
|
@ -2,14 +2,17 @@ const std = @import("std");
|
|||
|
||||
pub fn build(b: *std.build.Builder) void {
|
||||
const mode = b.standardReleaseOptions();
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const test_step = b.step("test", "Run library tests");
|
||||
test_step.dependOn(&testStep(b, mode).step);
|
||||
test_step.dependOn(&testStep(b, mode, target).step);
|
||||
}
|
||||
|
||||
pub fn testStep(b: *std.build.Builder, mode: std.builtin.Mode) *std.build.LibExeObjStep {
|
||||
const main_tests = b.addTest(thisDir() ++ "/src/main.zig");
|
||||
pub fn testStep(b: *std.build.Builder, mode: std.builtin.Mode, target: std.zig.CrossTarget) *std.build.RunStep {
|
||||
const main_tests = b.addTestExe("ecs-tests", thisDir() ++ "/src/main.zig");
|
||||
main_tests.setBuildMode(mode);
|
||||
return main_tests;
|
||||
main_tests.setTarget(target);
|
||||
main_tests.install();
|
||||
return main_tests.run();
|
||||
}
|
||||
|
||||
pub const pkg = std.build.Pkg{
|
||||
|
|
|
|||
|
|
@ -7,21 +7,17 @@ pub fn build(b: *Builder) void {
|
|||
const mode = b.standardReleaseOptions();
|
||||
const target = b.standardTargetOptions(.{});
|
||||
|
||||
const test_app = b.addStaticLibrary("test_app", null);
|
||||
test_app.setBuildMode(mode);
|
||||
test_app.setTarget(target);
|
||||
link(b, test_app, .{});
|
||||
test_app.install();
|
||||
|
||||
const test_step = b.step("test", "Run library tests");
|
||||
test_step.dependOn(&testStep(b, mode).step);
|
||||
test_step.dependOn(&testStep(b, mode, target).step);
|
||||
}
|
||||
|
||||
pub fn testStep(b: *Builder, mode: std.builtin.Mode) *std.build.LibExeObjStep {
|
||||
const main_tests = b.addTest(thisDir() ++ "/src/main.zig");
|
||||
pub fn testStep(b: *Builder, mode: std.builtin.Mode, target: std.zig.CrossTarget) *std.build.RunStep {
|
||||
const main_tests = b.addTestExe("glfw_tests", thisDir() ++ "/src/main.zig");
|
||||
main_tests.setBuildMode(mode);
|
||||
main_tests.setTarget(target);
|
||||
link(b, main_tests, .{});
|
||||
return main_tests;
|
||||
main_tests.install();
|
||||
return main_tests.run();
|
||||
}
|
||||
|
||||
pub const LinuxWindowManager = enum {
|
||||
|
|
@ -67,7 +63,7 @@ fn buildLibrary(b: *Builder, step: *std.build.LibExeObjStep, options: Options) *
|
|||
// TODO(build-system): https://github.com/hexops/mach/issues/229#issuecomment-1100958939
|
||||
ensureDependencySubmodule(b.allocator, "upstream") catch unreachable;
|
||||
|
||||
const main_abs = std.fs.path.join(b.allocator, &.{ (comptime thisDir()), "src/main.zig" }) catch unreachable;
|
||||
const main_abs = thisDir() ++ "/src/main.zig";
|
||||
const lib = b.addStaticLibrary("glfw", main_abs);
|
||||
lib.setBuildMode(step.build_mode);
|
||||
lib.setTarget(step.target);
|
||||
|
|
|
|||
|
|
@ -11,14 +11,8 @@ pub fn build(b: *Builder) void {
|
|||
.from_source = b.option(bool, "dawn-from-source", "Build Dawn from source") orelse false,
|
||||
};
|
||||
|
||||
const lib = b.addStaticLibrary("gpu", "src/main.zig");
|
||||
lib.setBuildMode(mode);
|
||||
lib.setTarget(target);
|
||||
lib.install();
|
||||
link(b, lib, options);
|
||||
|
||||
const test_step = b.step("test", "Run library tests");
|
||||
test_step.dependOn(&testStep(b, mode).step);
|
||||
test_step.dependOn(&testStep(b, mode, target).step);
|
||||
|
||||
const dawn_example = b.addExecutable("dawn-example", "src/dawn/hello_triangle.zig");
|
||||
dawn_example.setBuildMode(mode);
|
||||
|
|
@ -34,10 +28,12 @@ pub fn build(b: *Builder) void {
|
|||
dawn_example_run_step.dependOn(&dawn_example_run_cmd.step);
|
||||
}
|
||||
|
||||
pub fn testStep(b: *std.build.Builder, mode: std.builtin.Mode) *std.build.LibExeObjStep {
|
||||
const main_tests = b.addTest(thisDir() ++ "/src/main.zig");
|
||||
pub fn testStep(b: *std.build.Builder, mode: std.builtin.Mode, target: std.zig.CrossTarget) *std.build.RunStep {
|
||||
const main_tests = b.addTestExe("gpu-dawn-tests", thisDir() ++ "/src/main.zig");
|
||||
main_tests.setBuildMode(mode);
|
||||
return main_tests;
|
||||
main_tests.setTarget(target);
|
||||
main_tests.install();
|
||||
return main_tests.run();
|
||||
}
|
||||
|
||||
pub const LinuxWindowManager = enum {
|
||||
|
|
|
|||
|
|
@ -11,28 +11,31 @@ pub fn build(b: *std.build.Builder) void {
|
|||
};
|
||||
|
||||
const test_step = b.step("test", "Run library tests");
|
||||
test_step.dependOn(&testStep(b, mode, .{ .gpu_dawn_options = gpu_dawn_options }).step);
|
||||
test_step.dependOn(&testStep(b, mode, target, .{ .gpu_dawn_options = gpu_dawn_options }).step);
|
||||
|
||||
const example = b.addExecutable("gpu-hello-triangle", "examples/main.zig");
|
||||
example.setTarget(target);
|
||||
example.setBuildMode(mode);
|
||||
example.install();
|
||||
example.linkLibC();
|
||||
example.addPackagePath("gpu", "src/main.zig");
|
||||
example.addPackagePath("glfw", "libs/mach-glfw/src/main.zig");
|
||||
link(b, example, .{ .gpu_dawn_options = gpu_dawn_options });
|
||||
// const example = b.addExecutable("gpu-hello-triangle", "examples/main.zig");
|
||||
// example.setBuildMode(mode);
|
||||
//example.setTarget(target);
|
||||
// example.linkLibC();
|
||||
// example.addPackagePath("gpu", "src/main.zig");
|
||||
// example.addPackagePath("glfw", "libs/mach-glfw/src/main.zig");
|
||||
// link(b, example, .{ .gpu_dawn_options = gpu_dawn_options });
|
||||
|
||||
const example_run_cmd = example.run();
|
||||
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);
|
||||
// example.install();
|
||||
|
||||
// const example_run_cmd = example.run();
|
||||
// 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);
|
||||
}
|
||||
|
||||
pub fn testStep(b: *std.build.Builder, mode: std.builtin.Mode, options: Options) *std.build.LibExeObjStep {
|
||||
const main_tests = b.addTest(thisDir() ++ "/src/main.zig");
|
||||
pub fn testStep(b: *std.build.Builder, mode: std.builtin.Mode, target: std.zig.CrossTarget, options: Options) *std.build.RunStep {
|
||||
const main_tests = b.addTestExe("gpu-tests", thisDir() ++ "/src/main.zig");
|
||||
main_tests.setBuildMode(mode);
|
||||
main_tests.setTarget(target);
|
||||
link(b, main_tests, options);
|
||||
return main_tests;
|
||||
main_tests.install();
|
||||
return main_tests.run();
|
||||
}
|
||||
|
||||
pub const Options = struct {
|
||||
|
|
|
|||
|
|
@ -9,3 +9,7 @@ pub const ecs = @import("ecs");
|
|||
// Engine exports
|
||||
pub const App = @import("engine.zig").App;
|
||||
pub const module = @import("engine.zig").module;
|
||||
|
||||
test {
|
||||
_ = void;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ pub fn build(b: *Builder) void {
|
|||
const target = b.standardTargetOptions(.{});
|
||||
|
||||
const test_step = b.step("test", "Run library tests");
|
||||
test_step.dependOn(&testStep(b, mode, .{}).step);
|
||||
test_step.dependOn(&testStep(b, mode, target, .{}).step);
|
||||
|
||||
inline for ([_][]const u8{
|
||||
"soundio-sine-wave",
|
||||
|
|
@ -48,18 +48,23 @@ pub fn build(b: *Builder) void {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn testStep(b: *std.build.Builder, mode: std.builtin.Mode, options: Options) *std.build.LibExeObjStep {
|
||||
const soundio_tests = b.addTest(thisDir() ++ "/soundio/main.zig");
|
||||
pub fn testStep(b: *std.build.Builder, mode: std.builtin.Mode, target: std.zig.CrossTarget, options: Options) *std.build.RunStep {
|
||||
const soundio_tests = b.addTestExe("soundio-tests", thisDir() ++ "/soundio/main.zig");
|
||||
soundio_tests.setBuildMode(mode);
|
||||
soundio_tests.setTarget(target);
|
||||
link(b, soundio_tests, options);
|
||||
soundio_tests.install();
|
||||
|
||||
const main_tests = b.addTest(thisDir() ++ "/src/main.zig");
|
||||
const main_tests = b.addTestExe("sysaudio-tests", thisDir() ++ "/src/main.zig");
|
||||
main_tests.setBuildMode(mode);
|
||||
main_tests.setTarget(target);
|
||||
main_tests.addPackage(soundio_pkg);
|
||||
main_tests.step.dependOn(&soundio_tests.step);
|
||||
link(b, main_tests, options);
|
||||
main_tests.install();
|
||||
|
||||
return main_tests;
|
||||
const main_tests_run = main_tests.run();
|
||||
main_tests_run.step.dependOn(&soundio_tests.run().step);
|
||||
return main_tests_run;
|
||||
}
|
||||
|
||||
pub fn link(b: *Builder, step: *std.build.LibExeObjStep, options: Options) void {
|
||||
|
|
|
|||
|
|
@ -6,10 +6,11 @@ pub fn build(b: *std.build.Builder) void {
|
|||
test_step.dependOn(&testStep(b, mode).step);
|
||||
}
|
||||
|
||||
pub fn testStep(b: *std.build.Builder, mode: std.builtin.Mode) *std.build.LibExeObjStep {
|
||||
const main_tests = b.addTest(thisDir() ++ "/src/main.zig");
|
||||
pub fn testStep(b: *std.build.Builder, mode: std.builtin.Mode, target: std.zig.CrossTarget) *std.build.RunStep {
|
||||
const main_tests = b.addTestExe("sysjs-tests", thisDir() ++ "/src/main.zig");
|
||||
main_tests.setBuildMode(mode);
|
||||
return main_tests;
|
||||
main_tests.setTarget(target);
|
||||
return main_tests.run();
|
||||
}
|
||||
|
||||
pub const pkg = std.build.Pkg{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue