xmake.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package("range-v3")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/ericniebler/range-v3/")
  4. set_description("Range library for C++14/17/20, basis for C++20's std::ranges")
  5. set_license("BSL-1.0")
  6. add_urls("https://github.com/ericniebler/range-v3/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/ericniebler/range-v3.git")
  8. add_versions("0.11.0", "376376615dbba43d3bef75aa590931431ecb49eb36d07bb726a19f680c75e20c")
  9. add_versions("0.12.0", "015adb2300a98edfceaf0725beec3337f542af4915cec4d0b89fa0886f4ba9cb")
  10. if is_plat("linux") then
  11. add_extsources("apt::librange-v3-dev")
  12. end
  13. add_deps("cmake")
  14. if is_plat("windows") then
  15. add_cxxflags("/permissive-")
  16. end
  17. on_install(function (package)
  18. local configs = {"-DRANGE_V3_DOCS=OFF", "-DRANGE_V3_TESTS=OFF", "-DRANGE_V3_EXAMPLES=OFF", "-DRANGE_V3_PERF=OFF"}
  19. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  20. import("package.tools.cmake").install(package, configs)
  21. end)
  22. on_test(function (package)
  23. assert(package:check_cxxsnippets({test = [[
  24. void test() {
  25. using namespace ranges;
  26. auto triples = views::for_each(views::iota(1), [](int z) {
  27. return views::for_each(views::iota(1, z + 1), [=](int x) {
  28. return views::for_each(views::iota(x, z + 1), [=](int y) {
  29. return yield_if(x * x + y * y == z * z,
  30. std::make_tuple(x, y, z));
  31. });
  32. });
  33. });
  34. }
  35. ]]}, {configs = {languages = "c++17"}, includes = "range/v3/all.hpp"}))
  36. end)