can specify a wasm target in build

This commit is contained in:
Mitchell Hashimoto
2022-12-31 08:53:11 -08:00
parent 1093cf5254
commit ce490e21ea
11 changed files with 69 additions and 3 deletions

View File

@@ -14,13 +14,17 @@ pub usingnamespace @import("renderer/message.zig");
pub usingnamespace @import("renderer/size.zig");
pub const Metal = @import("renderer/Metal.zig");
pub const OpenGL = @import("renderer/OpenGL.zig");
pub const WebGL = @import("renderer/WebGL.zig");
pub const Options = @import("renderer/Options.zig");
pub const Thread = @import("renderer/Thread.zig");
pub const State = @import("renderer/State.zig");
/// The implementation to use for the renderer. This is comptime chosen
/// so that every build has exactly one renderer implementation.
pub const Renderer = switch (builtin.os.tag) {
const wasm = @import("os/wasm.zig");
pub const Renderer = if (wasm.target) |target| switch (target) {
.browser => WebGL,
} else switch (builtin.os.tag) {
.macos => Metal,
else => OpenGL,
};