add trantor (#358)
* add trantor * update openssl * fix openssl * add version check for opensslpull/359/head
parent
7d650ebf29
commit
3fe2cf293d
4 changed files with 75 additions and 4 deletions
@ -0,0 +1,41 @@ |
||||
package("trantor") |
||||
|
||||
set_homepage("https://github.com/an-tao/trantor/") |
||||
set_description("a non-blocking I/O tcp network lib based on c++14/17") |
||||
set_license("BSD-3-Clause") |
||||
|
||||
add_urls("https://github.com/an-tao/trantor/archive/refs/tags/$(version).tar.gz", |
||||
"https://github.com/an-tao/trantor.git") |
||||
add_versions("v1.3.0", "524589dc9258e1ace3b2f887b835cfbeccab3c5efc4ba94963c59f3528248d9b") |
||||
|
||||
add_deps("cmake") |
||||
add_deps("openssl", "c-ares", {optional = true}) |
||||
if is_plat("windows") or is_plat("mingw") then |
||||
add_syslinks("ws2_32") |
||||
elseif is_plat("linux") then |
||||
add_syslinks("pthread") |
||||
end |
||||
on_install("windows", "macosx", "linux", "mingw@windows", function (package) |
||||
local configs = {} |
||||
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) |
||||
if package:config("pic") ~= false then |
||||
table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON") |
||||
end |
||||
import("package.tools.cmake").install(package, configs) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:check_cxxsnippets({test = [[ |
||||
#include <thread> |
||||
#include <chrono> |
||||
using namespace std::chrono_literals; |
||||
void test() { |
||||
trantor::SerialTaskQueue queue(""); |
||||
queue.runTaskInQueue([&]() { |
||||
for (int i = 0; i < 5; ++i) |
||||
std::this_thread::sleep_for(0.1s); |
||||
}); |
||||
queue.waitAllTasksFinished(); |
||||
} |
||||
]]}, {configs = {languages = "c++17"}, includes = "trantor/utils/SerialTaskQueue.h"})) |
||||
end) |
Loading…
Reference in new issue