Now switches on target set to wasm

This commit is contained in:
nothke 2024-07-04 16:57:48 +02:00
parent de7b29c458
commit 2a10ffc55c

View File

@ -3,15 +3,13 @@ const sokol = @import("sokol");
const title = "sok"; const title = "sok";
const buildForWeb = false;
pub fn build(b: *std.Build) void { pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{}); const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{}); const optimize = b.standardOptimizeOption(.{});
const dep_sokol = b.dependency("sokol", .{ .target = target, .optimize = optimize }); const dep_sokol = b.dependency("sokol", .{ .target = target, .optimize = optimize });
if (!buildForWeb) { if (!target.result.isWasm()) {
// Native exe // Native exe
const exe = b.addExecutable(.{ const exe = b.addExecutable(.{
@ -96,12 +94,3 @@ pub fn build(b: *std.Build) void {
const test_step = b.step("test", "Run unit tests"); const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_exe_unit_tests.step); test_step.dependOn(&run_exe_unit_tests.step);
} }
// for web builds, the Zig code needs to be built into a library and linked with the Emscripten linker
fn buildWeb(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.Build.OptimizeMode, dep_sokol: *std.Build.Dependency) !void {
_ = b; // autofix
_ = target; // autofix
_ = optimize; // autofix
_ = dep_sokol; // autofix
}