[MetroHash] Add new port (#10049)

* MetroHash

* wip

* wip

* wip
This commit is contained in:
kreuzerkrieg 2020-03-11 00:40:15 +02:00 committed by GitHub
parent 51974b9a5d
commit fb87bc7d41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 82 additions and 0 deletions

View File

@ -0,0 +1,44 @@
cmake_minimum_required(VERSION 3.14)
project(MetroHash LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
add_library(metrohash
src/metrohash64.cpp
src/metrohash128.cpp
src/metrohash128crc.cpp
)
target_compile_options(metrohash PRIVATE -march=native)
target_include_directories(metrohash SYSTEM PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/src/)
set (metro_headers src/metrohash64.h src/metrohash128.h src/metrohash128crc.h)
set_target_properties(metrohash PROPERTIES
PUBLIC_HEADER "${metro_headers}"
)
include(CMakePackageConfigHelpers)
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
set(config_install_dir "lib/cmake/${PROJECT_NAME}")
set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
set(namespace "${PROJECT_NAME}::")
# Configure '<PROJECT-NAME>Config.cmake'
# Use variables:
# * TARGETS_EXPORT_NAME
# * PROJECT_NAME
configure_package_config_file(
"${CMAKE_SOURCE_DIR}/cmake/Config.cmake.in"
"${project_config}"
INSTALL_DESTINATION "${config_install_dir}"
)
#Installation
install(TARGETS metrohash
EXPORT "${TARGETS_EXPORT_NAME}"
LIBRARY DESTINATION "lib"
ARCHIVE DESTINATION "lib"
INCLUDES DESTINATION "include")
install(EXPORT "${TARGETS_EXPORT_NAME}"
NAMESPACE "${namespace}"
DESTINATION "${config_install_dir}"
)

5
ports/metrohash/CONTROL Normal file
View File

@ -0,0 +1,5 @@
Source: metrohash
Version: 1.1.3
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

@ -0,0 +1,4 @@
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
check_required_components("@PROJECT_NAME@")

View File

@ -0,0 +1,25 @@
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 690a521d9beb2e1050cc8f273fdabc13b31bf8f6
SHA512 51ba58a43f7a60be823746082c1bdebf52a1fd452a0f778434850ccc71dd6f62750fc966ec6aed6b4b523279ad400733df3f56544e2d2e057c212044a2dc16a4
HEAD_REF master
)
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)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake)
vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)

View File

@ -1061,6 +1061,10 @@ 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