diff --git a/build.zig b/build.zig index 15819aa..218f2db 100644 --- a/build.zig +++ b/build.zig @@ -197,6 +197,9 @@ pub fn buildLibSokol(b: *Build, options: LibSokolOptions) !*CompileStep { try lib.root_module.include_dirs.append(b.allocator, dir); } lib.linkLibrary(cimgui); + // TODO: this is a hack to get the cimgui.h header into the include path + const cimgui_include = b.dependency("cimgui", .{}).path(""); + lib.addIncludePath(cimgui_include); } return lib; } @@ -886,21 +889,28 @@ const libImGuiOptions = struct { }; fn buildImgui(b: *Build, options: libImGuiOptions) !*CompileStep { const imgui_cpp = b.dependency("imgui", .{}); - const imgui_cpp_dir = imgui_cpp.path(""); const cimgui = b.dependency("cimgui", .{}); - const cimgui_dir = cimgui.path(""); + + // create file tree for cimgui and imgui + const wf = b.addNamedWriteFiles("cimgui"); + const cimgui_dir = wf.addCopyDirectory(cimgui.path(""), "", .{}); + const imgui_cpp_dir = wf.addCopyDirectory(imgui_cpp.path(""), "imgui", .{}); const libimgui = b.addStaticLibrary(.{ .name = "cimgui", .target = options.target, .optimize = options.optimize, }); + if (libimgui.linkage == .static) libimgui.pie = true else if (libimgui.linkage == .static) libimgui.root_module.pic = true; - libimgui.addIncludePath(cimgui_dir); - libimgui.addIncludePath(imgui_cpp_dir); + + // FIXME: this is a hack to make cimgui work on build.zig | NOT USE C/IMGUI INCLUDES (get BUILD [Step] ERRORS) + // libimgui.addIncludePath(cimgui_dir); + // libimgui.addAfterIncludePath(imgui_cpp_dir); + if (libimgui.rootModuleTarget().isWasm()) { if (try emSdkSetupStep(b, options.emsdk.?)) |emsdk_setup| { libimgui.step.dependOn(&emsdk_setup.step); diff --git a/build.zig.zon b/build.zig.zon index 6f14b42..5f04c55 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,6 +1,6 @@ .{ .name = "sokol-d", - .version = "0.1.4", + .version = "0.1.5", .min_zig_version = "0.13.0", .paths = .{ "src", @@ -12,16 +12,16 @@ }, .dependencies = .{ .cimgui = .{ - .url = "git+https://github.com/kassane/cimgui#37b676a46c38f97e983b2e288741544ae6693c94", - .hash = "1220196b0ea3187c56ac1a319af951f85d6cd404c58f1401da8ffe0f1584ac3f2a3a", + .url = "git+https://github.com/cimgui/cimgui#1.91.3", + .hash = "1220b459b09242ad64353ca1f26ec48fd81c2a4ccdd5c4e088c14848488d2e0c2514", }, .imgui = .{ - .url = "git+https://github.com/ocornut/imgui#v1.91.1-docking", - .hash = "1220e3bfc93a0cf459fd9984a9d6f5f8664ce34982b9c11f75973f6341c29baae2b8", + .url = "git+https://github.com/ocornut/imgui#v1.91.3", + .hash = "1220dbde2c4211686e4d0431c0969fe48af2bd7f859d3eab9ee22b3c64750d86c408", }, .emsdk = .{ - .url = "git+https://github.com/emscripten-core/emsdk#3.1.67", - .hash = "12208a21e4a62ced46244c44c6215ff99c03c0d384ec3afea04b32c4b8ecb1baa41a", + .url = "git+https://github.com/emscripten-core/emsdk#3.1.68", + .hash = "122084d460283a7f621f64817c12a4689dacda8c8b02cf9c46747a3572c2166bee83", }, .shdc = .{ .url = "git+https://github.com/floooh/sokol-tools-bin#0732ba3f61dcfd0d0988f4c351421d84ec8b67e4", diff --git a/dub.sdl b/dub.sdl index 32be513..620ebd9 100644 --- a/dub.sdl +++ b/dub.sdl @@ -1,5 +1,5 @@ name "sokol-d" -version "0.1.4" +version "0.1.5" description "D bindings for sokol" authors "Matheus Catarino França" "Andre Weissflog" copyright "Copyright 2023-2024 - Matheus Catarino França"