xmake.lua 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637
  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.614.0", "9305df61de9916cc206b3b466fcb0afa4312664ef512f93939242adcfa029554")
  8. add_versions("v1.613.1", "c356d242e63f6c8e6fa8dec01f7d526b172621f0f6687611239f772095842e4c")
  9. add_versions("v1.613.0", "38852327d998e54d9faac93be28c1f8b6489442832eb380004e2fecedd907eef")
  10. add_versions("v1.610.0", "ce8036d57e4b3b87167bf82a0236fc09cba4ffa7088322912b8ce82f284555db")
  11. add_patches("1.610.0", path.join(os.scriptdir(), "patches", "1.610.0", "mingw.patch"), "7409d90adb1513e8683cc6d16aba1a3e73643c3e04b9af70474a5b13323be0fb")
  12. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  13. add_deps("cmake")
  14. if is_plat("mingw") then
  15. add_defines("__REQUIRED_RPCNDR_H_VERSION__=475")
  16. elseif is_plat("linux") then
  17. add_includedirs("include", "include/wsl/stubs")
  18. end
  19. on_install("windows", "mingw", "linux", function (package)
  20. local configs = {"-DDXHEADERS_BUILD_TEST=OFF", "-DDXHEADERS_BUILD_GOOGLE_TEST=OFF"}
  21. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  22. import("package.tools.cmake").install(package, configs)
  23. end)
  24. on_test(function (package)
  25. if package:is_plat("windows", "mingw") then
  26. assert(package:has_cxxtypes("CD3DX12FeatureSupport", {configs = {languages = "cxx14"}, includes = "directx/d3dx12.h"}))
  27. else
  28. assert(package:has_cxxincludes("wsl/winadapter.h", {configs = {languages = "cxx14"}}))
  29. end
  30. end)