Explorar el Código

support vulkan-loader for macOS

ruki hace 4 años
padre
commit
7ffb8cd602
Se han modificado 1 ficheros con 16 adiciones y 2 borrados
  1. 16 2
      packages/v/vulkan-loader/xmake.lua

+ 16 - 2
packages/v/vulkan-loader/xmake.lua

@@ -14,15 +14,29 @@ package("vulkan-loader")
         add_deps("wayland", "libxrandr", "libxcb", "libxkbcommon")
     end
 
-    on_load("windows", "linux", function (package)
+    on_load("windows", "linux", "macosx", function (package)
         local sdkver = package:version():split("%+")[1]
         package:add("deps", "vulkan-headers " .. sdkver)
         if not package.is_built or package:is_built() then
             package:add("deps", "cmake", "ninja")
         end
+        if package:is_plat("macosx") then
+            package:add("links", "vulkan")
+        end
+    end)
+
+    on_fetch("macosx", function (package, opt)
+        if opt.system then
+            import("lib.detect.find_path")
+            local libdir = find_path("libvulkan.dylib", "~/VulkanSDK/*/macOS/lib")
+            local includedir = find_path("vulkan/vulkan.h", "~/VulkanSDK/*/macOS/include")
+            if libdir and includedir then
+                return {linkdirs = libdir, links = "vulkan", includedirs = includedir}
+            end
+        end
     end)
 
-    on_install("windows", "linux", function (package)
+    on_install("windows", "linux", "macosx", function (package)
         import("package.tools.cmake")
         local envs = cmake.buildenvs(package, {cmake_generator = "Ninja"})
         if package:is_plat("linux") then