diff options
| author | Wei Dai <wei.dai@microsoft.com> | 2021-06-01 12:17:00 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-01 12:17:00 -0700 |
| commit | b2dd1261bfcff3f837d8d1283270addbfd62eeaa (patch) | |
| tree | 08eeb93af01a59a88a5f0abc3d4dfee61a933acf | |
| parent | e4e4ee9c9fff0a982a15afccc080a153a33803f2 (diff) | |
| download | vcpkg-b2dd1261bfcff3f837d8d1283270addbfd62eeaa.tar.gz vcpkg-b2dd1261bfcff3f837d8d1283270addbfd62eeaa.zip | |
[cpu-features] Fixed and updated cpu-features. (#18101)
* Fixed and updated cpu-features.
* Update ports/cpu-features/portfile.cmake
Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
* Updated versioning.
Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
| -rw-r--r-- | ports/cpu-features/make_list_cpu_features_optional.patch | 70 | ||||
| -rw-r--r-- | ports/cpu-features/portfile.cmake | 27 | ||||
| -rw-r--r-- | ports/cpu-features/vcpkg.json | 12 | ||||
| -rw-r--r-- | versions/baseline.json | 2 | ||||
| -rw-r--r-- | versions/c-/cpu-features.json | 5 |
5 files changed, 104 insertions, 12 deletions
diff --git a/ports/cpu-features/make_list_cpu_features_optional.patch b/ports/cpu-features/make_list_cpu_features_optional.patch new file mode 100644 index 000000000..bceeb6f64 --- /dev/null +++ b/ports/cpu-features/make_list_cpu_features_optional.patch @@ -0,0 +1,70 @@ +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 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -17,6 +17,8 @@ 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_TESTING is a standard CMake variable, but we declare it here to make it + # prominent in the GUI. + option(BUILD_TESTING "Enable test (depends on googletest)." OFF) +@@ -157,9 +159,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) ++endif() + + # + # ndk_compat +@@ -223,17 +227,26 @@ if(BUILD_TESTING) + endif() + + # +-# Install cpu_features and list_cpu_features ++# Install cpu_features and optionally list_cpu_features + # + + include(GNUInstallDirs) +-install(TARGETS cpu_features list_cpu_features ++install(TARGETS cpu_features + EXPORT CpuFeaturesTargets + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cpu_features + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) ++if(BUILD_EXECUTABLE) ++ install(TARGETS list_cpu_features ++ EXPORT CpuFeaturesTargets ++ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cpu_features ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ ) ++endif() + install(EXPORT CpuFeaturesTargets + NAMESPACE CpuFeatures:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/CpuFeatures +-- +2.25.1 + diff --git a/ports/cpu-features/portfile.cmake b/ports/cpu-features/portfile.cmake index e50d5ef14..0e7602fdc 100644 --- a/ports/cpu-features/portfile.cmake +++ b/ports/cpu-features/portfile.cmake @@ -5,26 +5,33 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO google/cpu_features
- REF b9593c8b395318bb2bc42683a94f962564cc4664 # 0.4.1
- SHA512 8c12b50741e2979a32b69c788934bee0d00811b7662006c8b493e98d5efeada67ed59460be40c234b2d3bafd85671cb1a1d7c1a6ee535a7fc1cc6ac56a754576
+ REF a8397ba4591237c17d18e4acc091f5f3ebe7391e # 0.6.0
+ SHA512 71a583e8190699d6df3dfa2857886089265cdfbcb916d9828a3611a1d6d23487464d6448b900b49637f015dd7d4e18bb206e0249af0932928f8ced13a081d42b
HEAD_REF master
+ PATCHES make_list_cpu_features_optional.patch
)
-vcpkg_configure_cmake(
+# If feature "tools" is not specified, disable building/exporting executable targets.
+# This is necessary so that downstream find_package(CpuFeatures) does not fail.
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ tools BUILD_EXECUTABLE
+)
+
+vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
- PREFER_NINJA
OPTIONS
+ ${FEATURE_OPTIONS}
)
-vcpkg_install_cmake()
+vcpkg_cmake_install()
-vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/CpuFeatures TARGET_PATH share/CpuFeatures)
+vcpkg_cmake_config_fixup(PACKAGE_NAME "CpuFeatures" CONFIG_PATH "lib/cmake/CpuFeatures")
if("tools" IN_LIST FEATURES)
- vcpkg_copy_tools(TOOL_NAMES list_cpu_features)
+ vcpkg_copy_tools(TOOL_NAMES "list_cpu_features" AUTO_CLEAN)
endif()
-vcpkg_clean_executables_in_bin(FILE_NAMES list_cpu_features)
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
-file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
+file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
diff --git a/ports/cpu-features/vcpkg.json b/ports/cpu-features/vcpkg.json index 20974bc65..8980a30b5 100644 --- a/ports/cpu-features/vcpkg.json +++ b/ports/cpu-features/vcpkg.json @@ -1,10 +1,20 @@ { "name": "cpu-features", - "version-string": "0.4.1", + "version": "0.6.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)", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], "features": { "tools": { "description": "list_cpu_features command line tool" diff --git a/versions/baseline.json b/versions/baseline.json index 1e2d2de49..75f980555 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -1461,7 +1461,7 @@ "port-version": 0 }, "cpu-features": { - "baseline": "0.4.1", + "baseline": "0.6.0", "port-version": 0 }, "cpuid": { diff --git a/versions/c-/cpu-features.json b/versions/c-/cpu-features.json index 952b55297..3d96d9efb 100644 --- a/versions/c-/cpu-features.json +++ b/versions/c-/cpu-features.json @@ -1,6 +1,11 @@ { "versions": [ { + "git-tree": "1e64c7ac2673d19f18e8bc447b14e3ae7f842c81", + "version": "0.6.0", + "port-version": 0 + }, + { "git-tree": "e622c89147a667757495a82dfd7e4239b2782bd7", "version-string": "0.4.1", "port-version": 0 |
