[cpu-features] Bump to 0.8.0 (#33404)

* [cpu-features] Bump to 0.8.0

* Update version database

* Fix arm64-windows

* Update version database

* Fix android usage

* Update version database
This commit is contained in:
Weihang Ding 2023-08-30 02:21:10 +08:00 committed by GitHub
parent 0df74b7e63
commit 4861ec79f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 50 additions and 43 deletions

View File

@ -1,17 +1,18 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3e382a4..63ef346 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -60,13 +60,13 @@
@@ -57,11 +57,11 @@ set(PROCESSOR_IS_RISCV FALSE)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
set(PROCESSOR_IS_MIPS TRUE)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64)")
-elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64)")
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64|ARM64)")
set(PROCESSOR_IS_AARCH64 TRUE)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
set(PROCESSOR_IS_ARM TRUE)
-elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)|(AMD64|amd64)|(^i.86$)")
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(AMD64|amd64)|(^i.86$)")
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(x86_64)|(AMD64|amd64)|(^i.86$)")
set(PROCESSOR_IS_X86 TRUE)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")
set(PROCESSOR_IS_POWER TRUE)
endif()
macro(add_cpu_features_headers_and_sources HDRS_LIST_NAME SRCS_LIST_NAME)

View File

@ -1,47 +1,30 @@
From 68ece3bba0d79ab721a0c50ee1e6014a37f759dc Mon Sep 17 00:00:00 2001
From: Wei Dai <wei.dai@microsoft.com>
Date: Mon, 24 May 2021 10:02:07 -0700
Subject: [PATCH] Added an option to disable the executable target
list_cpu_feature.
---
CMakeLists.txt | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f9daeac..48eea0e 100644
index bcc9bb0..3e382a4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,6 +17,8 @@ if(NOT CMAKE_BUILD_TYPE)
@@ -17,6 +17,9 @@ if(NOT CMAKE_BUILD_TYPE)
FORCE)
endif(NOT CMAKE_BUILD_TYPE)
+# An option to disable the executable target list_cpu_features.
+option(BUILD_EXECUTABLE "Build list_cpu_features executable." ON)
+
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make
# it prominent in the GUI.
# cpu_features uses bit-fields which are - to some extends - implementation-defined (see https://en.cppreference.com/w/c/language/bit_field).
@@ -157,9 +159,11 @@ add_library(CpuFeature::cpu_features ALIAS cpu_features)
@@ -158,9 +161,11 @@ add_library(CpuFeature::cpu_features ALIAS cpu_features)
# program : list_cpu_features
#
-add_executable(list_cpu_features ${PROJECT_SOURCE_DIR}/src/utils/list_cpu_features.c)
-target_link_libraries(list_cpu_features PRIVATE cpu_features)
-add_executable(CpuFeature::list_cpu_features ALIAS list_cpu_features)
+if(BUILD_EXECUTABLE)
+ add_executable(list_cpu_features ${PROJECT_SOURCE_DIR}/src/utils/list_cpu_features.c)
+ target_link_libraries(list_cpu_features PRIVATE cpu_features)
+ add_executable(CpuFeature::list_cpu_features ALIAS list_cpu_features)
add_executable(list_cpu_features ${PROJECT_SOURCE_DIR}/src/utils/list_cpu_features.c)
target_link_libraries(list_cpu_features PRIVATE cpu_features)
add_executable(CpuFeature::list_cpu_features ALIAS list_cpu_features)
+endif()
#
# ndk_compat
@@ -223,18 +227,28 @@ if(BUILD_TESTING)
endif()
#
-# Install cpu_features and list_cpu_features
+# Install cpu_features and optionally list_cpu_features
@@ -228,7 +233,7 @@ endif()
#
include(GNUInstallDirs)
@ -50,7 +33,7 @@ index f9daeac..48eea0e 100644
EXPORT CpuFeaturesTargets
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cpu_features
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
@@ -236,6 +241,16 @@ install(TARGETS cpu_features list_cpu_features
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
)
@ -67,6 +50,3 @@ index f9daeac..48eea0e 100644
install(EXPORT CpuFeaturesTargets
NAMESPACE CpuFeatures::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/CpuFeatures
--
2.25.1

View File

@ -3,12 +3,12 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO google/cpu_features
REF v0.7.0
SHA512 e602c88c4a104d69dff0297a4c4f8e26d02d548fc35ce2616429ff8280f2a37e9eaa99451a38b7c302907352cf15bdf8c09c2e0e52b09bf4cd3b7e2b21f8ddb0
REF "v${VERSION}"
SHA512 43085d11f58f314d696276c8543561d411a4156aa546d1e14ed3d8adffded5818f1ad4259b3ad38bb5d4167bd9084f78c725eb53509999a2349a749b9eb47007
HEAD_REF master
PATCHES
make_list_cpu_features_optional.patch
windows-x86-fix.patch
fix-windows.patch
)
# If feature "tools" is not specified, disable building/exporting executable targets.
@ -27,7 +27,12 @@ vcpkg_cmake_configure(
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(PACKAGE_NAME "CpuFeatures" CONFIG_PATH "lib/cmake/CpuFeatures")
if(VCPKG_TARGET_IS_ANDROID)
vcpkg_cmake_config_fixup(PACKAGE_NAME "CpuFeatures" CONFIG_PATH "lib/cmake/CpuFeatures" DO_NOT_DELETE_PARENT_CONFIG_PATH)
vcpkg_cmake_config_fixup(PACKAGE_NAME "CpuFeaturesNdkCompat" CONFIG_PATH "lib/cmake/CpuFeaturesNdkCompat")
else()
vcpkg_cmake_config_fixup(PACKAGE_NAME "CpuFeatures" CONFIG_PATH "lib/cmake/CpuFeatures")
endif()
if("tools" IN_LIST FEATURES)
vcpkg_copy_tools(TOOL_NAMES "list_cpu_features" AUTO_CLEAN)
@ -35,4 +40,9 @@ endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
if(VCPKG_TARGET_IS_ANDROID)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage_android" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME "usage")
else()
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
endif()

4
ports/cpu-features/usage Normal file
View File

@ -0,0 +1,4 @@
cpu-features provides CMake targets:
find_package(CpuFeatures CONFIG REQUIRED)
target_link_libraries(main PRIVATE CpuFeatures::cpu_features)

View File

@ -0,0 +1,7 @@
cpu-features provides CMake targets:
find_package(CpuFeatures CONFIG REQUIRED)
target_link_libraries(main PRIVATE CpuFeatures::cpu_features)
find_package(CpuFeaturesNdkCompat CONFIG REQUIRED)
target_link_libraries(main PRIVATE CpuFeatures::ndk_compat)

View File

@ -1,10 +1,10 @@
{
"name": "cpu-features",
"version": "0.7.0",
"version": "0.8.0",
"description": "A cross-platform C library to retrieve CPU features (such as available instructions) at runtime",
"homepage": "https://github.com/google/cpu_features",
"license": "Apache-2.0",
"supports": "!(arm | uwp)",
"supports": "!uwp",
"dependencies": [
{
"name": "vcpkg-cmake",

View File

@ -1881,7 +1881,7 @@
"port-version": 0
},
"cpu-features": {
"baseline": "0.7.0",
"baseline": "0.8.0",
"port-version": 0
},
"cpuid": {

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "b7b519ccb7eebe02086e062e34a6d3d6b0f54cde",
"version": "0.8.0",
"port-version": 0
},
{
"git-tree": "389a30511ba8ab8c2891ee40ad9cc6ae89561739",
"version": "0.7.0",