xmake.lua 2.1 KB

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