Browse Source

[Vulkan, Volk] Add vulkan support of on iOS, update volk to latest version andd add header only support (#1183)

* [Volk] Update to latest version

* [Volk] Remove incomplete shared library support and add header only support

* [Vulkan] add iOS support

* [Volk] Fix indentation and disable shared build
Arthapz 3 years ago
parent
commit
fadd1061a5

+ 32 - 16
packages/v/volk/xmake.lua

@@ -5,35 +5,51 @@ package("volk")
     set_license("MIT")
 
     add_urls("https://github.com/zeux/volk/archive/$(version).tar.gz",
-             "https://github.com/zeux/volk.git")
+            "https://github.com/zeux/volk.git")
     add_versions("1.2.190", "07f03720b8c70a626c98cc9545350538122bca9f853e6ed20ccad5a25d55fa4b")
     add_versions("1.2.162", "ac4d9d6e88dee5a83ad176e2da57f1989ca2c6df155a0aeb5e18e9471aa4d777")
+    add_versions("1.3.204", "7776e7f3c70f199579da33d2ccd7152ca8b96182fa98c31fbe80880cef0fdf70")
 
     add_deps("vulkan-headers")
 
+    add_configs("header_only", {description = "Header only.", default = false, type = "boolean"})
     add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
 
     if is_plat("linux") then
         add_syslinks("dl")
     end
 
-    on_install("windows", "linux", "macosx", function (package)
-        io.writefile("xmake.lua", [[
-            add_rules("mode.debug", "mode.release")
-            add_requires("vulkan-headers")
-            target("volk")
-                set_kind("static")
-                add_files("volk.c")
-                add_headerfiles("volk.h")
-                add_packages("vulkan-headers")
-                if is_plat("linux") then
-                    add_syslinks("dl")
-                end
-        ]])
+    on_install("windows", "linux", "macosx", "iphoneos", "android", function (package)
+        if not package:config("header_only") then
+            io.writefile("xmake.lua", [[
+                add_rules("mode.debug", "mode.release")
+                add_requires("vulkan-headers")
+                target("volk")
+                    set_kind("static")
+                    add_files("volk.c")
+                    add_headerfiles("volk.h")
+                    add_packages("vulkan-headers")
+                    if is_plat("linux") then
+                        add_syslinks("dl")
+                    end
+            ]])
+        else
+            io.writefile("xmake.lua", [[
+                add_requires("vulkan-headers")
+                target("volk")
+                    set_kind("headeronly")
+                    add_headerfiles("volk.h")
+                    add_packages("vulkan-headers")
+                    if is_plat("linux") then
+                        add_syslinks("dl")
+                    end
+            ]])
+
+            os.cp("volk.c", package:installdir("include"))
+        end
         import("package.tools.xmake").install(package)
     end)
 
     on_test(function (package)
         assert(package:has_cfuncs("volkInitialize", {includes = "volk.h"}))
-    end)
-    
+    end)

+ 1 - 1
packages/v/vulkan-headers/xmake.lua

@@ -18,7 +18,7 @@ package("vulkan-headers")
       add_extsources("pacman::vulkan-headers")
     end
 
-    on_install("windows", "linux", "macosx", "android", function (package)
+    on_install("windows", "linux", "macosx", "iphoneos", "android", function (package)
         import("package.tools.cmake").install(package)
     end)
 

+ 1 - 1
packages/v/vulkan-memory-allocator/xmake.lua

@@ -9,7 +9,7 @@ package("vulkan-memory-allocator")
 
     add_deps("vulkan-headers")
 
-    on_install("windows", "linux", "macosx", "android", function (package)
+    on_install("windows", "linux", "macosx", "iphoneos", "android", function (package)
         os.cp("include/vk_mem_alloc.h", package:installdir("include"))
     end)