xmake.lua 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package("reaction")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/lumia431/reaction")
  4. set_description("A lightweight, header-only reactive programming framework leveraging modern C++20 features for building efficient dataflow applications.")
  5. set_license("MIT")
  6. add_urls("https://github.com/lumia431/reaction.git")
  7. add_versions("2025.04.16", "424f1956f2215b0817fd1b3b4217ee04b0c45e2a")
  8. add_deps("cmake")
  9. on_check(function (package)
  10. if package:is_plat("android") then
  11. local ndk = package:toolchain("ndk"):config("ndkver")
  12. assert(ndk and tonumber(ndk) > 22, "package(reaction) require ndk version > 22")
  13. elseif package:is_plat("macosx") then
  14. assert(package:check_cxxsnippets({test = [[#include <format>
  15. #include <iostream>
  16. template<typename... Args>
  17. inline void println(const std::format_string<Args...> fmt, Args&&... args)
  18. {
  19. std::cout << std::vformat(fmt.get(), std::make_format_args(args...)) << '\n';
  20. }
  21. void test() {
  22. println("{}{} {}{}", "Hello", ',', "C++", -1 + 2 * 3 * 4);
  23. }
  24. ]]}, {configs = {languages = "c++20"}}))
  25. end
  26. end)
  27. on_install(function (package)
  28. io.replace("CMakeLists.txt", "if(GTest_FOUND)", "if(0)", {plain = true})
  29. os.tryrm("example")
  30. local configs = {}
  31. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  32. import("package.tools.cmake").install(package, configs)
  33. end)
  34. on_test(function (package)
  35. assert(package:check_cxxsnippets({test = [[
  36. #include <algorithm>
  37. #include <reaction/reaction.h>
  38. void test() {
  39. auto buyPrice = reaction::var(100.0);
  40. }
  41. ]]}, {configs = {languages = "c++20"}}))
  42. end)