-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathCMakeLists.txt
282 lines (220 loc) · 6.17 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
cmake_minimum_required(VERSION 3.18)
if(NOT KALIGN_PACKAGE_NAME)
set(KALIGN_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
endif()
if(NOT KALIGN_PACKAGE_VERSION)
set(KALIGN_PACKAGE_VERSION ${KALIGN_LIBRARY_VERSION_STRING})
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/src/version.h.in" "version.h")
set(source_files
src/test.c
src/tldevel.c
src/tlmisc.c
src/tlrng.c
src/esl_stopwatch.c
src/msa_alloc.c
src/msa_op.c
src/msa_io.c
src/msa_misc.c
src/msa_check.c
src/msa_cmp.c
src/msa_sort.c
src/alphabet.c
src/task.c
src/bisectingKmeans.c
src/sequence_distance.c
src/bpm.c
src/euclidean_dist.c
src/pick_anchor.c
src/aln_wrap.c
src/aln_param.c
src/aln_run.c
src/aln_mem.c
src/aln_setup.c
src/aln_controller.c
src/aln_seqseq.c
src/aln_seqprofile.c
src/aln_profileprofile.c
src/weave_alignment.c
# src/coretralign.c
# src/test.h
)
add_library(${PROJECT_NAME}_OBJ OBJECT ${source_files})
if(OpenMP_C_FOUND)
target_link_libraries(${PROJECT_NAME}_OBJ PRIVATE OpenMP::OpenMP_C)
endif(OpenMP_C_FOUND)
target_include_directories(${PROJECT_NAME}_OBJ
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/include
)
target_compile_definitions(${PROJECT_NAME}_OBJ PRIVATE KALIGN_PACKAGE_VERSION=\"${KALIGN_PACKAGE_VERSION}\")
add_library(${PROJECT_NAME})
add_library(${NAMESPACE_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
generate_export_header(${PROJECT_NAME}
EXPORT_FILE_NAME ${PROJECT_NAME}/${PROJECT_NAME}_export.h
)
set(public_header_files
${CMAKE_SOURCE_DIR}/lib/include/kalign/kalign.h
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}_export.h
#${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/${PROJECT_NAME}_export.h
)
set_target_properties(${PROJECT_NAME} PROPERTIES
LANGUAGES C
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
VERSION ${KALIGN_LIBRARY_VERSION_STRING}
SOVERSION ${KALIGN_LIBRARY_VERSION_MAJOR}
PUBLIC_HEADER "${public_header_files}"
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN 1
)
target_sources(${PROJECT_NAME}
PRIVATE
${public_header_files}
$<TARGET_OBJECTS:${PROJECT_NAME}_OBJ>
)
# Define headers for this library. PUBLIC headers are used for
# compiling the library, and will be added to consumers' build
# paths.
target_include_directories(${PROJECT_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_include_directories(${PROJECT_NAME}
PRIVATE
src
)
target_link_libraries(${PROJECT_NAME} PRIVATE m)
if(OpenMP_C_FOUND)
target_link_libraries(${PROJECT_NAME} PRIVATE OpenMP::OpenMP_C)
endif()
add_library(${PROJECT_NAME}_static STATIC
${public_header_files}
$<TARGET_OBJECTS:${PROJECT_NAME}_OBJ>
)
set_target_properties(${PROJECT_NAME}_static PROPERTIES
LANGUAGES C
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
VERSION ${KALIGN_LIBRARY_VERSION_STRING}
SOVERSION ${KALIGN_LIBRARY_VERSION_MAJOR}
PUBLIC_HEADER "${public_header_files}"
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN 1
)
target_include_directories(${PROJECT_NAME}_static
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_include_directories(${PROJECT_NAME}_static
PRIVATE
src
)
target_link_libraries(${PROJECT_NAME}_static PRIVATE m)
if(OpenMP_C_FOUND)
target_link_libraries(${PROJECT_NAME}_static PRIVATE OpenMP::OpenMP_C)
endif()
add_library(tldevel STATIC
src/tldevel.c
src/tlmisc.c
src/tlrng.c
src/esl_stopwatch.c
)
target_include_directories(tldevel
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_link_libraries(tldevel PRIVATE m)
# adjust this path depending where cmake searches for the target files
set(ConfigPackageLocation "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
# 'make install' to the correct locations (provided by GNUInstallDirs).
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}Targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Library
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Library
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Library # This is for Windows
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} COMPONENT Development
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(EXPORT ${PROJECT_NAME}Targets
FILE
${PROJECT_NAME}Targets.cmake
NAMESPACE
${NAMESPACE_NAME}::
DESTINATION
${ConfigPackageLocation}
COMPONENT
Development
)
configure_package_config_file(
${PROJECT_NAME}Config.cmake.in
${PROJECT_NAME}Config.cmake
INSTALL_DESTINATION "${ConfigPackageLocation}"
PATH_VARS CMAKE_INSTALL_PREFIX
)
write_basic_package_version_file(
${PROJECT_NAME}ConfigVersion.cmake
VERSION ${KALIGN_LIBRARY_VERSION_STRING}
COMPATIBILITY AnyNewerVersion
)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION
${ConfigPackageLocation}
COMPONENT
Development
)
add_executable(bpm_utest
src/tldevel.c
src/tlrng.c
src/esl_stopwatch.c
src/alphabet.c
src/bpm.c
src/bpm_test.c
)
target_link_libraries(bpm_utest PRIVATE m)
add_test(
NAME bpm_utest
COMMAND bpm_utest
)
add_executable(alphabet_utest
src/tldevel.c
src/alphabet.c
)
set_target_properties(alphabet_utest PROPERTIES COMPILE_FLAGS "-DUTEST_ALPHABET")
add_test(
NAME alphabet_utest
COMMAND alphabet_utest
)
add_executable(edist_utest
src/tldevel.c
src/tlrng.c
src/esl_stopwatch.c
src/euclidean_dist.c
)
target_link_libraries(edist_utest PRIVATE m)
set_target_properties(edist_utest PROPERTIES COMPILE_FLAGS "-DUTEST_EDIST")
add_test(
NAME edist_utest
COMMAND edist_utest
)
add_executable(task_utest
src/tldevel.c
src/tlrng.c
src/task.c
)
target_link_libraries(task_utest PRIVATE m)
set_target_properties(task_utest PROPERTIES COMPILE_FLAGS "-DTASKWRITETEST")
add_test(
NAME task_utest
COMMAND task_utest
)