pkg/cimgui: add metal backend

This commit is contained in:
Mitchell Hashimoto
2023-10-18 17:34:12 -07:00
parent f3d99efcd8
commit 3ac6e8392d
3 changed files with 16 additions and 0 deletions

View File

@ -47,6 +47,14 @@ pub fn build(b: *std.Build) !void {
.flags = flags.items,
});
if (target.isDarwin()) {
if (!target.isNative()) try @import("apple_sdk").addPaths(b, lib);
lib.addCSourceFile(.{
.file = imgui.path("backends/imgui_impl_metal.mm"),
.flags = flags.items,
});
}
lib.installHeadersDirectoryOptions(.{
.source_dir = .{ .path = "vendor" },
.install_dir = .header,

View File

@ -9,5 +9,7 @@
.url = "https://github.com/ocornut/imgui/archive/1d8e48c161370c37628c4f37f3f87cb19fbcb723.tar.gz",
.hash = "12205e93e208aada4c835acdc3e2c1fac95b3ad92b47abe6412ab043f9f13817ad9b",
},
.apple_sdk = .{ .path = "../apple-sdk" },
},
}

View File

@ -11,3 +11,9 @@ pub extern fn ImGui_ImplOpenGL3_Init(?[*:0]const u8) callconv(.C) void;
pub extern fn ImGui_ImplOpenGL3_Shutdown() callconv(.C) void;
pub extern fn ImGui_ImplOpenGL3_NewFrame() callconv(.C) void;
pub extern fn ImGui_ImplOpenGL3_RenderDrawData(*c.ImDrawData) callconv(.C) void;
// Metal
pub extern fn ImGui_ImplMetal_Init(*anyopaque) callconv(.C) bool;
pub extern fn ImGui_ImplMetal_Shutdown() callconv(.C) void;
pub extern fn ImGui_ImplMetal_NewFrame(*anyopaque) callconv(.C) void;
pub extern fn ImGui_ImplMetal_RenderDrawData(*c.ImDrawData, *anyopaque, *anyopaque) callconv(.C) void;