-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
172 lines (154 loc) · 3.95 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
167
168
169
170
171
172
cmake_minimum_required(VERSION 3.13)
project(TEAM33_HDBSCAN)
set(CMAKE_CXX_STANDARD 20)
include(cmake/GetGTest.cmake)
include(cmake/GetGFlags.cmake)
include_directories(
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/src/include
${gflags_BINARY_DIR}/include
)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(
HDB_SOURCE_FILES
src/hdbscan/outlier_score.cpp
src/hdbscan/undirected_graph.cpp
src/hdbscan/_C_undirected_graph.cpp
src/hdbscan/cluster.cpp
src/hdbscan/HDBSCAN_io.cpp
src/hdbscan/runner.cpp
src/hdbscan/calculate_core_distances.cpp
src/hdbscan/construct_mst.cpp
src/hdbscan/hierarchy_cluster.cpp
src/hdbscan/propagate_tree.cpp
src/hdbscan/prominent_clusters.cpp
src/common/list.cpp
src/common/vector.cpp
src/common/set.cpp
src/common/ordered_set.cpp
src/common/map.cpp
)
add_library(
hdb_lib
${HDB_SOURCE_FILES}
)
set_target_properties(
hdb_lib
PROPERTIES COMPILE_FLAGS "-O3 -march=native"
)
add_executable(
unit_tests # executable
tests/main.cpp # dependency
tests/hdbscan/constraint.cpp
tests/distances/cosine_similarity.cpp
tests/distances/euclidean_distance.cpp
tests/distances/manhattan_distance.cpp
tests/distances/pearson_correlation.cpp
tests/distances/supremum_distance.cpp
tests/hdbscan/undirected_graph.cpp
tests/hdbscan/_C_undirected_graph.cpp
tests/hdbscan/cluster.cpp
tests/hdbscan/HDBSCAN_star.cpp
tests/hdbscan/runner.cpp
tests/common/vector_reductions.cpp
tests/common/list.cpp
tests/common/vector.cpp
tests/common/bitset.cpp
tests/common/set.cpp
tests/common/quicksort.cpp
tests/common/ordered_set.cpp
tests/common/map.cpp
)
target_link_libraries(
unit_tests
gtest_main
hdb_lib
pthread
gflags_nothreads_static
stdc++fs
)
set_target_properties(
unit_tests
PROPERTIES COMPILE_FLAGS "-O3 -march=native"
)
function(build_hdbscan exec_name compiler_flags output_directory)
add_executable(
${exec_name}
src/main.cpp
)
add_library(
${exec_name}_lib
${HDB_SOURCE_FILES}
)
target_link_libraries(
${exec_name}
gflags_nothreads_static
${exec_name}_lib
pthread
)
set_target_properties(
${exec_name}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${output_directory}"
)
set_target_properties(
${exec_name}
${exec_name}_lib
PROPERTIES COMPILE_FLAGS "${compiler_flags} -fno-tree-vectorize -march=native")
endfunction()
function(build_hdbscan_benchmarking compiler_flags)
set(NAME_APPEND "")
string(REPLACE " " "_" NAME_APPEND ${compiler_flags})
build_hdbscan("hdbscan${NAME_APPEND}" ${compiler_flags} "benchmarking")
endfunction()
build_hdbscan("hdbscan" "-O3" "")
build_hdbscan_benchmarking("-O0")
build_hdbscan_benchmarking("-O3")
enable_testing()
add_executable(
distance_benchmark
distance_benchmark/main.cpp
)
set_target_properties(
distance_benchmark
PROPERTIES COMPILE_FLAGS "-O3 -fno-tree-vectorize -march=native"
)
add_library(
hdb_lib_mst_benchmarking
${HDB_SOURCE_FILES}
)
set_target_properties(
hdb_lib_mst_benchmarking
PROPERTIES COMPILE_FLAGS "-O3 -fno-tree-vectorize -march=native"
)
add_executable(
mst_benchmark
src/benchmark_mst.cpp
)
target_link_libraries(
mst_benchmark
gflags_nothreads_static
hdb_lib_mst_benchmarking
stdc++fs
)
set_target_properties(
mst_benchmark
PROPERTIES COMPILE_FLAGS "-O3 -fno-tree-vectorize -march=native"
)
add_executable(
cd_benchmark
src/benchmark_cd.cpp
)
target_link_libraries(
cd_benchmark
gflags_nothreads_static
hdb_lib_mst_benchmarking
stdc++fs
)
set_target_properties(
cd_benchmark
PROPERTIES COMPILE_FLAGS "-O3 -fno-tree-vectorize -march=native"
)
# add_subdirectory(src)
# add_subdirectory(tests)