diff options
| author | Park DongHa <luncliff@gmail.com> | 2021-03-20 01:56:01 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-19 09:56:01 -0700 |
| commit | 96403d0903c6663351c0b0e077beec9e296ec8e2 (patch) | |
| tree | 4ec1f26921bc14ee46962fa4b8af04cf227afb5e /ports | |
| parent | 9e681d579b3ecadff19f339921c3dea89367236b (diff) | |
| download | vcpkg-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>
Diffstat (limited to 'ports')
| -rw-r--r-- | ports/metrohash/CMakeLists.txt | 28 | ||||
| -rw-r--r-- | ports/metrohash/portfile.cmake | 29 | ||||
| -rw-r--r-- | ports/metrohash/vcpkg.json | 7 |
3 files changed, 40 insertions, 24 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" } |
