xmake.lua 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package("gfx-timsort")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/timsort/cpp-TimSort")
  4. set_description("A C++ implementation of timsort")
  5. set_license("MIT")
  6. add_urls("https://github.com/timsort/cpp-TimSort/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/timsort/cpp-TimSort.git")
  8. add_versions("v3.0.0", "d61b92850996305e5248d1621c8ac437c31b474f74907e223019739e2e556b1f")
  9. add_deps("cmake")
  10. if on_check then
  11. on_check(function (package)
  12. if package:is_plat("android") then
  13. local ndk = package:toolchain("ndk"):config("ndkver")
  14. assert(ndk and tonumber(ndk) > 22, "package(gfx-timsort) requires ndk version > 22")
  15. end
  16. assert(package:check_cxxsnippets({test = [[
  17. #include <vector>
  18. #include <algorithm>
  19. void test() {
  20. std::vector<int> data;
  21. auto lower = std::ranges::lower_bound(data, 0);
  22. }
  23. ]]}, {configs = {languages = "c++20"}}), "package(gfx-timsort) Require at least C++20.")
  24. end)
  25. end
  26. on_install(function (package)
  27. local configs = {"-DBUILD_TESTING=OFF"}
  28. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  29. import("package.tools.cmake").install(package, configs)
  30. end)
  31. on_test(function (package)
  32. assert(package:check_cxxsnippets({test = [[
  33. #include <string>
  34. #include <vector>
  35. #include <gfx/timsort.hpp>
  36. size_t len(const std::string& str) {
  37. return str.size();
  38. }
  39. void test() {
  40. std::vector<std::string> collection;
  41. gfx::timsort(collection, {}, &len);
  42. }
  43. ]]}, {configs = {languages = "c++20"}}))
  44. end)