From 299166e55fde2995af2092e783fc16cabdcc078d Mon Sep 17 00:00:00 2001 From: Matheus Catarino Date: Sun, 21 Apr 2024 12:52:02 -0300 Subject: [PATCH] wasm: skip imgui example --- .github/workflows/build.yml | 1 + build.zig | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e047be3..d1d75c0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,6 +33,7 @@ jobs: dub build :debugtext_print # dub build :cube # dub build :blend + dub build :imgui dub build :triangle # dub build :mrt dub build :user_data diff --git a/build.zig b/build.zig index 9edfa98..5db6483 100644 --- a/build.zig +++ b/build.zig @@ -176,15 +176,18 @@ pub fn buildLibSokol(b: *Build, options: LibSokolOptions) !*CompileStep { .flags = cflags, }); } - lib.addCSourceFile(.{ - .file = .{ .path = csrc_root ++ "sokol_imgui.c" }, - .flags = cflags, - }); - const cimgui = try buildImgui(b, .{ .target = options.target, .optimize = options.optimize, .emsdk = options.emsdk }); - for (cimgui.root_module.include_dirs.items) |dir| { - try lib.root_module.include_dirs.append(b.allocator, dir); + // FIXME: missing 'assert.h' + if (!lib.rootModuleTarget().isWasm()) { + lib.addCSourceFile(.{ + .file = .{ .path = csrc_root ++ "sokol_imgui.c" }, + .flags = cflags, + }); + const cimgui = try buildImgui(b, .{ .target = options.target, .optimize = options.optimize, .emsdk = options.emsdk }); + for (cimgui.root_module.include_dirs.items) |dir| { + try lib.root_module.include_dirs.append(b.allocator, dir); + } + lib.linkLibrary(cimgui); } - lib.linkLibrary(cimgui); if (sharedlib) b.installArtifact(lib); return lib; @@ -233,6 +236,8 @@ pub fn build(b: *Build) !void { }; inline for (examples) |example| { + if (lib_sokol.rootModuleTarget().isWasm() and std.mem.eql(u8, example, "imgui")) + return; // FIXME: cimgui need 'assert.h'. const ldc = try ldcBuildStep(b, .{ .name = example, .artifact = lib_sokol,