xmake.lua 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package("moltenvk")
  2. set_homepage("https://github.com/KhronosGroup/MoltenVK")
  3. set_description("MoltenVK is a Vulkan Portability implementation.")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/KhronosGroup/MoltenVK/archive/v$(version).tar.gz")
  6. add_versions("1.1.0", "0538fa1c23ddae495c7f82ccd0db90790a90b7017a258ca7575fbae8021f3058")
  7. add_versions("1.1.4", "f9bba6d3bf3648e7685c247cb6d126d62508af614bc549cedd5859a7da64967e")
  8. add_versions("1.1.5", "2cdcb8dbf2acdcd8cbe70b109dadc05a901038c84970afbe4863e5e23f33deae")
  9. add_versions("1.2.0", "6e7af2dad0530b2b404480dbe437ca4670c6615cc2ec6cf6a20ed04d9d75e0bd")
  10. if is_plat("macosx") then
  11. add_extsources("brew::molten-vk")
  12. end
  13. on_fetch("macosx", function (package, opt)
  14. if opt.system then
  15. import("lib.detect.find_path")
  16. local frameworkdir = find_path("vulkan.framework", "~/VulkanSDK/*/macOS/Frameworks")
  17. if frameworkdir then
  18. return {frameworkdirs = frameworkdir, frameworks = "vulkan", rpathdirs = frameworkdir}
  19. end
  20. end
  21. end)
  22. on_install("macosx", function (package)
  23. local configs = {"--macos"}
  24. if package:debug() then
  25. table.insert(configs, "--debug")
  26. end
  27. os.vrunv("./fetchDependencies", configs)
  28. local conf = package:debug() and "Debug" or "Release"
  29. os.vrun("xcodebuild build -quiet -project MoltenVKPackaging.xcodeproj -scheme \"MoltenVK Package (macOS only)\" -configuration \"" .. conf)
  30. os.mv("Package/" .. conf .. "/MoltenVK/include", package:installdir())
  31. os.mv("Package/" .. conf .. "/MoltenVK/dylib/macOS/*", package:installdir("lib"))
  32. os.mv("Package/" .. conf .. "/MoltenVK/MoltenVK.xcframework/macos-*/*.a", package:installdir("lib"))
  33. os.mv("Package/" .. conf .. "/MoltenVKShaderConverter/Tools/*", package:installdir("bin"))
  34. os.mv("Package/" .. conf .. "/MoltenVKShaderConverter/MoltenVKShaderConverter.xcframework/macos-*/*.a", package:installdir("lib"))
  35. os.mv("Package/" .. conf .. "/MoltenVKShaderConverter/include/*.h", package:installdir("include"))
  36. package:addenv("PATH", "bin")
  37. end)
  38. on_test(function (package)
  39. assert(package:has_cfuncs("vkGetDeviceProcAddr", {includes = "vulkan/vulkan_core.h"}))
  40. end)