From 039a8540f4ef8802688596066c19ed4f89ffd923 Mon Sep 17 00:00:00 2001 From: Frank Zhuang Date: Sun, 4 Sep 2022 23:58:49 +0800 Subject: [PATCH] update imgui vulkan backend (#1457) --- packages/i/imgui/port/xmake.lua | 12 +++++++++++- packages/i/imgui/xmake.lua | 4 ++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/i/imgui/port/xmake.lua b/packages/i/imgui/port/xmake.lua index ecb705e30..1cc6c7655 100644 --- a/packages/i/imgui/port/xmake.lua +++ b/packages/i/imgui/port/xmake.lua @@ -4,6 +4,7 @@ set_languages("cxx11") option("wchar32", {showmenu = true, default = false}) option("freetype", {showmenu = true, default = false}) option("glfw_opengl3", {showmenu = true, default = false}) +option("glfw_vulkan", {showmenu = true, default = false}) option("user_config", {showmenu = true, default = nil, type = "string"}) option("use_glad", {showmenu = true, default = false}) @@ -16,6 +17,10 @@ if has_config("glfw_opengl3") then if has_config("use_glad") then add_requires("glad") end +elseif has_config("glfw_vulkan") then + add_requires("glfw") + add_requires("vulkansdk") + add_requires("vulkan-headers") end target("imgui") @@ -47,6 +52,11 @@ target("imgui") else add_headerfiles("backends/imgui_impl_opengl3_loader.h") end + elseif has_config("glfw_vulkan") then + add_files("backends/imgui_impl_vulkan.cpp", "backends/imgui_impl_glfw.cpp") + add_headerfiles("backends/imgui_impl_vulkan.h", "backends/imgui_impl_glfw.h") + add_packages("glfw") + add_packages("vulkan-headers") end if has_config("user_config") then @@ -63,4 +73,4 @@ target("imgui") if has_config("freetype") then io.gsub(config_file, "//#define IMGUI_ENABLE_FREETYPE", "#define IMGUI_ENABLE_FREETYPE") end - end) \ No newline at end of file + end) diff --git a/packages/i/imgui/xmake.lua b/packages/i/imgui/xmake.lua index e18ba2888..b107659b2 100644 --- a/packages/i/imgui/xmake.lua +++ b/packages/i/imgui/xmake.lua @@ -25,6 +25,7 @@ package("imgui") add_configs("user_config", {description = "Use user config (disables test!)", default = nil, type = "string"}) add_configs("glfw_opengl3", {description = "Use glfw+opengl3 as backend", default = false, type = "boolean"}) + add_configs("glfw_vulkan", {description = "Use glfw+vulkan as backend", default = false, type = "boolean"}) add_configs("wchar32", {description = "Use 32-bit for ImWchar (default is 16-bit)", default = false, type = "boolean"}) add_configs("freetype", {description = "Use FreeType to build and rasterize the font atlas", default = false, type = "boolean"}) @@ -44,6 +45,8 @@ package("imgui") package:add("defines", "IMGUI_IMPL_OPENGL_LOADER_GLAD") end package:add("deps", "glfw") + elseif package:config("glfw_vulkan") then + package:add("deps", "glfw") end if package:version_str():find("-docking", 1, true) then package:set("urls", {"https://github.com/ocornut/imgui.git"}) @@ -55,6 +58,7 @@ package("imgui") wchar32 = package:config("wchar32"), freetype = package:config("freetype"), glfw_opengl3 = package:config("glfw_opengl3"), + glfw_vulkan = package:config("glfw_vulkan"), user_config = package:config("user_config"), use_glad = package:version():lt("1.84") -- this flag will be used if glfw_opengl3 is enabled }