Przeglądaj źródła

Auto-update upa-url to v2.0.0 (#6903)

* Update upa-url to v2.0.0

* Update xmake.lua

---------

Co-authored-by: star9029 <[email protected]>
ruki 5 miesięcy temu
rodzic
commit
98c8586dde
1 zmienionych plików z 22 dodań i 12 usunięć
  1. 22 12
      packages/u/upa-url/xmake.lua

+ 22 - 12
packages/u/upa-url/xmake.lua

@@ -6,20 +6,38 @@ package("upa-url")
     add_urls("https://github.com/upa-url/upa/archive/refs/tags/$(version).tar.gz",
              "https://github.com/upa-url/upa.git", {submodules = false})
 
+    add_versions("v2.0.0", "50e0d7c9cad853c794f9b12aded960dbdcf3ba6baa8bc9896da52fe526cc014e")
     add_versions("v1.2.0", "5d8a251ffd708a14f9faf2ea29dae934cb4b29c5473bd2bcf2e3d16eccaeacb7")
     add_versions("v1.0.2", "d08a724c1868530b1c0b89ebeaaf2d654f7e6489c968a3dc2255b1f21ddc94e0")
     add_versions("v1.0.1", "458d49c1e84063a2e38b40f5dae5ba01e618e7fba29550f9cc01bf10d04ff7a1")
     add_versions("v1.0.0", "9ad14357c177f7c038a447996a065995e074eb5447015467687726c5d221b5f4")
 
     add_configs("tools", {description = "Build tools", default = false, type = "boolean"})
+    add_configs("cmake", {description = "Use cmake build system", default = true, type = "boolean"})
 
-    add_deps("cmake")
+    on_load(function (package)
+        if package:is_plat("windows") and package:config("shared") then
+            package:config_set("cmake", false)
+        end
+        
+        if package:config("cmake") then
+            package:add("deps", "cmake")
+        end
+    end)
 
     on_install(function (package)
-        if package:is_plat("windows") and package:config("shared") then
+        if package:config("cmake") then
+            io.replace("CMakeLists.txt", "STATIC", "", {plain = true})
+    
+            local configs = {"-DURL_BUILD_TESTS=OFF", "-DUPA_BUILD_TESTS=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"))
+            table.insert(configs, "-DUPA_BUILD_TOOLS=" .. (package:config("tools") and "ON" or "OFF"))
+            import("package.tools.cmake").install(package, configs)
+        else
             io.writefile("xmake.lua", [[
                 add_rules("mode.debug", "mode.release")
-                set_languages("c++11")
+                set_languages("c++17")
                 target("upa_url")
                     set_kind("$(kind)")
                     add_files("src/*.cpp")
@@ -30,14 +48,6 @@ package("upa-url")
                     end
             ]])
             import("package.tools.xmake").install(package)
-        else
-            io.replace("CMakeLists.txt", "STATIC", "", {plain = true})
-    
-            local configs = {"-DURL_BUILD_TESTS=OFF", "-DUPA_BUILD_TESTS=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"))
-            table.insert(configs, "-DUPA_BUILD_TOOLS=" .. (package:config("tools") and "ON" or "OFF"))
-            import("package.tools.cmake").install(package, configs)
         end
     end)
 
@@ -46,5 +56,5 @@ package("upa-url")
             void test() {
                 upa::url url{"https://xmake.io/"};
             }
-        ]]}, {configs = {languages = "c++11"}, includes = "upa/url.h"}))
+        ]]}, {configs = {languages = "c++17"}, includes = "upa/url.h"}))
     end)