cpp-httplib: improve test

photoshop-api
star9029 3 months ago
parent 818fa25a45
commit 6f818a2509
  1. 22
      packages/c/cpp-httplib/xmake.lua

@ -28,6 +28,14 @@ package("cpp-httplib")
add_deps("cmake") add_deps("cmake")
if on_check then
on_check("android", function (package)
local ndk = package:toolchain("ndk")
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)
end
on_load(function (package) on_load(function (package)
if package:config("ssl") then if package:config("ssl") then
package:add("deps", "openssl" .. (package:version():ge("0.15.0") and "3" or "")) package:add("deps", "openssl" .. (package:version():ge("0.15.0") and "3" or ""))
@ -43,15 +51,6 @@ package("cpp-httplib")
end end
end) end)
if on_check then
on_check("android", function (package)
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)
end
on_install(function (package) on_install(function (package)
if package:is_plat("android") then if package:is_plat("android") then
import("core.tool.toolchain") import("core.tool.toolchain")
@ -70,9 +69,8 @@ package("cpp-httplib")
on_test(function (package) on_test(function (package)
assert(package:check_cxxsnippets({test = [[ assert(package:check_cxxsnippets({test = [[
#include <httplib.h> void test() {
static void test() {
httplib::Client cli("http://cpp-httplib-server.yhirose.repl.co"); httplib::Client cli("http://cpp-httplib-server.yhirose.repl.co");
} }
]]}, {includes = "httplib.h",configs = {languages = "c++11"}})) ]]}, {configs = {languages = "c++11"}, includes = "httplib.h"}))
end) end)

Loading…
Cancel
Save