Procházet zdrojové kódy

Auto-update cpu-features to v0.10.0 (#7096)

* Update cpu-features to v0.10.0

* remove list_cpu_features for windows arm64

* fix: correct condition for running list_cpu_features on Windows arm64

* fix: update cpu-features package configuration and installation logic

* fix: adjust architecture checks for ARM in installation script

* fix: update installation logic for ARM architecture on Windows

* fix linux cross-compilation to windows

* limit windows arm64

---------

Co-authored-by: star9029 <[email protected]>
ruki před 3 měsíci
rodič
revize
dae527f71b
1 změnil soubory, kde provedl 21 přidání a 8 odebrání
  1. 21 8
      packages/c/cpu-features/xmake.lua

+ 21 - 8
packages/c/cpu-features/xmake.lua

@@ -6,16 +6,34 @@ package("cpu-features")
     add_urls("https://github.com/google/cpu_features/archive/refs/tags/$(version).tar.gz",
              "https://github.com/google/cpu_features.git")
 
+    add_versions("v0.10.0", "dc1be36d02b178e904aa91cce5c2701fe418d728f1c0a130a4196b66b087471a")
     add_versions("v0.6.0", "95a1cf6f24948031df114798a97eea2a71143bd38a4d07d9a758dda3924c1932")
     add_versions("v0.7.0", "df80d9439abf741c7d2fdcdfd2d26528b136e6c52976be8bd0cd5e45a27262c0")
     add_versions("v0.9.0", "bdb3484de8297c49b59955c3b22dba834401bc2df984ef5cfc17acbe69c5018e")
 
+    add_configs("tools", {description = "Build tools", default = true, type = "boolean"})
+    if not is_host("windows") and is_plat("windows") then
+        add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
+    end
+
     if is_plat("macosx") then
         add_extsources("brew::cpu_features")
     end
 
     add_deps("cmake")
 
+    on_check("windows|arm64", function (package)
+        if not package:is_cross() then
+            raise("package(cpu-features) unsupported windows arm64 native build")
+        end
+    end)
+
+    on_load(function (package)
+        if package:config("tools") then
+            package:addenv("PATH", "bin")
+        end
+    end)
+
     on_install("!wasm", function (package)
         if package:is_cross() then
             local arch
@@ -25,7 +43,7 @@ package("cpu-features")
             end
         end
 
-        local configs = {"-DBUILD_TESTING=OFF", "-DENABLE_INSTALL=ON", "-DBUILD_EXECUTABLE=ON"}
+        local configs = {"-DBUILD_TESTING=OFF", "-DENABLE_INSTALL=ON"}
         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, "-DCMAKE_POSITION_INDEPENDENT_CODE=" .. (package:config("pic") and "ON" or "OFF"))
@@ -36,17 +54,12 @@ package("cpu-features")
         if package:config("shared") and package:is_plat("windows") then
             table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
         end
+        table.insert(configs, "-DBUILD_EXECUTABLE=" .. (package:config("tools") and "ON" or "OFF"))
         import("package.tools.cmake").install(package, configs)
-        package:addenv("PATH", "bin")
-
-        if package:is_plat("windows") and package:is_debug() then
-            local dir = package:installdir(package:config("shared") and "bin" or "lib")
-            os.vcp(path.join(package:buildir(), "*.pdb"), dir)
-        end
     end)
 
     on_test(function (package)
-        if not package:is_cross() then
+        if not package:is_cross() and package:config("tools") then
             os.vrun("list_cpu_features")
         end
         assert(package:check_csnippets({test = [[