2
0

xmake.lua 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package("ctre")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/hanickadot/compile-time-regular-expressions/")
  4. set_description("ctre is a Compile time PCRE (almost) compatible regular expression matcher.")
  5. set_license("Apache-2.0")
  6. set_urls("https://github.com/hanickadot/compile-time-regular-expressions/archive/refs/tags/$(version).zip",
  7. "https://github.com/hanickadot/compile-time-regular-expressions.git")
  8. add_versions("v3.4.1", "099d6503cddd8e086b71247321ac64d91976136aa727d0de3ad5f9fd1897c5c7")
  9. add_versions("v3.5", "335180eaa44d60cec0fec445bafad78509f03c6e8a8bd9d24591d4d38333f78d")
  10. add_versions("v3.6", "f99f9c8bd3154d76305ef4fbde2c6622ed309c5a3401168732048fbc31e93f5d")
  11. add_versions("v3.7.2", "1dbcd96d279b5be27e9c90d2952533db10bc0e5d8ff6224a3c6d538fd94ab18f")
  12. add_versions("v3.8.1", "7c7a936145defe56e886bac7731ea16a52de65d73bda2b56702d0d0a61101c76")
  13. add_versions("v3.9.0", "8d0c061faf6b41c6913cac39af1d8cc8272e693b442c32f4fa762b505490fb36")
  14. add_configs("cmake", {description = "Use cmake build system", default = false, type = "boolean"})
  15. on_load(function (package)
  16. if package:config("cmake") then
  17. package:add("deps", "cmake")
  18. end
  19. end)
  20. on_install(function (package)
  21. if package:config("cmake") then
  22. import("package.tools.cmake").install(package, {"-DCTRE_BUILD_TESTS=OFF"})
  23. else
  24. os.cp("include", package:installdir())
  25. end
  26. end)
  27. on_test(function (package)
  28. assert(package:check_cxxsnippets({test = [[
  29. #include <ctll.hpp>
  30. #include <ctre.hpp>
  31. #include <iostream>
  32. #include <string>
  33. static void test() {
  34. std::string str = "Hello World";
  35. static constexpr auto pattern = ctll::fixed_string{R"(\s+)"};
  36. for (auto e : ctre::split<pattern>(str)) {
  37. std::cout << std::string(e.get<0>()) << std::endl;
  38. }
  39. }
  40. ]]}, {configs = {languages = "c++20"}, includes = "ctre.hpp"}))
  41. end)