|
@@ -6,16 +6,34 @@ package("cpu-features")
|
|
add_urls("https://github.com/google/cpu_features/archive/refs/tags/$(version).tar.gz",
|
|
add_urls("https://github.com/google/cpu_features/archive/refs/tags/$(version).tar.gz",
|
|
"https://github.com/google/cpu_features.git")
|
|
"https://github.com/google/cpu_features.git")
|
|
|
|
|
|
|
|
+ add_versions("v0.10.0", "dc1be36d02b178e904aa91cce5c2701fe418d728f1c0a130a4196b66b087471a")
|
|
add_versions("v0.6.0", "95a1cf6f24948031df114798a97eea2a71143bd38a4d07d9a758dda3924c1932")
|
|
add_versions("v0.6.0", "95a1cf6f24948031df114798a97eea2a71143bd38a4d07d9a758dda3924c1932")
|
|
add_versions("v0.7.0", "df80d9439abf741c7d2fdcdfd2d26528b136e6c52976be8bd0cd5e45a27262c0")
|
|
add_versions("v0.7.0", "df80d9439abf741c7d2fdcdfd2d26528b136e6c52976be8bd0cd5e45a27262c0")
|
|
add_versions("v0.9.0", "bdb3484de8297c49b59955c3b22dba834401bc2df984ef5cfc17acbe69c5018e")
|
|
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
|
|
if is_plat("macosx") then
|
|
add_extsources("brew::cpu_features")
|
|
add_extsources("brew::cpu_features")
|
|
end
|
|
end
|
|
|
|
|
|
add_deps("cmake")
|
|
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)
|
|
on_install("!wasm", function (package)
|
|
if package:is_cross() then
|
|
if package:is_cross() then
|
|
local arch
|
|
local arch
|
|
@@ -25,7 +43,7 @@ package("cpu-features")
|
|
end
|
|
end
|
|
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, "-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, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
|
|
table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=" .. (package:config("pic") 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
|
|
if package:config("shared") and package:is_plat("windows") then
|
|
table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
|
|
table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
|
|
end
|
|
end
|
|
|
|
+ table.insert(configs, "-DBUILD_EXECUTABLE=" .. (package:config("tools") and "ON" or "OFF"))
|
|
import("package.tools.cmake").install(package, configs)
|
|
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)
|
|
end)
|
|
|
|
|
|
on_test(function (package)
|
|
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")
|
|
os.vrun("list_cpu_features")
|
|
end
|
|
end
|
|
assert(package:check_csnippets({test = [[
|
|
assert(package:check_csnippets({test = [[
|