2
0

xmake.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. ["2024.02"] = "feb2024"
  9. }
  10. add_urls("https://github.com/microsoft/DirectXMath/archive/refs/tags/$(version).zip", {version = function (version) return tag[tostring(version)] end})
  11. add_urls("https://github.com/microsoft/DirectXMath.git")
  12. add_versions("2022.12", "2ed0ae7d7fe5d11ad11f6d3d9b31ce686024a551cf82ade723de86aa7b4b57e1")
  13. add_versions("2024.02", "214d71420107249dfb4bbc37a573f288b0951cc9ffe323dbf662101f3df4d766")
  14. if is_plat("linux", "macosx") then
  15. add_resources(">=2022.12", "headers", "https://raw.githubusercontent.com/dotnet/runtime/2201016c1e13bdb9abf49e2e38cadf4ee0568df2/src/coreclr/pal/inc/rt/sal.h", "7dae281adc3a09a691291fb90526f05e4f9ef8b16d7f33d716ba690f7241a492")
  16. end
  17. add_deps("cmake")
  18. add_includedirs("include/directxmath")
  19. on_install("windows", "mingw|x86_64", "linux", "macosx", function (package)
  20. if package:is_plat("linux", "macosx") then
  21. os.cp("../resources/headers/sal.h", package:installdir("include", "directxmath"))
  22. end
  23. import("package.tools.cmake").install(package, {"-DBUILD_TESTING=OFF"})
  24. end)
  25. on_test(function (package)
  26. assert(package:check_cxxsnippets({test = [[
  27. void test() {
  28. DirectX::XMVECTOR v = DirectX::XMVectorSet(1.0f, 2.0f, 3.0f, 4.0f);
  29. DirectX::XMMATRIX m = DirectX::XMMatrixIdentity();
  30. DirectX::XMVECTOR vResult = DirectX::XMVector4Transform(v, m);
  31. }
  32. ]]}, {configs = {languages = "cxx17"}, includes = "DirectXMath.h"}))
  33. end)