Skip to content

Commit

Permalink
Merge pull request #29 from kassane/fix-imgui-dep
Browse files Browse the repository at this point in the history
Remove `kassane/cimgui`
  • Loading branch information
kassane authored Oct 8, 2024
2 parents 610bc74 + d5823a4 commit cc90ad5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
18 changes: 14 additions & 4 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down
14 changes: 7 additions & 7 deletions build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.{
.name = "sokol-d",
.version = "0.1.4",
.version = "0.1.5",
.min_zig_version = "0.13.0",
.paths = .{
"src",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion dub.sdl
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit cc90ad5

Please sign in to comment.