-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
166 lines (135 loc) · 4.04 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
project(imghash)
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_MODULE_PATH ${imghash_SOURCE_DIR}/cmake/)
include(FindSSE)
if (SSE2_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse -msse2 -mfpmath=sse")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse -msse2 -mfpmath=sse")
endif()
if (SSE3_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse3")
endif()
if (SSSE3_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mssse3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3")
endif()
if(SSE4_1_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1")
endif()
if (SSE4_2_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2")
endif()
include(FindPkgConfig)
find_package(cxxopts CONFIG REQUIRED)
find_package(spdlog CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
find_package(indicators CONFIG REQUIRED)
find_package(Boost REQUIRED COMPONENTS filesystem)
find_package(Eigen3 CONFIG REQUIRED)
find_package(unofficial-sqlite3 CONFIG REQUIRED)
find_package(fmt CONFIG REQUIRED)
find_package(Threads REQUIRED)
pkg_check_modules(GRAPHICSMAGICK REQUIRED IMPORTED_TARGET GraphicsMagick++)
find_path(BSHOSHANY_THREAD_POOL_INCLUDE_DIRS "thread_pool.hpp")
add_library(imghash-static STATIC ${imghash_SOURCE_DIR}/tokenizer.cpp)
target_include_directories(imghash-static SYSTEM PRIVATE ${imghash_SOURCE_DIR})
target_compile_options(imghash-static PRIVATE -W -Wall -Wextra)
set_target_properties(imghash-static PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
OUTPUT_NAME imghash
)
add_executable(
imghash
${imghash_SOURCE_DIR}/imghash.cpp
)
target_compile_options(imghash PRIVATE -W -Wall -Wextra)
target_include_directories(imghash SYSTEM PRIVATE ${imghash_SOURCE_DIR} ${GRAPHICSMAGICK_INCLUDE_DIRS})
set_target_properties(imghash PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
)
target_link_libraries(imghash PRIVATE
imghash-static
spdlog::spdlog
cxxopts::cxxopts
indicators::indicators
unofficial::sqlite3::sqlite3
Eigen3::Eigen
Boost::filesystem
fmt::fmt
PkgConfig::GRAPHICSMAGICK
${CMAKE_DL_LIBS}
Threads::Threads
)
add_executable(
clusterizer
${imghash_SOURCE_DIR}/clusterizer.cpp
)
target_compile_options(clusterizer PRIVATE -W -Wall -Wextra)
target_include_directories(clusterizer PRIVATE ${BSHOSHANY_THREAD_POOL_INCLUDE_DIRS})
set_target_properties(clusterizer PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
COMPILE_FLAGS "-mpopcnt"
)
target_link_libraries(clusterizer PRIVATE
imghash-static
cxxopts::cxxopts
unofficial::sqlite3::sqlite3
Threads::Threads
)
add_executable(distance
${imghash_SOURCE_DIR}/distance.cpp
)
target_compile_options(distance PRIVATE -W -Wall -Wextra)
set_target_properties(distance PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
COMPILE_FLAGS "-mpopcnt"
)
target_link_libraries(distance PRIVATE
imghash-static
cxxopts::cxxopts
)
add_executable(
export2db
${imghash_SOURCE_DIR}/export2db.cpp
)
target_compile_options(export2db PRIVATE -W -Wall -Wextra)
set_target_properties(export2db PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
)
target_link_libraries(export2db PRIVATE
imghash-static
cxxopts::cxxopts
unofficial::sqlite3::sqlite3
)
add_executable(
print-clusters
${imghash_SOURCE_DIR}/print-clusters.cpp
)
target_compile_options(print-clusters PRIVATE -W -Wall -Wextra)
target_include_directories(print-clusters SYSTEM PRIVATE ${imghash_SOURCE_DIR})
set_target_properties(print-clusters PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
)
target_link_libraries(print-clusters PRIVATE
imghash-static
spdlog::spdlog
cxxopts::cxxopts
nlohmann_json::nlohmann_json
unofficial::sqlite3::sqlite3
)