xmake.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. package("directx-headers")
  2. set_homepage("https://github.com/microsoft/DirectX-Headers")
  3. set_description("Official DirectX headers")
  4. set_license("MIT")
  5. add_urls("https://github.com/microsoft/DirectX-Headers/archive/refs/tags/$(version).zip",
  6. "https://github.com/microsoft/DirectX-Headers.git")
  7. add_versions("v1.610.0", "ce8036d57e4b3b87167bf82a0236fc09cba4ffa7088322912b8ce82f284555db")
  8. add_patches("1.610.0", path.join(os.scriptdir(), "patches", "1.610.0", "mingw.patch"), "7409d90adb1513e8683cc6d16aba1a3e73643c3e04b9af70474a5b13323be0fb")
  9. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  10. add_deps("cmake")
  11. if is_plat("mingw") then
  12. add_defines("__REQUIRED_RPCNDR_H_VERSION__=475")
  13. elseif is_plat("linux") then
  14. add_includedirs("include", "include/wsl/stubs")
  15. end
  16. on_install("windows", "mingw", "linux", function (package)
  17. local configs = {"-DDXHEADERS_BUILD_TEST=OFF", "-DDXHEADERS_BUILD_GOOGLE_TEST=OFF"}
  18. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  19. import("package.tools.cmake").install(package, configs)
  20. end)
  21. on_test(function (package)
  22. if package:is_plat("windows", "mingw") then
  23. assert(package:has_cxxtypes("CD3DX12FeatureSupport", {configs = {languages = "cxx14"}, includes = "directx/d3dx12.h"}))
  24. else
  25. assert(package:has_cxxincludes("wsl/winadapter.h", {configs = {languages = "cxx14"}}))
  26. end
  27. end)