mirror of
https://github.com/raylib-zig/raylib-zig.git
synced 2025-12-16 03:03:13 +00:00
Add examples to build step when compiling for emscripten
This commit is contained in:
parent
73bc8b70cd
commit
bab16b30a1
@ -187,8 +187,6 @@ pub fn build(b: *std.Build) !void {
|
|||||||
// },
|
// },
|
||||||
};
|
};
|
||||||
|
|
||||||
const examples_step = b.step("examples", "Builds all the examples");
|
|
||||||
|
|
||||||
const raylib = rl.getModule(b, target, optimize);
|
const raylib = rl.getModule(b, target, optimize);
|
||||||
const raylib_math = rl.math.getModule(b, target, optimize);
|
const raylib_math = rl.math.getModule(b, target, optimize);
|
||||||
const rlgl = rl.gl.getModule(b, target, optimize);
|
const rlgl = rl.gl.getModule(b, target, optimize);
|
||||||
@ -218,6 +216,8 @@ pub fn build(b: *std.Build) !void {
|
|||||||
test_step.dependOn(&raylib_math_test.step);
|
test_step.dependOn(&raylib_math_test.step);
|
||||||
test_step.dependOn(&rlgl_test.step);
|
test_step.dependOn(&rlgl_test.step);
|
||||||
|
|
||||||
|
const examples_step = b.step("examples", "Builds all the examples");
|
||||||
|
|
||||||
for (examples) |ex| {
|
for (examples) |ex| {
|
||||||
if (target.query.os_tag == .emscripten) {
|
if (target.query.os_tag == .emscripten) {
|
||||||
const exe_lib = emcc.compileForEmscripten(b, ex.name, ex.path, target, optimize);
|
const exe_lib = emcc.compileForEmscripten(b, ex.name, ex.path, target, optimize);
|
||||||
@ -236,7 +236,9 @@ pub fn build(b: *std.Build) !void {
|
|||||||
const run_step = try emcc.emscriptenRunStep(b);
|
const run_step = try emcc.emscriptenRunStep(b);
|
||||||
run_step.step.dependOn(&link_step.step);
|
run_step.step.dependOn(&link_step.step);
|
||||||
const run_option = b.step(ex.name, ex.desc);
|
const run_option = b.step(ex.name, ex.desc);
|
||||||
|
|
||||||
run_option.dependOn(&run_step.step);
|
run_option.dependOn(&run_step.step);
|
||||||
|
examples_step.dependOn(&exe_lib.step);
|
||||||
} else {
|
} else {
|
||||||
const exe = b.addExecutable(.{
|
const exe = b.addExecutable(.{
|
||||||
.name = ex.name,
|
.name = ex.name,
|
||||||
@ -248,8 +250,10 @@ pub fn build(b: *std.Build) !void {
|
|||||||
exe.root_module.addImport("raylib", raylib);
|
exe.root_module.addImport("raylib", raylib);
|
||||||
exe.root_module.addImport("raylib-math", raylib_math);
|
exe.root_module.addImport("raylib-math", raylib_math);
|
||||||
exe.root_module.addImport("rlgl", rlgl);
|
exe.root_module.addImport("rlgl", rlgl);
|
||||||
|
|
||||||
const run_cmd = b.addRunArtifact(exe);
|
const run_cmd = b.addRunArtifact(exe);
|
||||||
const run_step = b.step(ex.name, ex.desc);
|
const run_step = b.step(ex.name, ex.desc);
|
||||||
|
|
||||||
run_step.dependOn(&run_cmd.step);
|
run_step.dependOn(&run_cmd.step);
|
||||||
examples_step.dependOn(&exe.step);
|
examples_step.dependOn(&exe.step);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user