Skip to content

#error exactly one of IMGUI_IMPL_WEBGPU_BACKEND_DAWN or IMGUI_IMPL_WEBGPU_BACKEND_WGPU must be defined! #75

@tadeohepperle

Description

@tadeohepperle

I can't get zgui to compile with zig 0.15.1. The following build error occurs:

/home/tadeo/.cache/zig/p/zgui-0.6.0-dev--L6sZL7tbQAPRLYrcQAVx0V49tPHAXNxclZ-v8IP4wLr/libs/imgui/backends/imgui_impl_wgpu.cpp:54:6: error: exactly one of IMGUI_IMPL_WEBGPU_BACKEND_DAWN or IMGUI_IMPL_WEBGPU_BACKEND_WGPU must be defined!
    #error exactly one of IMGUI_IMPL_WEBGPU_BACKEND_DAWN or IMGUI_IMPL_WEBGPU_BACKEND_WGPU must be defined!

In the dependencies of my build.zig.zon file I have the following fields:

.zgui = .{
    .url = "https://github.com/zig-gamedev/zgui/archive/7fa8081c208885b85e3fdfc043cd9d9cb9559123.tar.gz",
    .hash = "zgui-0.6.0-dev--L6sZL7tbQAPRLYrcQAVx0V49tPHAXNxclZ-v8IP4wLr",
},
.zgpu = .{
    .url = "https://github.com/zig-gamedev/zgpu/archive/96f3ce2229e4836daec714a3f0b8c3c3218a6b2c.tar.gz",
    .hash = "zgpu-0.12.0-dev-nqFT5LqgCACR_1wEhi7rveY3ocKJczfRaXQoisCmpohn",
},
.dawn_x86_64_linux_gnu = .{
    .url = "https://github.com/michal-z/webgpu_dawn-x86_64-linux-gnu/archive/7d70db023bf254546024629cbec5ee6113e12a42.tar.gz",
    .hash = "N-V-__8AAK7XUQNKNRnv1J6i189jtURJKjp3HTftoyD4Y4CB",
    .lazy = true,
},

In my build.zig file I have these lines:

@import("zgpu").addLibraryPathsTo(exe);
const zgpu = b.dependency("zgpu", .{});
exe.root_module.addImport("zgpu", zgpu.module("root"));
exe.linkLibrary(zgpu.artifact("zdawn"));
const zgui = b.dependency("zgui", .{
    .target = target,
    .backend = .glfw_wgpu,
});
exe.root_module.addImport("zgui", zgui.module("root"));
exe.linkLibrary(zgui.artifact("imgui"));
const zglfw = b.dependency("zglfw", .{
    .target = target,
});
exe.root_module.addImport("zglfw", zglfw.module("root"));
exe.linkLibrary(zglfw.artifact("glfw"));

If I add a "-IMGUI_IMPL_WEBGPU_BACKEND_DAWN" to the cflags in the build.zig file, the error disappears but it complains about not finding some structs like unknown type name 'WGPUComputeState'. I think there is either some file not included or there is a version mismatch for the dawn version built by zgpu.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions