Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot use getWrapperModuleVulkan #149

Open
AT14C opened this issue Nov 29, 2023 · 0 comments
Open

cannot use getWrapperModuleVulkan #149

AT14C opened this issue Nov 29, 2023 · 0 comments

Comments

@AT14C
Copy link

AT14C commented Nov 29, 2023

I cannot use the wrapper w/vulkan-zig without getting an error for the vulkan binding existing in both modules

this is my build.zig

const std = @import("std");
const sdl = @import("lib/SDL.zig/build.zig");
const vkgen = @import("lib/vulkan-zig/generator/index.zig");

pub fn build(b: *std.build.Builder) !void {
    const target = b.standardTargetOptions(.{});
    const optimize = b.standardOptimizeOption(.{});


    const exe = b.addExecutable(.{
        .name = "test",
        .root_source_file = .{ .path = "src/main.zig" },
        .target = target,
        .optimize = optimize,
    });

    const sdk = sdl.init(b, null);
    sdl.link(sdk, exe, .dynamic);
    const gen = vkgen.VkGenerateStep.create(b, "vk.xml");
    
    exe.addModule("sdl2", sdl.getWrapperModuleVulkan(sdk, gen.getModule()));
    exe.addModule("vulkan", gen.getModule());

    const shaders = vkgen.ShaderCompileStep.create(
        b,
        &[_][]const u8{ "glslc", "--target-env=vulkan1.2" },
        "-o",
    );
    shaders.add("triangle_vert", "shaders/triangle.vert", .{});
    shaders.add("triangle_frag", "shaders/triangle.frag", .{});
    exe.addModule("shaders", shaders.getModule());
    
    b.installArtifact(exe);

    const run_cmd = b.addRunArtifact(exe);
    run_cmd.step.dependOn(b.getInstallStep());
    if (b.args) |args| {
        run_cmd.addArgs(args);
    }

    const run_step = b.step("run", "Run test");
    run_step.dependOn(&run_cmd.step);
}

and this is the error i get

zig-cache/o/ac2f9342bd342b23d954a92e2875a499/vk.zig:1:1: error: file exists in multiple modules
zig-cache/o/ac2f9342bd342b23d954a92e2875a499/vk.zig:1:1: note: root of module vulkan0
zig-cache/o/ac2f9342bd342b23d954a92e2875a499/vk.zig:1:1: note: root of module vulkan

removing the vulkan module and leaving just the sdl2 module does not fix the problem because then I cannot use vulkan at all in my code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant