mirror of
https://github.com/raysan5/raylib.git
synced 2026-05-08 14:52:05 +00:00
[examples] Update build.zig to support wasm examples (#5811)
* Include resource preloads when building wasm examples with Zig. List of resources derived from examples/Makefile.Web * Move resource list to zon file to reduce build.zig bloat
This commit is contained in:
@@ -706,10 +706,16 @@ fn addExamples(
|
||||
const emcc_flags = emsdk.emccDefaultFlags(b.allocator, .{ .optimize = optimize });
|
||||
const emcc_settings = emsdk.emccDefaultSettings(b.allocator, .{ .optimize = optimize });
|
||||
|
||||
const EmccExamplesPreloadMap = std.static_string_map.StaticStringMap([]const emsdk.zemscripten.EmccFilePath);
|
||||
const EmccExamplesPreloadKV = struct { []const u8, []const emsdk.zemscripten.EmccFilePath };
|
||||
const emcc_examples_preloads: []const EmccExamplesPreloadKV = @import("examples/example_resources.zon");
|
||||
const emcc_examples_preloads_map = EmccExamplesPreloadMap.initComptime(emcc_examples_preloads);
|
||||
|
||||
const emcc_step = emsdk.emccStep(b, raylib, wasm, .{
|
||||
.optimize = optimize,
|
||||
.flags = emcc_flags,
|
||||
.settings = emcc_settings,
|
||||
.preload_paths = emcc_examples_preloads_map.get(filename) orelse &.{},
|
||||
.shell_file_path = b.path("src/shell.html"),
|
||||
.install_dir = install_dir,
|
||||
});
|
||||
@@ -788,3 +794,4 @@ fn waylandGenerate(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1422
examples/example_resources.zon
Normal file
1422
examples/example_resources.zon
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user