From 0d384960d2e3a0b64aa8a25792f4332fa2742c5c Mon Sep 17 00:00:00 2001 From: star9029 Date: Sat, 11 Nov 2023 00:16:52 +0800 Subject: [PATCH] continuable: add package (#2817) --- packages/c/continuable/xmake.lua | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 packages/c/continuable/xmake.lua diff --git a/packages/c/continuable/xmake.lua b/packages/c/continuable/xmake.lua new file mode 100644 index 000000000..ab73d9b16 --- /dev/null +++ b/packages/c/continuable/xmake.lua @@ -0,0 +1,41 @@ +package("continuable") + set_kind("library", {headeronly = true}) + set_homepage("https://naios.github.io/continuable/") + set_description("C++14 asynchronous allocation aware futures (supporting then, exception handling, coroutines and connections)") + set_license("MIT") + + add_urls("https://github.com/Naios/continuable/archive/refs/tags/$(version).tar.gz", + "https://github.com/Naios/continuable.git", {submodules = false}) + + add_versions("4.2.2", "49bf82a349b26c01194631e4fe5d1dbad080b3b4a347eebc5cf95326ea130fba") + + if is_plat("linux", "bsd") then + add_syslinks("pthread") + end + + add_deps("cmake") + add_deps("function2") + + on_install(function (package) + local configs = + { + "-DCTI_CONTINUABLE_WITH_INSTALL=ON", + "-DCTI_CONTINUABLE_WITH_TESTS=OFF", + "-DCTI_CONTINUABLE_WITH_EXAMPLES=OFF" + } + io.replace("CMakeLists.txt", "add_subdirectory(dep)", "", {plain = true}) + import("package.tools.cmake").install(package, configs) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + #include + #include + cti::continuable http_request(std::string /*url*/) { + return cti::make_ready_continuable("..."); + } + void test() { + http_request("github.com") && http_request("atom.io"); + } + ]]}, {configs = {languages = "c++14"}})) + end)