aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPark DongHa <luncliff@gmail.com>2021-03-20 01:56:01 +0900
committerGitHub <noreply@github.com>2021-03-19 09:56:01 -0700
commit96403d0903c6663351c0b0e077beec9e296ec8e2 (patch)
tree4ec1f26921bc14ee46962fa4b8af04cf227afb5e
parent9e681d579b3ecadff19f339921c3dea89367236b (diff)
downloadvcpkg-96403d0903c6663351c0b0e077beec9e296ec8e2.tar.gz
vcpkg-96403d0903c6663351c0b0e077beec9e296ec8e2.zip
[metrohash] support more triplets by excluding 128 CRC source (#16553)
* [metrohash] exclude CRC for x86 * the change will allow x86 triplets * update port SHA * [metrohash] remove fail_port_install * update ci.baseline.txt * [metrohash] sync portfile and CMakeLists.txt * make both file use 'VCPKG_TARGET_TRIPLET' to make ease of comparison * [metrohash] Use try_compile helpers Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
-rw-r--r--ports/metrohash/CMakeLists.txt28
-rw-r--r--ports/metrohash/portfile.cmake29
-rw-r--r--ports/metrohash/vcpkg.json7
-rw-r--r--scripts/ci.baseline.txt4
-rw-r--r--versions/baseline.json2
-rw-r--r--versions/m-/metrohash.json5
6 files changed, 46 insertions, 29 deletions
diff --git a/ports/metrohash/CMakeLists.txt b/ports/metrohash/CMakeLists.txt
index 3d6c3d59d..d63a71345 100644
--- a/ports/metrohash/CMakeLists.txt
+++ b/ports/metrohash/CMakeLists.txt
@@ -1,6 +1,6 @@
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.5)
project(metrohash LANGUAGES CXX)
-set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_STANDARD 11)
add_library(metrohash
src/metrohash64.cpp
@@ -8,13 +8,29 @@ add_library(metrohash
)
list(APPEND metro_headers src/metrohash.h src/metrohash64.h src/metrohash128.h)
-if(NOT ANDROID AND NOT IOS)
- list(APPEND metro_headers src/metrohash128crc.h)
- target_sources(metrohash PRIVATE src/metrohash128crc.cpp)
- if(CMAKE_CXX_COMPILER_ID MATCHES Clang)
+include(CheckCXXSourceCompiles)
+include(CheckCXXCompilerFlag)
+
+if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ check_cxx_compiler_flag("-msse4.2" HAS_MSSE42)
+ if(HAS_MSSE42)
target_compile_options(metrohash PRIVATE -msse4.2)
+ string(APPEND CMAKE_REQUIRED_FLAGS " -msse4.2")
endif()
endif()
+
+check_cxx_source_compiles(
+"#include <nmmintrin.h>
+int main() {
+ _mm_crc32_u64(0, 0);
+ return 0;
+}"
+HAS_mm_crc32_u64)
+
+if(HAS_mm_crc32_u64)
+ list(APPEND metro_headers src/metrohash128crc.h)
+ target_sources(metrohash PRIVATE src/metrohash128crc.cpp)
+endif()
if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
target_compile_options(metrohash PRIVATE -march=native)
endif()
diff --git a/ports/metrohash/portfile.cmake b/ports/metrohash/portfile.cmake
index 66f7c957f..d62741a2a 100644
--- a/ports/metrohash/portfile.cmake
+++ b/ports/metrohash/portfile.cmake
@@ -1,29 +1,30 @@
-vcpkg_fail_port_install(ON_TARGET "UWP" ON_TARGET "x86" "arm" "aarch64")
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
- OUT_SOURCE_PATH SOURCE_PATH
- REPO jandrewrogers/MetroHash
- REF v1.1.3
- SHA512 02b6316e5ebf3d81465eea8a068565452be642394ddf5a53350affbbc9b9bfe1c3d182f7e8f7d49895351c48e11929e465777535e4354e01b6d0ba459e583ac5
- HEAD_REF master
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO jandrewrogers/MetroHash
+ REF v1.1.3
+ SHA512 02b6316e5ebf3d81465eea8a068565452be642394ddf5a53350affbbc9b9bfe1c3d182f7e8f7d49895351c48e11929e465777535e4354e01b6d0ba459e583ac5
+ HEAD_REF master
)
-if(VCPKG_TARGET_IS_ANDROID)
- vcpkg_replace_string(${SOURCE_PATH}/src/metrohash.h
- "#include \"metrohash128crc.h\""
- "//#include \"metrohash128crc.h\" // It can't be supported for Android")
-endif()
-configure_file(${CURRENT_PORT_DIR}/CMakeLists.txt ${SOURCE_PATH}/CMakeLists.txt COPYONLY)
+
+file(COPY ${CURRENT_PORT_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
configure_file(${CURRENT_PORT_DIR}/Config.cmake.in ${SOURCE_PATH}/cmake/Config.cmake.in COPYONLY)
vcpkg_configure_cmake(
- SOURCE_PATH ${SOURCE_PATH}
- PREFER_NINJA
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT})
vcpkg_copy_pdbs()
+if(NOT EXISTS "${CURRENT_PACKAGES_DIR}/include/metrohash128crc.h")
+ vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/metrohash.h
+ "#include \"metrohash128crc.h\""
+ "//#include \"metrohash128crc.h\" // The target platform does not support _mm_crc32_u64")
+endif()
+
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
diff --git a/ports/metrohash/vcpkg.json b/ports/metrohash/vcpkg.json
index a439e2c6a..2f61a8670 100644
--- a/ports/metrohash/vcpkg.json
+++ b/ports/metrohash/vcpkg.json
@@ -1,8 +1,7 @@
{
"name": "metrohash",
- "version-string": "1.1.3",
- "port-version": 3,
+ "version": "1.1.3",
+ "port-version": 4,
"description": "MetroHash is a set of state-of-the-art hash functions for non-cryptographic use cases",
- "homepage": "https://github.com/jandrewrogers/MetroHash",
- "supports": "!(uwp | arm | x86)"
+ "homepage": "https://github.com/jandrewrogers/MetroHash"
}
diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt
index 81ef00bf5..36519bbef 100644
--- a/scripts/ci.baseline.txt
+++ b/scripts/ci.baseline.txt
@@ -910,10 +910,6 @@ meschach:x64-osx=fail
meschach:x64-uwp=fail
metis:arm-uwp=fail
metis:x64-uwp=fail
-metrohash:arm-uwp=fail
-metrohash:x64-uwp=fail
-metrohash:x86-windows=fail
-metrohash:arm64-windows=fail
mhook:arm64-windows=fail
mhook:arm-uwp=fail
mhook:x64-linux=fail
diff --git a/versions/baseline.json b/versions/baseline.json
index 13871aa54..89c59678c 100644
--- a/versions/baseline.json
+++ b/versions/baseline.json
@@ -3798,7 +3798,7 @@
},
"metrohash": {
"baseline": "1.1.3",
- "port-version": 3
+ "port-version": 4
},
"mgnlibs": {
"baseline": "2019-09-29",
diff --git a/versions/m-/metrohash.json b/versions/m-/metrohash.json
index f062696f4..56847f9fb 100644
--- a/versions/m-/metrohash.json
+++ b/versions/m-/metrohash.json
@@ -1,6 +1,11 @@
{
"versions": [
{
+ "git-tree": "777a0ee61fdc53dcad0971184232d29b58e52f63",
+ "version": "1.1.3",
+ "port-version": 4
+ },
+ {
"git-tree": "33078163f0311cfecce47b42c304650b602c9ddf",
"version-string": "1.1.3",
"port-version": 3