diff --git a/packages/c/cpp-httplib/xmake.lua b/packages/c/cpp-httplib/xmake.lua index 4cb8e264d..c6149dae3 100644 --- a/packages/c/cpp-httplib/xmake.lua +++ b/packages/c/cpp-httplib/xmake.lua @@ -28,6 +28,14 @@ package("cpp-httplib") 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) if package:config("ssl") then package:add("deps", "openssl" .. (package:version():ge("0.15.0") and "3" or "")) @@ -43,15 +51,6 @@ package("cpp-httplib") 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) if package:is_plat("android") then import("core.tool.toolchain") @@ -70,9 +69,8 @@ package("cpp-httplib") on_test(function (package) assert(package:check_cxxsnippets({test = [[ - #include - static void test() { + void test() { 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)