forked from flier/pyfasthash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
56 lines (47 loc) · 1.55 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
cmake_minimum_required(VERSION 3.19)
project(_pyhash2)
find_package(Python3 REQUIRED COMPONENTS Development.Module)
include(cmake/compiler-features.cmake)
include(cmake/fnv.cmake)
include(cmake/farm.cmake)
if (NOT WIN32)
include(cmake/highway.cmake)
endif ()
include(cmake/lookup3.cmake)
include(cmake/smhasher.cmake)
include(cmake/superfasthash.cmake)
include(cmake/t1ha.cmake)
include(cmake/xxhash.cmake)
set(PYHASH2_SOURCES src/Hash.cpp)
Python3_add_library(${PROJECT_NAME} MODULE ${PYHASH2_SOURCES})
if (MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /utf-8 /std:c++14 /EHsc /Zi /MT)
elseif (GNU OR CLANG)
target_compile_options(${PROJECT_NAME} PRIVATE -std=c++14)
endif ()
target_link_libraries(${PROJECT_NAME} PRIVATE fnv farm lookup3 smhasher SuperFastHash t1ha xxhash)
if (NOT WIN32)
target_link_libraries(${PROJECT_NAME} PRIVATE highway)
endif ()
if (MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /MT /Zi /EHsc)
target_link_options(${PROJECT_NAME} PRIVATE /OPT:REF /OPT:ICF)
endif ()
if (HAS_AES_NI)
target_compile_definitions(${PROJECT_NAME} PRIVATE HAS_AES_INST)
endif ()
if (HAS_METRO_HASH_CRC)
target_compile_definitions(${PROJECT_NAME} PRIVATE SUPPORT_METRO_HASH_CRC=1)
endif ()
if (HAS_INT128 AND NOT MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE -flax-vector-conversions)
endif ()
if (HAS_INT128)
target_compile_definitions(${PROJECT_NAME} PRIVATE SUPPORT_INT128=1)
endif ()
target_include_directories(
${PROJECT_NAME} PRIVATE
src/
src/highwayhash/
src/pybind11/include/
)