xmake.lua 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package("vulkan-memory-allocator-hpp")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://gpuopen-librariesandsdks.github.io/VulkanMemoryAllocator/html/")
  4. set_description("C++ bindings for VulkanMemoryAllocator.")
  5. set_license("CC0")
  6. add_urls("https://github.com/YaaZ/VulkanMemoryAllocator-Hpp/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/YaaZ/VulkanMemoryAllocator-Hpp.git")
  8. add_versions("v3.0.0", '2f062b1631af64519d09e7b319c2ba06d7de3c9c5589fb7109a3f4e341cee2b7')
  9. add_versions("v3.0.1-1", '0e0c374751d5ca6123d0ae0df756693f0674412d7c758ec4a39a5a9dcc412911')
  10. add_versions("v3.0.1-3", '66a3d4be3bc1404c844b5a36aadeb6b366878e7cf1efe899eb0a0095f3871aae')
  11. add_versions("v3.1.0", 'f5cbce9b8efdb0de721f22b172c76184979e93ee45a008bfe515533d5d2e2d36')
  12. add_versions("v3.2.0", '7f24c857642ed9c030a843738892188301f6409e4405938f3f83ba12f0e3b553')
  13. add_versions("v3.2.1", '517fb3fd0d36038124b9644907784840c7e33c52f259b324156687b82fc6a878')
  14. add_configs("modules", {description = "Build with C++20 modules support.", default = false, type = "boolean"})
  15. add_configs("use_vulkanheaders", {description = "Use vulkan-headers package instead of vulkan-hpp.", default = false, type = "boolean"})
  16. add_deps("vulkan-memory-allocator")
  17. on_install("windows|x86", "windows|x64", "linux", "macosx", "mingw", "android", "iphoneos", function (package)
  18. if not package:config("modules") then
  19. if package:config("use_vulkanheaders") then
  20. if package:gitref() or package:version():ge("3.0.1") then
  21. package:add("deps", "vulkan-headers >= 1.3.234")
  22. else
  23. package:add("deps", "vulkan-headers < 1.3.234")
  24. end
  25. else
  26. if package:gitref() or package:version():ge("3.0.1") then
  27. package:add("deps", "vulkan-hpp >= 1.3.234")
  28. else
  29. package:add("deps", "vulkan-hpp < 1.3.234")
  30. end
  31. end
  32. os.cp("include", package:installdir())
  33. else
  34. local vulkan_dep
  35. if package:config("use_vulkanheaders") then
  36. vulkan_dep = "vulkan-headers"
  37. package:add("deps", "vulkan-headers >= 1.3.275")
  38. else
  39. vulkan_dep = "vulkan-hpp"
  40. package:add("deps", "vulkan-hpp >= 1.3.275")
  41. end
  42. io.writefile("xmake.lua", format([[
  43. add_requires("vulkan-memory-allocator", "%s >= 1.3.275")
  44. target("vulkan-memory-allocator-hpp")
  45. set_kind("moduleonly")
  46. set_languages("c++20")
  47. add_headerfiles("include/(**.hpp)")
  48. add_includedirs("include")
  49. add_files("src/*.cppm", {public = true})
  50. add_packages("vulkan-memory-allocator", "%s")
  51. ]], vulkan_dep, vulkan_dep))
  52. local configs = {}
  53. import("package.tools.xmake").install(package, configs)
  54. end
  55. end)
  56. on_test(function (package)
  57. assert(package:check_cxxsnippets({test = [[
  58. void test() {
  59. int version = VMA_VULKAN_VERSION;
  60. }
  61. ]]}, {includes = "vk_mem_alloc.hpp", configs = {languages = package:version():ge("3.2.0") and "c++17" or "c++14"} }))
  62. end)