xmake.lua 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package("continuable")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://naios.github.io/continuable/")
  4. set_description("C++14 asynchronous allocation aware futures (supporting then, exception handling, coroutines and connections)")
  5. set_license("MIT")
  6. add_urls("https://github.com/Naios/continuable/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/Naios/continuable.git", {submodules = false})
  8. add_versions("4.2.2", "49bf82a349b26c01194631e4fe5d1dbad080b3b4a347eebc5cf95326ea130fba")
  9. if is_plat("linux", "bsd") then
  10. add_syslinks("pthread")
  11. end
  12. add_deps("cmake")
  13. add_deps("function2")
  14. on_install(function (package)
  15. local configs =
  16. {
  17. "-DCTI_CONTINUABLE_WITH_INSTALL=ON",
  18. "-DCTI_CONTINUABLE_WITH_TESTS=OFF",
  19. "-DCTI_CONTINUABLE_WITH_EXAMPLES=OFF"
  20. }
  21. io.replace("CMakeLists.txt", "add_subdirectory(dep)", "", {plain = true})
  22. import("package.tools.cmake").install(package, configs)
  23. end)
  24. on_test(function (package)
  25. assert(package:check_cxxsnippets({test = [[
  26. #include <string>
  27. #include <continuable/continuable.hpp>
  28. cti::continuable<std::string> http_request(std::string /*url*/) {
  29. return cti::make_ready_continuable<std::string>("<html>...</html>");
  30. }
  31. void test() {
  32. http_request("github.com") && http_request("atom.io");
  33. }
  34. ]]}, {configs = {languages = "c++14"}}))
  35. end)