2
0

xmake.lua 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package("reactiveplusplus")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://victimsnino.github.io/ReactivePlusPlus/v2/docs/html/md_docs_2readme.html")
  4. set_description("Implementation of async observable/observer (Reactive Programming) in C++ with care about performance and templates in mind in ReactiveX approach")
  5. set_license("BSL-1.0")
  6. add_urls("https://github.com/victimsnino/ReactivePlusPlus/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/victimsnino/ReactivePlusPlus.git")
  8. add_versions("v2.2.2", "54b2bf457996bd3d22e3b33fb98a8d0a3867dfa2d5e23991718dcd94ba6e4157")
  9. add_versions("v2.1.1", "0b962478d7c973a1f74062ce7f8d24c2fdcd2733031b1f014e65d252d59ebe6a")
  10. add_versions("v2.1.0", "d84a194ef96b92201ea574f81780837c95e8956bbad09b3dc2dc5cef7c2eef98")
  11. add_versions("v0.2.3", "9542419f8d7da98126ba2c6ae08fab287b4b3798d89cf75ed9bed2a9e3ec1678")
  12. add_deps("cmake")
  13. add_includedirs("include/rpp")
  14. if on_check then
  15. on_check(function (package)
  16. if package:is_plat("android") then
  17. local ndk = package:toolchain("ndk")
  18. local ndkver = ndk:config("ndkver")
  19. assert(ndkver and tonumber(ndkver) > 22, "package(reactiveplusplus) require ndk version > 22")
  20. end
  21. if package:version() and package:version():ge("2.1.0") then
  22. local msvc = package:toolchain("msvc")
  23. if msvc then
  24. local vs_toolset = msvc:config("vs_toolset")
  25. if vs_toolset then
  26. local vs_toolset_ver = import("core.base.semver").new(vs_toolset)
  27. local minor = vs_toolset_ver:minor()
  28. assert(minor and minor >= 30, "package(reactiveplusplus >=2.2.0) require vs_toolset >= 14.3")
  29. end
  30. end
  31. if package:is_plat("android") then
  32. raise("package(reactiveplusplus >=2.2.0) unsupported current platform")
  33. end
  34. end
  35. end)
  36. end
  37. on_install(function (package)
  38. import("package.tools.cmake").install(package, configs)
  39. end)
  40. on_test(function (package)
  41. local snippets
  42. if package:version() and package:version():le("0.2.3") then
  43. snippets = [[
  44. void test() {
  45. rpp::source::just(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
  46. .filter([](int v) { return v % 2 == 0; })
  47. .subscribe([](int v) {});
  48. }
  49. ]]
  50. else
  51. snippets = [[
  52. void test() {
  53. rpp::source::just(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
  54. | rpp::operators::filter([](int v) { return v % 2 == 0; })
  55. | rpp::operators::subscribe([](int v) {});
  56. }
  57. ]]
  58. end
  59. assert(package:check_cxxsnippets({test = snippets}, {includes = "rpp/rpp.hpp", configs = {languages = "c++20"}}))
  60. end)