Explorar o código

vulkan-hpp: update to v1.2.281, fix MSVC bug (#3720)

* Add a config providing a workaround to avoid a MSVC bug while compiling vulkan-hpp as modules

* Update vulkan-hpp to v1.2.281

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

---------

Co-authored-by: c8ef <[email protected]>
vspefs hai 1 ano
pai
achega
f3e196f43b
Modificáronse 1 ficheiros con 40 adicións e 24 borrados
  1. 40 24
      packages/v/vulkan-hpp/xmake.lua

+ 40 - 24
packages/v/vulkan-hpp/xmake.lua

@@ -18,8 +18,15 @@ package("vulkan-hpp")
     add_versions("v1.3.268", "d2134fefe22279595aee73752099022222468a60")
     add_versions("v1.3.272", "e621db07719c0c1c738ad39ef400737a750bb23a")
     add_versions("v1.3.275", "1a24b015830c116632a0723f3ccfd1f06009ce12")
+    add_versions("v1.3.276", "d4b36b82236e052a5e6e4cea5fe7967d5b565ebc")
+    add_versions("v1.3.277", "c5c1994f79298543af93d7956b654bdefdfbdd26")
+    add_versions("v1.3.278", "29723f90a127ff08d9099855378162f04b4ffddd")
+    add_versions("v1.3.279", "6fb8def27290f8b87d7835457a9c68190aed9a9a")
+    add_versions("v1.3.280", "e35acfe75215116029298aebf681170559a4fe6a")
+    add_versions("v1.3.281", "88d508b32f207ba85b37fe22fe3732322d1c248d")
 
     add_configs("modules", {description = "Build with C++20 modules support.", default = false, type = "boolean"})
+    add_configs("msvc_modules", {description = "If 'modules' enabled, and you wish to use MSVC on the package, enable this to avoid a known bug of MSVC.", default = false, type = "boolean"})
 
     on_load(function (package)
         if not package:config("modules") then
@@ -30,8 +37,8 @@ package("vulkan-hpp")
         end
     end)
 
-
-    on_install("windows|x86", "windows|x64", "linux", "macosx", "mingw", "android", "iphoneos", function (package)
+    -- TODO: add android, windows|x86, mingw|i386 target
+    on_install("windows|x64", "linux", "macosx", "mingw|x86_64", "iphoneos", function (package)
         local arch_prev
         local plat_prev
         if (package:is_plat("mingw") or package:is_cross()) and package.plat_set then
@@ -56,32 +63,41 @@ package("vulkan-hpp")
             os.cp("Vulkan-Headers/include", package:installdir())
             os.cp("vulkan/*.hpp", package:installdir(path.join("include", "vulkan")))
         else
-            io.writefile("xmake.lua", [[ 
-                target("vulkan-hpp")
-                    set_kind("static")
-                    set_languages("c++20")
-                    add_headerfiles("Vulkan-Headers/include/(**.h)")
-                    add_headerfiles("Vulkan/(**.h)")
-                    add_headerfiles("Vulkan-Headers/include/(**.hpp)")
-                    add_headerfiles("Vulkan/(**.hpp)")
-                    add_includedirs("Vulkan")
-                    add_includedirs("Vulkan-Headers/include")
-                    add_files("Vulkan/vulkan.cppm", {public = true})
-            ]])
+            if package:config("msvc_modules") then
+                io.writefile("xmake.lua", [[ 
+                    target("vulkan-hpp")
+                        set_kind("moduleonly")
+                        set_languages("c++20")
+                        set_toolchains("msvc")
+                        add_cxflags("/EHsc")
+                        add_headerfiles("Vulkan-Headers/include/(**.h)")
+                        add_headerfiles("Vulkan/(**.h)")
+                        add_headerfiles("Vulkan-Headers/include/(**.hpp)")
+                        add_headerfiles("Vulkan/(**.hpp)")
+                        add_includedirs("Vulkan")
+                        add_includedirs("Vulkan-Headers/include")
+                        add_files("Vulkan/vulkan.cppm")
+                        add_defines("VULKAN_HPP_NO_SMART_HANDLE")
+                ]])
+            else
+                io.writefile("xmake.lua", [[ 
+                    target("vulkan-hpp")
+                        set_kind("static")
+                        set_languages("c++20")
+                        add_headerfiles("Vulkan-Headers/include/(**.h)")
+                        add_headerfiles("Vulkan/(**.h)")
+                        add_headerfiles("Vulkan-Headers/include/(**.hpp)")
+                        add_headerfiles("Vulkan/(**.hpp)")
+                        add_includedirs("Vulkan")
+                        add_includedirs("Vulkan-Headers/include")
+                        add_files("Vulkan/vulkan.cppm", {public = true})
+                ]])
+            end
             local configs = {}
             import("package.tools.xmake").install(package, configs)
         end
     end)
 
     on_test(function (package)
-        assert(package:check_cxxsnippets({test = [[
-            void test() {
-                vk::ApplicationInfo ai;
-                ai.pApplicationName = "Test";
-                ai.applicationVersion = VK_MAKE_API_VERSION(1,0,0,0);
-                ai.pEngineName = "Test";
-                ai.engineVersion = VK_MAKE_API_VERSION(1,0,0,0);
-                ai.apiVersion = VK_API_VERSION_1_0;
-            }
-        ]]}, {includes = "vulkan/vulkan.hpp", configs = {languages = "c++14"} }))
+        assert(package:has_cxxincludes("vulkan/vulkan.hpp", {configs = {languages = "c++14"}}))
     end)