-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
517 lines (466 loc) · 12.3 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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
cmake_minimum_required(VERSION 3.14.5)
project(sleipnir)
message(STATUS "SOURCE DIR: " ${CMAKE_CURRENT_SOURCE_DIR})
message(STATUS "ROOT DIR: " ${ROOT})
add_link_options(-lpthread)
add_link_options(-pthread) # for Ubuntu
set(CMAKE_CXX_STANDARD 17)
if((NOT CMAKE_BUILD_TYPE) OR (${CMAKE_BUILD_TYPE} MATCHES Release))
message(STATUS "Generating release config")
set(CMAKE_BUILD_TYPE Release)
add_compile_options(-O3)
elseif(${CMAKE_BUILD_TYPE} MATCHES Debug)
message(STATUS "Generating debug config")
add_compile_options(-g)
endif()
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
include_directories(src)
option(PACKAGE_TESTS "Build the tests" ON)
if(PACKAGE_TESTS)
enable_testing()
include(GoogleTest)
add_subdirectory(tests)
endif()
set(SLEIPNIR_SOURCES
src/example_gtest.cpp
src/example_gtest.h
src/annotation.cpp
src/annotation.h
src/annotationi.h
src/annotationkegg.cpp
src/annotationmips.cpp
src/annotationobo.cpp
src/bayesnet.cpp
src/bayesnet.h
src/bayesnetfn.cpp
src/bayesnetfni.h
src/bayesneti.h
src/bayesnetint.h
src/bayesnetmixed.cpp
src/bayesnetpnl.cpp
src/bayesnetsmile.cpp
src/bayesnetsmileelr.cpp
src/clusthierarchical.cpp
src/clusthierarchical.h
src/clusthierarchicali.h
src/clustkmeans.cpp
src/clustkmeans.h
src/clustkmeansi.h
src/clustpivot.cpp
src/clustpivot.h
src/clustqtc.cpp
src/clustqtc.h
src/clustqtci.h
src/coalesce.cpp
src/coalesce.h
src/coalescebasei.h
src/coalescecluster.cpp
src/coalescecluster.h
src/coalesceclusteri.h
src/coalescei.h
src/coalescemotifs.cpp
src/coalescemotifs.h
src/coalescemotifsi.h
src/coalescestructs.cpp
src/coalescestructsi.h
src/color.cpp
src/color.h
src/colori.h
src/compactmatrix.cpp
src/compactmatrix.h
src/compactmatrixi.h
src/dat.cpp
src/dat.h
src/database.cpp
src/database.h
src/databasei.h
src/datapair.cpp
src/datapair.h
src/datapairi.h
src/dataset.cpp
src/dataset.h
src/datasetcompact.cpp
src/dataseti.h
src/dati.h
src/example.cpp
src/examplei.h
src/fasta.cpp
src/fasta.h
src/fastai.h
src/file.cpp
src/file.h
src/filei.h
src/fullmatrix.h
src/genome.cpp
src/genome.h
src/genomei.h
src/halfmatrix.h
src/halfmatrixi.h
src/hmm.cpp
src/hmm.h
src/hmmi.h
src/mathb.cpp
src/mathb.h
src/mathbi.h
src/measure.cpp
src/measure.h
src/measurei.h
src/meta.cpp
src/meta.h
src/metai.h
src/orthology.cpp
src/orthology.h
src/orthologyi.h
src/pcl.cpp
src/pcl.h
src/pcli.h
src/PclQuery.cpp
src/PclQuery.h
src/pclset.cpp
src/pclset.h
src/pclseti.h
src/pst.cpp
src/pst.h
src/psti.h
src/seekbasic.h
src/seekcentral.cpp
src/seekcentral.h
src/seekdataset.cpp
src/seekdataset.h
src/seekerror.cpp
src/seekerror.h
src/seekevaluate.cpp
src/seekevaluate.h
src/seekhelper.cpp
src/seekhelper.h
src/seekmap.cpp
src/seekmap.h
src/seeknetwork.cpp
src/seeknetwork.h
src/seekplatform.cpp
src/seekplatform.h
src/SeekPValue.cpp
src/SeekPValue.h
src/seekquery.cpp
src/seekquery.h
src/seekreader.cpp
src/seekreader.h
src/seekweight.cpp
src/seekweight.h
src/seekwriter.cpp
src/seekwriter.h
src/server.cpp
src/server.h
src/serverclient.cpp
src/serverclient.h
src/serverclienti.h
src/serveri.h
src/sparsematrix.h
src/sparsematrixi.h
src/statistics.cpp
src/statistics.h
src/statisticsi.h
src/stdafx.cpp
src/stdafx.h
src/strassen.cpp
src/strassen.h
src/trie.h
src/triei.h
src/typesi.h
src/vwb.cpp
src/vwb.h
src/vwbi.h)
# compiler-specific logic for building multithreaded code
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Xpreprocessor -fopenmp)
find_library(LIBOMP libomp.a)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
add_compile_options(-fopenmp)
add_link_options(-lgslcblas)
list(APPEND EXTRA_LIBRARIES stdc++fs)
set(LIBOMP -lgomp)
else()
message(SEND_INFO "Found some weird compiler: ${CMAKE_CXX_COMPILER_ID}")
endif()
option(USE_THRIFT "Use thrift" ON)
if(USE_THRIFT)
find_library(LIBTHRIFT thrift)
endif()
option(USE_GENGETOPT "Use gengetopt" ON)
if(USE_GENGETOPT)
find_program(GENGETOPT gengetopt)
set(GENGETOPT_PROGRAM GENGETOPT)
endif()
option(USE_READLINE "Use readline" ON)
if(USE_READLINE)
find_library(READLINE_LIBRARY readline)
find_path(READLINE_INCLUDE readline)
list(APPEND EXTRA_LIBRARIES ${READLINE_LIBRARY})
list(APPEND EXTRA_INCLUDES ${READLINE_INCLUDE})
endif()
option(USE_LOG4CPP "Use log4cpp" OFF)
if(USE_LOG4CPP)
find_library(LOG4CPP_LIBRARY log4cpp)
find_path(LOG4CPP_INCLUDE log4cpp)
list(APPEND EXTRA_LIBRARIES ${LOG4CPP_LIBRARY})
list(APPEND EXTRA_INCLUDES ${LOG4CPP_INCLUDE})
else()
list(APPEND SLEIPNIR_COMPILE_DEFS USE_LOG4CPP_STUB)
endif()
option(USE_SMILE "Use SMILE" OFF)
if(USE_SMILE)
find_library(SMILE_LIBRARY smile)
find_path(SMILE_INCLUDE smile.h)
list(APPEND EXTRA_LIBRARIES ${SMILE_LIBRARY})
list(APPEND EXTRA_INCLUDES ${SMILE_INCLUDE})
else()
list(APPEND SLEIPNIR_COMPILE_DEFS NO_SMILE=1)
endif()
find_path(BOOST_INCLUDE boost)
if(BOOST_INCLUDE)
list(APPEND EXTRA_INCLUDES ${BOOST_INCLUDE})
else()
message(SEND_ERROR "Missing required Boost headers")
endif()
find_library(BOOST_GRAPH_LIBRARY boost_graph)
if(BOOST_GRAPH_LIBRARY AND BOOST_INCLUDE)
list(APPEND EXTRA_LIBRARIES ${BOOST_GRAPH_LIBRARY})
else()
message(SEND_ERROR "Missing required library boost_graph")
endif()
find_library(BOOST_REGEX_LIBRARY boost_regex)
if(BOOST_REGEX_LIBRARY AND BOOST_INCLUDE)
list(APPEND EXTRA_LIBRARIES ${BOOST_REGEX_LIBRARY})
else()
message(SEND_ERROR "Missing required library boost_regex")
endif()
include(FindGSL)
if(GSL_FOUND)
list(APPEND EXTRA_INCLUDES ${GSL_INCLUDE_DIR})
list(APPEND EXTRA_LIBRARIES ${GSL_LIBRARY})
else()
message(SEND_ERROR "Missing required library gsl")
endif()
option(USE_OPENBLAS "Use open_blas" OFF)
if(USE_OPENBLAS)
find_package(OpenBLAS REQUIRED)
list(APPEND EXTRA_LIBRARIES ${OpenBLAS_LIBRARIES})
list(APPEND EXTRA_INCLUDES ${OpenBLAS_INCLUDE_DIRS})
endif()
option(USE_SVMLIB "Use svm_lib" ON)
if(USE_SVMLIB)
list(APPEND SLEIPNIR_SOURCES src/svm_local.cpp
src/svm_local.h
src/svm_local.cpp
src/svmi.h
src/libsvm.cpp
src/libsvm.h)
find_library(SVM_LIBRARY svm)
find_path(SVM_INCLUDE PATH_SUFFIXES libsvm NAMES svm.h)
list(APPEND EXTRA_LIBRARIES ${SVM_LIBRARY})
list(APPEND EXTRA_INCLUDES ${SVM_INCLUDE})
else()
list(APPEND SLEIPNIR_COMPILE_DEFS NO_LIBSVM=1)
endif()
option(USE_SVM_PERF "Use svm_perf" OFF)
if(USE_SVM_PERF)
list(APPEND SLEIPNIR_SOURCES
src/svmperf.cpp
src/svmperf.h)
find_library(SVM_PERF_LIBRARY libsvmperf.a)
find_path(SVM_PERF_INCLUDE
PATH_SUFFIXES svm_perf
NAMES svm_common.h svm_struct_api.h)
list(APPEND EXTRA_LIBRARIES ${SVM_PERF_LIBRARY})
list(APPEND EXTRA_INCLUDES ${SVM_PERF_INCLUDE})
else()
list(APPEND SLEIPNIR_COMPILE_DEFS NO_SVM_PERF=1 NO_SVM_STRUCTTREE=1 NO_SVM_STRUCT=1)
endif()
# we explicitly disable the hierarchical and multiclass svm_perfs because they don't work
list(APPEND SLEIPNIR_COMPILE_DEFS NO_SVM_MULTICLASS=1 NO_SVM_STRUCTTREE=1)
option(USE_VOWPAL_WABBIT "Use Vowpal Wabbit" ON)
if(USE_VOWPAL_WABBIT)
find_library(VOWPAL_WABBIT_LIBRARY libvw.a)
find_path(VOWPAL_WABBIT_INCLUDE PATH_SUFFIXES vowpalwabbit
NAMES vw.h)
if(VOWPAL_WABBIT_LIBRARY AND VOWPAL_WABBIT_INCLUDE)
list(APPEND EXTRA_LIBRARIES ${VOWPAL_WABBIT_LIBRARY})
list(APPEND EXTRA_INCLUDES ${VOWPAL_WABBIT_INCLUDE})
else()
list(APPEND SLEIPNIR_COMPILE_DEFS NO_VOWPAL_WABBIT)
endif()
else()
list(APPEND SLEIPNIR_COMPILE_DEFS NO_VOWPAL_WABBIT=1)
endif()
add_library(sleipnir STATIC ${SLEIPNIR_SOURCES})
target_include_directories(sleipnir PUBLIC ${EXTRA_INCLUDES})
target_compile_definitions(sleipnir PUBLIC ${SLEIPNIR_COMPILE_DEFS})
target_link_libraries(sleipnir)
# command line tools
# these tools depend on having libsmile available to link
if(SMILE_LIBRARY)
list(APPEND SLEIPNIR_TOOLS
BNConverter
BNCreator
BNEvaluator
BNServer
BNTester
BNTruster
BNUnraveler
BNWeaver
BNs2Txt
Contexter
Counter
DSLConverter
Dab2Dad
Edges2Posteriors
SpeciesConnector
MEFIT
)
endif()
# tools that depend on having svm_perf
if(SVM_PERF_LIBRARY)
list(APPEND SLEIPNIR_TOOLS
Data2SVM
SVMperfer
SVMperfing
SVMfe
SVMer
)
endif()
list(APPEND SLEIPNIR_TOOLS
Answerer
BNFunc
COALESCE
Clinician
Cliquer
Clusterer
Clusters2Dab
Combiner
DBCombiner
DChecker
Dat2Dab
Dat2Graph
Dat2PCL
Data2Bnt
Data2DB
Data2Features
Data2Sql
DataDumper
DataServer
Distancer
Explainer
Filterer
Funcaeologist
Funcifier
Funcographer
Hubber
KNNImputer
LibSVMer
MCluster
MIed
MIer
Mat2Txt
Matcher
NetMiner
NetworkCombiner
NetworkRanker
Normalizer
OntoShell
Orthologer
Overlapper
PCL2Bin
PCLPlotter
PCLServer
PclRpcClient
Randomizer
SMRF
SVDer
SparseNetCombiner
SeekAggregatedDataset
SeekEvaluator
SeekGeneRecommender
SeekIterative
SeekMiner
SeekPValue
SeekPrep
SeekReader
SeekRPC
SeekRPCClient
SeekServer
SeekTest
Seqs2Ngrams
Synthesizer
Txt2Bin
VWer
)
foreach(TOOL ${SLEIPNIR_TOOLS})
# include_directories(tools/${TOOL})
if (${TOOL} MATCHES OntoShell)
add_executable(${TOOL}
tools/${TOOL}/${TOOL}.cpp
tools/${TOOL}/cmdline.c
tools/${TOOL}/stdafx.cpp
tools/${TOOL}/parser.cpp
tools/${TOOL}/parserconsole.cpp)
elseif (${TOOL} MATCHES BNServer)
add_executable(${TOOL}
tools/${TOOL}/${TOOL}.cpp
tools/${TOOL}/cmdline.c
tools/${TOOL}/stdafx.cpp
tools/${TOOL}/dot.cpp)
elseif (${TOOL} STREQUAL SeekRPC)
add_executable(${TOOL}
tools/${TOOL}/SeekRPCServer.cpp
tools/${TOOL}/SeekInterface.cpp
tools/${TOOL}/gen-cpp/seek_rpc_constants.cpp
tools/${TOOL}/gen-cpp/seek_rpc_types.cpp
tools/${TOOL}/gen-cpp/SeekRPC.cpp
)
list(APPEND TMP_LIBRARIES ${LIBTHRIFT})
elseif (${TOOL} STREQUAL SeekRPCClient)
add_executable(${TOOL}
tools/SeekRPC/SeekRPCClient.cpp
tools/SeekRPC/gen-cpp/seek_rpc_constants.cpp
tools/SeekRPC/gen-cpp/seek_rpc_types.cpp
tools/SeekRPC/gen-cpp/SeekRPC.cpp
)
list(APPEND TMP_LIBRARIES ${LIBTHRIFT})
elseif (${TOOL} STREQUAL PclRpcClient)
add_executable(${TOOL}
tools/SeekRPC/PclRpcClient.cpp
tools/SeekRPC/gen-cpp/seek_rpc_constants.cpp
tools/SeekRPC/gen-cpp/seek_rpc_types.cpp
tools/SeekRPC/gen-cpp/SeekRPC.cpp
)
list(APPEND TMP_LIBRARIES ${LIBTHRIFT})
else ()
list(APPEND ${TOOL}_SOURCES
tools/${TOOL}/cmdline.c
)
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tools/${TOOL}/${TOOL}.cpp)
list(APPEND ${TOOL}_SOURCES tools/${TOOL}/${TOOL}.cpp)
endif()
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tools/${TOOL}/${TOOL}Main.cpp)
message(STATUS "### Adding ${TOOL}Main.cpp")
list(APPEND ${TOOL}_SOURCES tools/${TOOL}/${TOOL}Main.cpp)
endif()
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tools/${TOOL}/stdafx.cpp)
list(APPEND ${TOOL}_SOURCES tools/${TOOL}/stdafx.cpp)
endif()
add_executable(${TOOL} ${${TOOL}_SOURCES})
endif ()
add_dependencies(${TOOL} sleipnir)
target_include_directories(${TOOL} PUBLIC ${EXTRA_INCLUDES})
target_link_libraries(${TOOL} sleipnir ${EXTRA_LIBRARIES} ${TMP_LIBRARIES} ${LIBOMP})
set(TMP_LIBRARIES "")
endforeach()
list(APPEND SINGLE_FILE_TOOLS
verifyMergedDBFiles
)
foreach(TOOL ${SINGLE_FILE_TOOLS})
add_executable(${TOOL} tools/${TOOL}.cpp)
add_dependencies(${TOOL} sleipnir)
target_include_directories(${TOOL} PUBLIC ${EXTRA_INCLUDES})
target_link_libraries(${TOOL} sleipnir ${EXTRA_LIBRARIES} ${LIBOMP})
endforeach()