gamemode: Fix root build.zig test with symlinks
This commit is contained in:
parent
d84a32363c
commit
2612684ef3
1 changed files with 21 additions and 7 deletions
28
build.zig
28
build.zig
|
|
@ -1,8 +1,8 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
pub const gpu = @import("gpu/build.zig");
|
pub const gpu = @import("gpu/build.zig");
|
||||||
const gpu_dawn = @import("gpu/libs/mach-gpu-dawn/build.zig");
|
const gpu_dawn = @import("gpu-dawn/build.zig");
|
||||||
pub const glfw = @import("gpu/libs/mach-glfw/build.zig");
|
pub const glfw = @import("glfw/build.zig");
|
||||||
pub const ecs = @import("ecs/build.zig");
|
pub const ecs = @import("ecs/build.zig");
|
||||||
const freetype = @import("freetype/build.zig");
|
const freetype = @import("freetype/build.zig");
|
||||||
const sysaudio = @import("sysaudio/build.zig");
|
const sysaudio = @import("sysaudio/build.zig");
|
||||||
|
|
@ -16,7 +16,7 @@ pub fn build(b: *std.build.Builder) void {
|
||||||
const gpu_dawn_options = gpu_dawn.Options{
|
const gpu_dawn_options = gpu_dawn.Options{
|
||||||
.from_source = b.option(bool, "dawn-from-source", "Build Dawn from source") orelse false,
|
.from_source = b.option(bool, "dawn-from-source", "Build Dawn from source") orelse false,
|
||||||
};
|
};
|
||||||
const options = gpu.Options{ .gpu_dawn_options = gpu_dawn_options };
|
const options = Options{ .gpu_dawn_options = gpu_dawn_options };
|
||||||
|
|
||||||
const main_tests = b.addTestExe("mach-tests", "src/main.zig");
|
const main_tests = b.addTestExe("mach-tests", "src/main.zig");
|
||||||
main_tests.setBuildMode(mode);
|
main_tests.setBuildMode(mode);
|
||||||
|
|
@ -28,7 +28,7 @@ pub fn build(b: *std.build.Builder) void {
|
||||||
|
|
||||||
const test_step = b.step("test", "Run library tests");
|
const test_step = b.step("test", "Run library tests");
|
||||||
test_step.dependOn(&main_tests.run().step);
|
test_step.dependOn(&main_tests.run().step);
|
||||||
test_step.dependOn(&gpu.testStep(b, mode, target, options).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(&gpu_dawn.testStep(b, mode, target).step);
|
||||||
test_step.dependOn(&glfw.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(&ecs.testStep(b, mode, target).step);
|
||||||
|
|
@ -137,12 +137,21 @@ pub fn build(b: *std.build.Builder) void {
|
||||||
lib.addPackage(app_pkg);
|
lib.addPackage(app_pkg);
|
||||||
lib.addPackage(gpu.pkg);
|
lib.addPackage(gpu.pkg);
|
||||||
lib.addPackage(glfw.pkg);
|
lib.addPackage(glfw.pkg);
|
||||||
|
const gpu_options = gpu.Options{
|
||||||
|
.glfw_options = @bitCast(@import("gpu/libs/mach-glfw/build.zig").Options, options.glfw_options),
|
||||||
|
.gpu_dawn_options = @bitCast(@import("gpu/libs/mach-gpu-dawn/build.zig").Options, options.gpu_dawn_options),
|
||||||
|
};
|
||||||
glfw.link(b, lib, options.glfw_options);
|
glfw.link(b, lib, options.glfw_options);
|
||||||
gpu.link(b, lib, options);
|
gpu.link(b, lib, gpu_options);
|
||||||
lib.setOutputDir("./libmach/build");
|
lib.setOutputDir("./libmach/build");
|
||||||
lib.install();
|
lib.install();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub const Options = struct {
|
||||||
|
glfw_options: glfw.Options = .{},
|
||||||
|
gpu_dawn_options: gpu_dawn.Options = .{},
|
||||||
|
};
|
||||||
|
|
||||||
const ExampleDefinition = struct {
|
const ExampleDefinition = struct {
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
packages: []const Pkg = &[_]Pkg{},
|
packages: []const Pkg = &[_]Pkg{},
|
||||||
|
|
@ -283,10 +292,15 @@ pub const App = struct {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn link(app: *const App, options: gpu.Options) void {
|
pub fn link(app: *const App, options: Options) void {
|
||||||
|
const gpu_options = gpu.Options{
|
||||||
|
.glfw_options = @bitCast(@import("gpu/libs/mach-glfw/build.zig").Options, options.glfw_options),
|
||||||
|
.gpu_dawn_options = @bitCast(@import("gpu/libs/mach-gpu-dawn/build.zig").Options, options.gpu_dawn_options),
|
||||||
|
};
|
||||||
|
|
||||||
if (app.platform != .web) {
|
if (app.platform != .web) {
|
||||||
glfw.link(app.b, app.step, options.glfw_options);
|
glfw.link(app.b, app.step, options.glfw_options);
|
||||||
gpu.link(app.b, app.step, options);
|
gpu.link(app.b, app.step, gpu_options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue