[metrohash] support Android triplet build (#15715)

* [metrohash] support Android build

* check ANDROID variable
  * exclude 'crc' sources that requires non-ARM intrinsic
* rewrite CONTROL to vcpkg.json

* [metrohash] update checksum and version JSON

* [metrohash] apply PR feedback

* [metrohash] enable sse4.2 for Clang compiler

* [metrohash] fix wrong version string

* [metrohash] fix wrong version string
This commit is contained in:
Park DongHa 2021-02-03 08:00:00 +09:00 committed by GitHub
parent 4ef16cd07e
commit 3b4a4e4b5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 13 deletions

View File

@ -5,10 +5,20 @@ set(CMAKE_CXX_STANDARD 17)
add_library(metrohash
src/metrohash64.cpp
src/metrohash128.cpp
src/metrohash128crc.cpp
)
target_compile_options(metrohash PRIVATE -march=native)
set(metro_headers src/metrohash.h src/metrohash64.h src/metrohash128.h src/metrohash128crc.h)
list(APPEND metro_headers src/metrohash.h src/metrohash64.h src/metrohash128.h)
if(NOT ANDROID)
list(APPEND metro_headers src/metrohash128crc.h)
target_sources(metrohash PRIVATE src/metrohash128crc.cpp)
if(CMAKE_CXX_COMPILER_ID MATCHES Clang)
target_compile_options(metrohash PRIVATE -msse4.2)
endif()
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
target_compile_options(metrohash PRIVATE -march=native)
endif()
set_target_properties(metrohash PROPERTIES
PUBLIC_HEADER "${metro_headers}"
)

View File

@ -1,5 +0,0 @@
Source: metrohash
Version: 1.1.3-1
Homepage: https://github.com/jandrewrogers/MetroHash
Description: MetroHash is a set of state-of-the-art hash functions for non-cryptographic use cases.
Supports: !(uwp|arm|x86)

View File

@ -4,11 +4,15 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO jandrewrogers/MetroHash
REF 690a521d9beb2e1050cc8f273fdabc13b31bf8f6
SHA512 51ba58a43f7a60be823746082c1bdebf52a1fd452a0f778434850ccc71dd6f62750fc966ec6aed6b4b523279ad400733df3f56544e2d2e057c212044a2dc16a4
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)
configure_file(${CURRENT_PORT_DIR}/Config.cmake.in ${SOURCE_PATH}/cmake/Config.cmake.in COPYONLY)

View File

@ -0,0 +1,8 @@
{
"name": "metrohash",
"version-string": "1.1.3",
"port-version": 2,
"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)"
}

View File

@ -3705,8 +3705,8 @@
"port-version": 7
},
"metrohash": {
"baseline": "1.1.3-1",
"port-version": 0
"baseline": "1.1.3",
"port-version": 2
},
"mgnlibs": {
"baseline": "2019-09-29",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "0c764c9b22fa64b5194e65f69bfb28bc47dc20fc",
"version-string": "1.1.3",
"port-version": 2
},
{
"git-tree": "e322e34deeeb1ae533217d85ceea0b6ad36ec64e",
"version-string": "1.1.3-1",