Bläddra i källkod

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 <[email protected]>
ruki 4 år sedan
förälder
incheckning
61de8a2f0d
3 ändrade filer med 54 tillägg och 1 borttagningar
  1. 3 1
      .github/workflows/android.yml
  2. 1 0
      .github/workflows/windows.yml
  3. 50 0
      packages/c/cpp-httplib/xmake.lua

+ 3 - 1
.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 }}
 

+ 1 - 0
.github/workflows/windows.yml

@@ -7,6 +7,7 @@ on:
 jobs:
   build:
     strategy:
+      fail-fast: false
       matrix:
         os: [windows-latest]
         kind: [static, shared]

+ 50 - 0
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 <httplib.h>
+            static void test() {
+                httplib::Client cli("http://cpp-httplib-server.yhirose.repl.co");
+            }
+        ]]}, {includes = "httplib.h",configs = {languages = "c++11"}}))
+    end)