xmake.lua 1.6 KB

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