aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/cityhash/CMakeLists.txt
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/cityhash/CMakeLists.txt
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/cityhash/CMakeLists.txt')
-rw-r--r--vcpkg/ports/cityhash/CMakeLists.txt62
1 files changed, 62 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)