xmake.lua 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  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.10.3", "e9d4facd0c98b12b045de356c6c6c0c06d047d741fe61bde02ca9a68c82d7658")
  9. add_deps("cmake")
  10. on_install(function (package)
  11. local configs = {
  12. "-DSPAN_LITE_OPT_BUILD_TESTS=OFF",
  13. "-SPAN_LITE_EXPORT_PACKAGE=ON"
  14. }
  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. #include <iostream>
  21. using nonstd::span_lite::span;
  22. void good( span<int> arr ) {
  23. for ( size_t i = 0; i != arr.size(); ++i )
  24. {
  25. std::cout << (i==0 ? "[":"") << arr[i] << (i!=arr.size()-1 ? ", ":"]\n");
  26. }
  27. }
  28. ]]}, {configs = {languages = "c++17"}, includes = "nonstd/span.hpp"}))
  29. end)