xmake.lua 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package("directxmath")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/microsoft/DirectXMath")
  4. set_description("DirectXMath is an all inline SIMD C++ linear algebra library for use in games and graphics apps.")
  5. set_license("MIT")
  6. local tag = {
  7. ["2022.12"] = "dec2022",
  8. }
  9. add_urls("https://github.com/microsoft/DirectXMath/archive/refs/tags/$(version).zip", {version = function (version) return tag[tostring(version)] end})
  10. add_urls("https://github.com/microsoft/DirectXMath.git")
  11. add_versions("2022.12", "2ed0ae7d7fe5d11ad11f6d3d9b31ce686024a551cf82ade723de86aa7b4b57e1")
  12. if is_plat("linux") then
  13. add_resources("2022.12", "headers", "https://raw.githubusercontent.com/dotnet/runtime/2201016c1e13bdb9abf49e2e38cadf4ee0568df2/src/coreclr/pal/inc/rt/sal.h", "7dae281adc3a09a691291fb90526f05e4f9ef8b16d7f33d716ba690f7241a492")
  14. end
  15. add_deps("cmake")
  16. add_includedirs("include/directxmath")
  17. on_install("windows", "mingw", "linux", function (package)
  18. if package:is_plat("linux") then
  19. os.cp("../resources/headers/sal.h", package:installdir("include", "directxmath"))
  20. end
  21. import("package.tools.cmake").install(package, {"-DBUILD_TESTING=OFF"})
  22. end)
  23. on_test(function (package)
  24. assert(package:check_cxxsnippets({test = [[
  25. void test() {
  26. DirectX::XMVECTOR v = DirectX::XMVectorSet(1.0f, 2.0f, 3.0f, 4.0f);
  27. DirectX::XMMATRIX m = DirectX::XMMatrixIdentity();
  28. DirectX::XMVECTOR vResult = DirectX::XMVector4Transform(v, m);
  29. }
  30. ]]}, {configs = {languages = "cxx17"}, includes = "DirectXMath.h"}))
  31. end)