mach: wasm: enabled boids example and do not compile examples which are
unsupported
This commit is contained in:
parent
281b1e75c0
commit
1491167daa
1 changed files with 12 additions and 3 deletions
15
build.zig
15
build.zig
|
|
@ -31,15 +31,23 @@ pub fn build(b: *std.build.Builder) void {
|
||||||
|
|
||||||
inline for ([_]ExampleDefinition{
|
inline for ([_]ExampleDefinition{
|
||||||
.{ .name = "triangle" },
|
.{ .name = "triangle" },
|
||||||
//.{ .name = "boids" },
|
.{ .name = "boids" },
|
||||||
.{ .name = "rotating-cube", .packages = &[_]Pkg{Packages.zmath} },
|
.{ .name = "rotating-cube", .packages = &[_]Pkg{Packages.zmath} },
|
||||||
.{ .name = "two-cubes", .packages = &[_]Pkg{Packages.zmath} },
|
.{ .name = "two-cubes", .packages = &[_]Pkg{Packages.zmath} },
|
||||||
.{ .name = "instanced-cube", .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 = "advanced-gen-texture-light", .packages = &[_]Pkg{Packages.zmath} },
|
||||||
//.{ .name = "textured-cube", .packages = &[_]Pkg{ Packages.zmath, Packages.zigimg } },
|
|
||||||
.{ .name = "fractal-cube", .packages = &[_]Pkg{Packages.zmath} },
|
.{ .name = "fractal-cube", .packages = &[_]Pkg{Packages.zmath} },
|
||||||
|
.{ .name = "gkurve", .packages = &[_]Pkg{ Packages.zmath, Packages.zigimg }, .std_platform_only = true },
|
||||||
|
.{ .name = "textured-cube", .packages = &[_]Pkg{ Packages.zmath, Packages.zigimg }, .std_platform_only = true },
|
||||||
}) |example| {
|
}) |example| {
|
||||||
|
// FIXME: this is workaround for a problem that some examples (having the std_platform_only=true field) as
|
||||||
|
// well as zigimg uses IO which is not supported in freestanding environments. So break out of this loop
|
||||||
|
// as soon as any such examples is found. This does means that any example which works on wasm should be
|
||||||
|
// placed before those who dont.
|
||||||
|
if (example.std_platform_only)
|
||||||
|
if (target.toTarget().cpu.arch == .wasm32)
|
||||||
|
break;
|
||||||
|
|
||||||
const example_app = App.init(
|
const example_app = App.init(
|
||||||
b,
|
b,
|
||||||
.{
|
.{
|
||||||
|
|
@ -91,6 +99,7 @@ pub const Options = struct {
|
||||||
const ExampleDefinition = struct {
|
const ExampleDefinition = struct {
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
packages: []const Pkg = &[_]Pkg{},
|
packages: []const Pkg = &[_]Pkg{},
|
||||||
|
std_platform_only: bool = false,
|
||||||
};
|
};
|
||||||
|
|
||||||
const Packages = struct {
|
const Packages = struct {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue