diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index b30e36e94..750a27fe2 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -7,8 +7,10 @@ on: jobs: build: strategy: + fail-fast: false matrix: os: [ubuntu-latest] + ndk_sdkver: ["29", "21"] runs-on: ${{ matrix.os }} @@ -25,5 +27,5 @@ jobs: - name: Tests run: | - xmake l ./scripts/test.lua -D -p android --ndk=`pwd`/android-ndk-r21 + xmake l ./scripts/test.lua -D -p android --ndk=`pwd`/android-ndk-r21 --ndk_sdkver=${{ matrix.ndk_sdkver }} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 533bc49fd..88f9bc415 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -7,6 +7,7 @@ on: jobs: build: strategy: + fail-fast: false matrix: os: [windows-latest] kind: [static, shared] diff --git a/packages/c/cpp-httplib/xmake.lua b/packages/c/cpp-httplib/xmake.lua new file mode 100644 index 000000000..6878dc203 --- /dev/null +++ b/packages/c/cpp-httplib/xmake.lua @@ -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 + static void test() { + httplib::Client cli("http://cpp-httplib-server.yhirose.repl.co"); + } + ]]}, {includes = "httplib.h",configs = {languages = "c++11"}})) + end)