Procházet zdrojové kódy

imgui learned a wgpu config (#2562)

Yotam Gingold před 2 roky
rodič
revize
d951fbd892
2 změnil soubory, kde provedl 16 přidání a 0 odebrání
  1. 11 0
      packages/i/imgui/port/xmake.lua
  2. 5 0
      packages/i/imgui/xmake.lua

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

@@ -13,6 +13,7 @@ option("sdl2",             {showmenu = true,  default = false})
 option("sdl2_renderer",    {showmenu = true,  default = false})
 option("vulkan",           {showmenu = true,  default = false})
 option("win32",            {showmenu = true,  default = false})
+option("wgpu",             {showmenu = true,  default = false})
 option("freetype",         {showmenu = true,  default = false})
 option("user_config",      {showmenu = true,  default = nil, type = "string"})
 option("wchar32",          {showmenu = true,  default = false})
@@ -35,6 +36,10 @@ if has_config("vulkan") then
     add_requires("vulkansdk")
 end
 
+if has_config("wgpu") then
+    add_requires("wgpu-native")
+end
+
 if has_config("freetype") then
     add_requires("freetype")
 end
@@ -119,6 +124,12 @@ target("imgui")
         add_files("backends/imgui_impl_win32.cpp")
         add_headerfiles("(backends/imgui_impl_win32.h)")
     end
+    
+    if has_config("wgpu") then
+        add_files("backends/imgui_impl_wgpu.cpp")
+        add_headerfiles("(backends/imgui_impl_wgpu.h)")
+        add_packages("wgpu-native")
+    end
 
     if has_config("freetype") then
         add_files("misc/freetype/imgui_freetype.cpp")

+ 5 - 0
packages/i/imgui/xmake.lua

@@ -49,6 +49,7 @@ package("imgui")
     add_configs("sdl2_renderer",    {description = "Enable the sdl2 renderer backend", default = false, type = "boolean"})
     add_configs("vulkan",           {description = "Enable the vulkan backend", default = false, type = "boolean"})
     add_configs("win32",            {description = "Enable the win32 backend", default = false, type = "boolean"})
+    add_configs("wgpu",             {description = "Enable the wgpu backend", default = false, type = "boolean"})
     add_configs("freetype",         {description = "Use FreeType to build and rasterize the font atlas", default = false, type = "boolean"})
     add_configs("user_config",      {description = "Use user config (disables test!)", default = nil, type = "string"})
     add_configs("wchar32",          {description = "Use 32-bit for ImWchar (default is 16-bit)", default = false, type = "boolean"})
@@ -101,6 +102,9 @@ package("imgui")
         if package:config("vulkan") then
             package:add("deps", "vulkansdk")
         end
+        if package:config("wgpu") then
+            package:add("deps", "wgpu-native")
+        end
         if package:config("freetype") then
             package:add("deps", "freetype")
         end
@@ -123,6 +127,7 @@ package("imgui")
             sdl2_renderer    = package:config("sdl2_renderer"),
             vulkan           = package:config("vulkan"),
             win32            = package:config("win32"),
+            wgpu             = package:config("wgpu"),
             freetype         = package:config("freetype"),
             user_config      = package:config("user_config"),
             wchar32          = package:config("wchar32")