Ver Fonte

update imgui vulkan backend (#1457)

Frank Zhuang há 3 anos atrás
pai
commit
039a8540f4
2 ficheiros alterados com 15 adições e 1 exclusões
  1. 11 1
      packages/i/imgui/port/xmake.lua
  2. 4 0
      packages/i/imgui/xmake.lua

+ 11 - 1
packages/i/imgui/port/xmake.lua

@@ -4,6 +4,7 @@ set_languages("cxx11")
 option("wchar32",      {showmenu = true,  default = false})
 option("wchar32",      {showmenu = true,  default = false})
 option("freetype",     {showmenu = true,  default = false})
 option("freetype",     {showmenu = true,  default = false})
 option("glfw_opengl3", {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("user_config",  {showmenu = true,  default = nil, type = "string"})
 option("use_glad",     {showmenu = true,  default = false})
 option("use_glad",     {showmenu = true,  default = false})
 
 
@@ -16,6 +17,10 @@ if has_config("glfw_opengl3") then
     if has_config("use_glad") then
     if has_config("use_glad") then
         add_requires("glad")
         add_requires("glad")
     end
     end
+elseif has_config("glfw_vulkan") then
+    add_requires("glfw")
+    add_requires("vulkansdk")
+    add_requires("vulkan-headers")
 end
 end
 
 
 target("imgui")
 target("imgui")
@@ -47,6 +52,11 @@ target("imgui")
         else
         else
             add_headerfiles("backends/imgui_impl_opengl3_loader.h")
             add_headerfiles("backends/imgui_impl_opengl3_loader.h")
         end
         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
     end
 
 
     if has_config("user_config") then
     if has_config("user_config") then
@@ -63,4 +73,4 @@ target("imgui")
         if has_config("freetype") then
         if has_config("freetype") then
             io.gsub(config_file, "//#define IMGUI_ENABLE_FREETYPE", "#define IMGUI_ENABLE_FREETYPE")
             io.gsub(config_file, "//#define IMGUI_ENABLE_FREETYPE", "#define IMGUI_ENABLE_FREETYPE")
         end
         end
-    end)
+    end)

+ 4 - 0
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("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_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("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"})
     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")
                 package:add("defines", "IMGUI_IMPL_OPENGL_LOADER_GLAD")
             end
             end
             package:add("deps", "glfw")
             package:add("deps", "glfw")
+        elseif package:config("glfw_vulkan") then
+            package:add("deps", "glfw")
         end
         end
         if package:version_str():find("-docking", 1, true) then
         if package:version_str():find("-docking", 1, true) then
             package:set("urls", {"https://github.com/ocornut/imgui.git"})
             package:set("urls", {"https://github.com/ocornut/imgui.git"})
@@ -55,6 +58,7 @@ package("imgui")
             wchar32      = package:config("wchar32"),
             wchar32      = package:config("wchar32"),
             freetype     = package:config("freetype"),
             freetype     = package:config("freetype"),
             glfw_opengl3 = package:config("glfw_opengl3"),
             glfw_opengl3 = package:config("glfw_opengl3"),
+            glfw_vulkan  = package:config("glfw_vulkan"),
             user_config  = package:config("user_config"),
             user_config  = package:config("user_config"),
             use_glad     = package:version():lt("1.84") -- this flag will be used if glfw_opengl3 is enabled
             use_glad     = package:version():lt("1.84") -- this flag will be used if glfw_opengl3 is enabled
         }
         }