improve httplib (#344)
* add pybind11 * add pybind11 * add pybind11 * add nng * update for add nng * update for add nng * update for add nng * update for add nng, remove MingW * update protobuf-cpp * update for protobuf-cpp * add libhv * update for libhv * nng add new version 1.4.0 * add nngpp * update nngpp * add nngpp version * add httplib * add android job ci for api 29 * improve httplib Co-authored-by: fasiondog <fasiondog@163.com>pull/346/head
parent
3d5ead0bf6
commit
61de8a2f0d
3 changed files with 54 additions and 1 deletions
@ -0,0 +1,50 @@ |
||||
package("cpp-httplib") |
||||
|
||||
set_homepage("https://github.com/yhirose/cpp-httplib") |
||||
set_description("A C++11 single-file header-only cross platform HTTP/HTTPS library.") |
||||
|
||||
set_urls("https://github.com/yhirose/cpp-httplib/archive/v$(version).zip", |
||||
"https://github.com/yhirose/cpp-httplib.git") |
||||
add_versions("0.8.5", "57d2a7e67ae6944292cd08cb16083463a93c7c139f6698560e872ade63b9b463") |
||||
|
||||
add_configs("ssl", { description = "Requires OpenSSL", default = false, type = "boolean"}) |
||||
add_configs("zlib", { description = "Requires Zlib", default = false, type = "boolean"}) |
||||
add_configs("brotli", { description = "Requires Brotli", default = false, type = "boolean"}) |
||||
|
||||
add_deps("cmake") |
||||
|
||||
on_load(function (package) |
||||
if package:config("ssl") then |
||||
package:add("deps", "openssl") |
||||
end |
||||
if package:config("zlib") then |
||||
package:add("deps", "zlib") |
||||
end |
||||
if package:config("brotli") then |
||||
package:add("deps", "brotli") |
||||
end |
||||
end) |
||||
|
||||
on_install(function (package) |
||||
if package:is_plat("android") then |
||||
import("core.tool.toolchain") |
||||
local ndk = toolchain.load("ndk", {plat = package:plat(), arch = package:arch()}) |
||||
local ndk_sdkver = ndk:config("ndk_sdkver") |
||||
assert(ndk_sdkver and tonumber(ndk_sdkver) >= 24, "package(httplib): need ndk api level >= 24 for android") |
||||
end |
||||
local configs = {} |
||||
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) |
||||
table.insert(configs, "-DHTTPLIB_REQUIRE_OPENSSL=" .. (package:config("ssl") and "ON" or "OFF")) |
||||
table.insert(configs, "-DHTTPLIB_REQUIRE_ZLIB=" .. (package:config("zlib") and "ON" or "OFF")) |
||||
table.insert(configs, "-DHTTPLIB_REQUIRE_BROTLI=" .. (package:config("brotli") and "ON" or "OFF")) |
||||
import("package.tools.cmake").install(package, configs) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:check_cxxsnippets({test = [[ |
||||
#include <httplib.h> |
||||
static void test() { |
||||
httplib::Client cli("http://cpp-httplib-server.yhirose.repl.co"); |
||||
} |
||||
]]}, {includes = "httplib.h",configs = {languages = "c++11"}})) |
||||
end) |
Loading…
Reference in new issue