Browse Source

Auto-update libcbor to v0.12.0 (#6809)

* Update libcbor to v0.12.0

* fix android cmake

* fix cmake lto

---------

Co-authored-by: star9029 <[email protected]>
ruki 6 months ago
parent
commit
3077e5ea15
1 changed files with 12 additions and 2 deletions
  1. 12 2
      packages/l/libcbor/xmake.lua

+ 12 - 2
packages/l/libcbor/xmake.lua

@@ -4,17 +4,27 @@ package("libcbor")
     set_license("MIT")
 
     add_urls("https://github.com/pjk/libcbor/archive/refs/tags/$(version).tar.gz",
-             "https://github.com/pjk/libcbor.git")
+             "https://github.com/pjk/libcbor.git", {submodules = false})
 
+    add_versions("v0.12.0", "5368add109db559f546d7ed10f440f39a273b073daa8da4abffc83815069fa7f")
     add_versions("v0.11.0", "89e0a83d16993ce50651a7501355453f5250e8729dfc8d4a251a78ea23bb26d7")
 
     add_deps("cmake")
 
     on_install(function (package)
-        local configs = {"-DWITH_EXAMPLES=OFF", "-DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=OFF"}
+        if not package:config("shared") then
+            package:add("defines", "CBOR_STATIC_DEFINE")
+        end
+
+        local configs = {
+            "-DWITH_EXAMPLES=OFF",
+            "-DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=OFF",
+            "-DCMAKE_POLICY_DEFAULT_CMP0057=NEW",
+        }
         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"))
         table.insert(configs, "-DSANITIZE=" .. (package:config("asan") and "ON" or "OFF"))
+        table.insert(configs, "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=" .. (package:config("lto") and "ON" or "OFF"))
         import("package.tools.cmake").install(package, configs)
     end)