xmake.lua 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package("vulkansdk")
  2. set_homepage("https://www.lunarg.com/vulkan-sdk/")
  3. set_description("LunarG Vulkan® SDK")
  4. add_configs("shared", {description = "Build shared library.", default = true, type = "boolean", readonly = true})
  5. add_configs("utils", {description = "Enabled vulkan utilities.", default = {}, type = "table"})
  6. on_load(function (package)
  7. import("detect.sdks.find_vulkansdk")
  8. local vulkansdk = find_vulkansdk()
  9. if vulkansdk then
  10. package:addenv("PATH", vulkansdk.bindir)
  11. end
  12. end)
  13. on_fetch(function (package, opt)
  14. if opt.system then
  15. import("detect.sdks.find_vulkansdk")
  16. import("lib.detect.find_library")
  17. local vulkansdk = find_vulkansdk()
  18. if vulkansdk then
  19. local result = {includedirs = vulkansdk.includedirs, linkdirs = vulkansdk.linkdirs, links = {}}
  20. local utils = package:config("utils")
  21. table.insert(utils, package:is_plat("windows") and "vulkan-1" or "vulkan")
  22. for _, util in ipairs(utils) do
  23. if not find_library(util, vulkansdk.linkdirs) then
  24. wprint(format("The library %s for %s is not found!", util, package:arch()))
  25. return
  26. end
  27. table.insert(result.links, util)
  28. end
  29. return result
  30. end
  31. end
  32. end)