xmake.lua 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package("vulkan-hpp")
  2. set_homepage("https://github.com/KhronosGroup/Vulkan-Hpp/")
  3. set_description("Open-Source Vulkan C++ API")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/KhronosGroup/Vulkan-Hpp.git")
  6. add_versions("v1.2.180", "bfa6d4765212505c8241a44b97dc5a9ce3aa2969")
  7. add_versions("v1.2.189", "58ff1da4c03f5f124eb835f41a9dd8fe3c2e8087")
  8. add_versions("v1.2.198", "d8c9f4f0eee6972622a1c3aabab5ed558d37c1c0")
  9. add_deps("cmake")
  10. if is_plat("linux") then
  11. add_extsources("pacman::vulkan-headers")
  12. end
  13. on_install("windows", "linux", "macosx", "mingw", function (package)
  14. local arch_prev
  15. if package:is_plat("mingw") and package.plat_set then
  16. arch_prev = package:arch()
  17. package:plat_set(os.host())
  18. package:arch_set(os.arch())
  19. end
  20. import("package.tools.cmake").build(package, {buildir = "build"})
  21. if arch_prev then
  22. package:plat_set("mingw")
  23. package:arch_set(arch_prev)
  24. end
  25. os.mkdir("build")
  26. if is_host("windows") then
  27. os.cp(path.join("**", "VulkanHppGenerator.exe"), "build")
  28. else
  29. os.cp(path.join("**", "VulkanHppGenerator"), "build")
  30. end
  31. os.runv(path.join("build", "VulkanHppGenerator"))
  32. os.cp("Vulkan-Headers/include", package:installdir())
  33. os.cp("vulkan/*.hpp", package:installdir(path.join("include", "vulkan")))
  34. end)
  35. on_test(function (package)
  36. assert(package:check_cxxsnippets({test = [[
  37. void test() {
  38. vk::ApplicationInfo ai;
  39. ai.pApplicationName = "Test";
  40. ai.applicationVersion = VK_MAKE_API_VERSION(1,0,0,0);
  41. ai.pEngineName = "Test";
  42. ai.engineVersion = VK_MAKE_API_VERSION(1,0,0,0);
  43. ai.apiVersion = VK_API_VERSION_1_0;
  44. }
  45. ]]}, {includes = "vulkan/vulkan.hpp", configs = {languages = "c++11"} }))
  46. end)