xmake.lua 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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_configs("modules", {description = "Build with C++20 modules support.", default = false, type = "boolean"})
  12. add_configs("use_vulkanheaders", {description = "Use vulkan-headers package instead of vulkan-hpp.", default = false, type = "boolean"})
  13. add_deps("vulkan-memory-allocator")
  14. on_install("windows|x86", "windows|x64", "linux", "macosx", "mingw", "android", "iphoneos", function (package)
  15. if not package:config("modules") then
  16. if package:config("use_vulkanheaders") then
  17. if package:gitref() or package:version():ge("3.0.1") then
  18. package:add("deps", "vulkan-headers >= 1.3.234")
  19. else
  20. package:add("deps", "vulkan-headers < 1.3.234")
  21. end
  22. else
  23. if package:gitref() or package:version():ge("3.0.1") then
  24. package:add("deps", "vulkan-hpp >= 1.3.234")
  25. else
  26. package:add("deps", "vulkan-hpp < 1.3.234")
  27. end
  28. end
  29. os.cp("include", package:installdir())
  30. else
  31. local vulkan_dep
  32. if package:config("use_vulkanheaders") then
  33. vulkan_dep = "vulkan-headers"
  34. package:add("deps", "vulkan-headers >= 1.3.275")
  35. else
  36. vulkan_dep = "vulkan-hpp"
  37. package:add("deps", "vulkan-hpp >= 1.3.275")
  38. end
  39. io.writefile("xmake.lua", format([[
  40. add_requires("vulkan-memory-allocator", "%s >= 1.3.275")
  41. target("vulkan-memory-allocator-hpp")
  42. set_kind("static")
  43. set_languages("c++20")
  44. add_headerfiles("include/(**.hpp)")
  45. add_includedirs("include")
  46. add_files("src/*.cppm", {public = true})
  47. add_packages("vulkan-memory-allocator", "%s")
  48. ]], vulkan_dep, vulkan_dep))
  49. local configs = {}
  50. import("package.tools.xmake").install(package, configs)
  51. end
  52. end)
  53. on_test(function (package)
  54. assert(package:check_cxxsnippets({test = [[
  55. void test() {
  56. int version = VMA_VULKAN_VERSION;
  57. }
  58. ]]}, {includes = "vk_mem_alloc.hpp", configs = {languages = "c++14"} }))
  59. end)