Browse Source

cpp-jwt: fix filter syntax (#7200)

* cpp-jwt: fix filter syntax

* use cmake
star9029 2 months ago
parent
commit
b43e9fc64e
1 changed files with 9 additions and 3 deletions
  1. 9 3
      packages/c/cpp-jwt/xmake.lua

+ 9 - 3
packages/c/cpp-jwt/xmake.lua

@@ -7,12 +7,18 @@ package("cpp-jwt")
     add_urls("https://github.com/arun11299/cpp-jwt/archive/refs/tags/$(version).tar.gz",
     add_urls("https://github.com/arun11299/cpp-jwt/archive/refs/tags/$(version).tar.gz",
              "https://github.com/arun11299/cpp-jwt.git")
              "https://github.com/arun11299/cpp-jwt.git")
 
 
+    add_versions("v1.5", "44a59d619b0a82cae6334bb7d430d27b7fc7595e872c9f20d46aa96d2301edb2")
     add_versions("v1.4", "1cb8039ee15bf9bf735c26082d7ff50c23d2886d65015dd6b0668c65e17dd20f")
     add_versions("v1.4", "1cb8039ee15bf9bf735c26082d7ff50c23d2886d65015dd6b0668c65e17dd20f")
 
 
-    add_deps("nlohmann_json", "openssl3")
+    add_deps("cmake")
+    add_deps("openssl3")
+    add_deps("nlohmann_json", {configs = {cmake = true}})
 
 
-    on_install("!wasm@macosx and !iphoneos@macosx and !android",function (package)
-        os.cp("include/jwt", package:installdir("include"))
+    on_install(function (package)
+        local configs = {"-DCPP_JWT_BUILD_EXAMPLES=OFF", "-DCPP_JWT_BUILD_TESTS=OFF", "-DCPP_JWT_USE_VENDORED_NLOHMANN_JSON=OFF"}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
+        table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
+        import("package.tools.cmake").install(package, configs)
     end)
     end)
 
 
     on_test(function (package)
     on_test(function (package)