xmake.lua 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package("span-lite")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/martinmoene/span-lite")
  4. set_description("span lite - A C++20-like span for C++98, C++11 and later in a single-file header-only library")
  5. set_license("BSL")
  6. add_urls("https://github.com/martinmoene/span-lite/archive/refs/tags/v$(version).zip",
  7. "https://github.com/martinmoene/span-lite.git")
  8. add_versions("0.11.0", "315a321ddc586e78e5fc345661c3259e237c8c8968087c1aa36c4407343d7ddb")
  9. add_versions("0.10.3", "e9d4facd0c98b12b045de356c6c6c0c06d047d741fe61bde02ca9a68c82d7658")
  10. add_deps("cmake")
  11. on_install(function (package)
  12. local configs = {
  13. "-DSPAN_LITE_OPT_BUILD_TESTS=OFF",
  14. "-SPAN_LITE_EXPORT_PACKAGE=ON"
  15. }
  16. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  17. import("package.tools.cmake").install(package, configs)
  18. end)
  19. on_test(function (package)
  20. assert(package:check_cxxsnippets({test = [[
  21. #include <iostream>
  22. using nonstd::span_lite::span;
  23. void good( span<int> arr ) {
  24. for ( size_t i = 0; i != arr.size(); ++i )
  25. {
  26. std::cout << (i==0 ? "[":"") << arr[i] << (i!=arr.size()-1 ? ", ":"]\n");
  27. }
  28. }
  29. ]]}, {configs = {languages = "c++17"}, includes = "nonstd/span.hpp"}))
  30. end)