mach: wasm specific build system fixes
- Disable some examples - Dont compile shaderexp at all - Block off all run steps
This commit is contained in:
parent
7466f32b62
commit
ae4374b9df
1 changed files with 30 additions and 23 deletions
11
build.zig
11
build.zig
|
|
@ -31,13 +31,13 @@ pub fn build(b: *std.build.Builder) void {
|
|||
|
||||
inline for ([_]ExampleDefinition{
|
||||
.{ .name = "triangle" },
|
||||
.{ .name = "boids" },
|
||||
//.{ .name = "boids" },
|
||||
.{ .name = "rotating-cube", .packages = &[_]Pkg{Packages.zmath} },
|
||||
.{ .name = "two-cubes", .packages = &[_]Pkg{Packages.zmath} },
|
||||
.{ .name = "instanced-cube", .packages = &[_]Pkg{Packages.zmath} },
|
||||
.{ .name = "gkurve", .packages = &[_]Pkg{ Packages.zmath, Packages.zigimg } },
|
||||
.{ .name = "advanced-gen-texture-light", .packages = &[_]Pkg{Packages.zmath} },
|
||||
.{ .name = "textured-cube", .packages = &[_]Pkg{ Packages.zmath, Packages.zigimg } },
|
||||
//.{ .name = "textured-cube", .packages = &[_]Pkg{ Packages.zmath, Packages.zigimg } },
|
||||
.{ .name = "fractal-cube", .packages = &[_]Pkg{Packages.zmath} },
|
||||
}) |example| {
|
||||
const example_app = App.init(
|
||||
|
|
@ -52,12 +52,15 @@ pub fn build(b: *std.build.Builder) void {
|
|||
example_app.setBuildMode(mode);
|
||||
example_app.link(options);
|
||||
|
||||
if (target.toTarget().cpu.arch != .wasm32) {
|
||||
const example_run_cmd = example_app.run();
|
||||
example_run_cmd.step.dependOn(&example_app.getInstallStep().?.step);
|
||||
const example_run_step = b.step("run-example-" ++ example.name, "Run the example");
|
||||
example_run_step.dependOn(&example_run_cmd.step);
|
||||
}
|
||||
}
|
||||
|
||||
if (target.toTarget().cpu.arch != .wasm32) {
|
||||
const shaderexp_app = App.init(
|
||||
b,
|
||||
.{
|
||||
|
|
@ -74,6 +77,7 @@ pub fn build(b: *std.build.Builder) void {
|
|||
shaderexp_run_cmd.step.dependOn(&shaderexp_app.getInstallStep().?.step);
|
||||
const shaderexp_run_step = b.step("run-shaderexp", "Run shaderexp");
|
||||
shaderexp_run_step.dependOn(&shaderexp_run_cmd.step);
|
||||
}
|
||||
|
||||
const compile_all = b.step("compile-all", "Compile all examples and applications");
|
||||
compile_all.dependOn(b.getInstallStep());
|
||||
|
|
@ -122,6 +126,7 @@ const App = struct {
|
|||
if (options.target.toTarget().cpu.arch == .wasm32) {
|
||||
// TODO: use options.name
|
||||
const lib = b.addSharedLibrary("application", "src/wasm.zig", .unversioned);
|
||||
lib.addPackage(gpu.pkg);
|
||||
|
||||
break :blk lib;
|
||||
} else {
|
||||
|
|
@ -150,9 +155,11 @@ const App = struct {
|
|||
.gpu_dawn_options = @bitCast(@import("gpu/libs/mach-gpu-dawn/build.zig").Options, options.gpu_dawn_options),
|
||||
};
|
||||
|
||||
if (app.step.target.toTarget().cpu.arch != .wasm32) {
|
||||
glfw.link(app.b, app.step, options.glfw_options);
|
||||
gpu.link(app.b, app.step, gpu_options);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn setBuildMode(app: *const App, mode: std.builtin.Mode) void {
|
||||
app.step.setBuildMode(mode);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue