diff options
Diffstat (limited to 'vcpkg/ports/cityhash')
| -rw-r--r-- | vcpkg/ports/cityhash/CMakeLists.txt | 62 | ||||
| -rw-r--r-- | vcpkg/ports/cityhash/config.h | 118 | ||||
| -rw-r--r-- | vcpkg/ports/cityhash/portfile.cmake | 43 | ||||
| -rw-r--r-- | vcpkg/ports/cityhash/vcpkg.json | 23 |
4 files changed, 246 insertions, 0 deletions
diff --git a/vcpkg/ports/cityhash/CMakeLists.txt b/vcpkg/ports/cityhash/CMakeLists.txt new file mode 100644 index 0000000..5a5a312 --- /dev/null +++ b/vcpkg/ports/cityhash/CMakeLists.txt @@ -0,0 +1,62 @@ +cmake_minimum_required(VERSION 3.13) +project(cityhash CXX) + +option(ENABLE_SSE "Build CityHash variants that depend on the _mm_crc32_u64 intrinsic." OFF) + +set(CMAKE_CXX_STANDARD 11) + +if (ENABLE_SSE) + include (CMakePushCheckState) + cmake_push_check_state() + if (MSVC) + include(CheckCXXSourceCompiles) + + check_cxx_source_compiles( + "#include <nmmintrin.h> + int main() { + _mm_crc32_u64(0, 0); + return 0; + }" + USE_SSE) + else() + include(CheckCXXCompilerFlag) + check_cxx_compiler_flag ("-msse4.2" USE_SSE) + if (USE_SSE) + set (SSE2_FLAG "-msse4.2") + endif() + endif() + + cmake_pop_check_state() + + if (NOT USE_SSE) + message(FATAL_ERROR "This platform doesn't support feature SSE4.2") + endif() +else() + set(USE_SSE OFF) +endif() + +add_library(cityhash STATIC src/city.cc) + +list(APPEND CITY_HEADERS src/city.h) +if (USE_SSE) + list(APPEND CITY_HEADERS src/citycrc.h) + + target_compile_options(cityhash PRIVATE ${SSE2_FLAG}) + if (MSVC) + target_compile_definitions(cityhash PRIVATE __SSE4_2__) + endif() +endif() + +target_include_directories(cityhash PUBLIC + $<INSTALL_INTERFACE:include> + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src> +) + +install(TARGETS cityhash EXPORT cityhash-config + RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib +) + +install(EXPORT cityhash-config DESTINATION share/cmake/cityhash) +install(FILES ${CITY_HEADERS} DESTINATION include) diff --git a/vcpkg/ports/cityhash/config.h b/vcpkg/ports/cityhash/config.h new file mode 100644 index 0000000..190c1da --- /dev/null +++ b/vcpkg/ports/cityhash/config.h @@ -0,0 +1,118 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* Define to 1 if the compiler supports __builtin_expect. */ +#if WIN32 || WIN64 +# define HAVE_BUILTIN_EXPECT 0 +#else +# define HAVE_BUILTIN_EXPECT 1 +#endif + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the <inttypes.h> header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the <memory.h> header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the <stdint.h> header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the <strings.h> header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the <string.h> header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the <sys/types.h> header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the <unistd.h> header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "cityhash-discuss@googlegroups.com" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "CityHash" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "CityHash 1.1.1" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "cityhash" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "1.1.1" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + +/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>, + <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT32_T */ + +/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>, + <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT64_T */ + +/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>, + <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT8_T */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `unsigned int' if <sys/types.h> does not define. */ +/* #undef size_t */ + +/* Define to `int' if <sys/types.h> does not define. */ +/* #undef ssize_t */ + +/* Define to the type of an unsigned integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint32_t */ + +/* Define to the type of an unsigned integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint64_t */ + +/* Define to the type of an unsigned integer type of width exactly 8 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint8_t */ diff --git a/vcpkg/ports/cityhash/portfile.cmake b/vcpkg/ports/cityhash/portfile.cmake new file mode 100644 index 0000000..77cf701 --- /dev/null +++ b/vcpkg/ports/cityhash/portfile.cmake @@ -0,0 +1,43 @@ +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO google/cityhash + REF 8af9b8c2b889d80c22d6bc26ba0df1afb79a30db + SHA512 5878a6a4f8ee99593412d446d96c05be1f89fa7771eca49ff4a52ce181de8199ba558170930996d36f6df80a65889d93c81ab2611868b015d8db913e2ecd2eb9 + HEAD_REF master +) + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") + +if(VCPKG_TARGET_IS_WINDOWS) + file(COPY "${CMAKE_CURRENT_LIST_DIR}/config.h" DESTINATION "${SOURCE_PATH}/src") +else() + file(MAKE_DIRECTORY "${SOURCE_PATH}/out") + vcpkg_execute_required_process( + COMMAND "${SOURCE_PATH}/configure" + WORKING_DIRECTORY "${SOURCE_PATH}/out" + LOGNAME configure-${TARGET_TRIPLET} + ) + file(COPY "${SOURCE_PATH}/out/config.h" DESTINATION "${SOURCE_PATH}/src") +endif() + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + "sse" ENABLE_SSE +) + +vcpkg_cmake_configure( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + ${FEATURE_OPTIONS} +) + +vcpkg_cmake_install() +vcpkg_copy_pdbs() +vcpkg_cmake_config_fixup(CONFIG_PATH share/cmake/cityhash) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/share") + +configure_file("${SOURCE_PATH}/COPYING" "${CURRENT_PACKAGES_DIR}/share/cityhash/copyright" COPYONLY) diff --git a/vcpkg/ports/cityhash/vcpkg.json b/vcpkg/ports/cityhash/vcpkg.json new file mode 100644 index 0000000..afa9b46 --- /dev/null +++ b/vcpkg/ports/cityhash/vcpkg.json @@ -0,0 +1,23 @@ +{ + "name": "cityhash", + "version-date": "2013-01-08", + "port-version": 3, + "description": "CityHash, a family of hash functions for strings.", + "homepage": "https://github.com/google/cityhash", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "sse": { + "description": "Build CityHash variants that depend on the _mm_crc32_u64 intrinsic.", + "supports": "x64 | (x86 & !windows)" + } + } +} |