generated from seqan/app-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
138 lines (114 loc) · 4.73 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
# ------------------------------------------------------------------------------------------------------------
# This is MaRs, Motif-based aligned RNA searcher.
# Copyright (c) 2020-2022 Jörg Winkler & Knut Reinert @ Freie Universität Berlin & MPI für molekulare Genetik.
# This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
# shipped with this file and also available at https://github.com/seqan/mars.
# ------------------------------------------------------------------------------------------------------------
cmake_minimum_required (VERSION 3.13)
## CUSTOMISE
# Define the application name and version.
project (mars VERSION 1.0.0)
## BUILD
# Make Release default build type
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Release CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo"
FORCE)
endif ()
# Specify the directories where to store the built archives, libraries and executables
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
# Messages
string (ASCII 27 Esc)
set (FontBold "${Esc}[1m")
set (FontReset "${Esc}[m")
# External dependencies
# Alternative for PkgConfig: https://dominikberner.ch/cmake-find-library/
include (FindPkgConfig)
pkg_check_modules (ViennaRNA RNAlib2)
find_library (GLPK glpk)
find_library (MPFR mpfr)
find_package (OpenMP)
find_package (Boost)
find_package (SeqAn3 QUIET REQUIRED HINTS lib/seqan3/build_system)
if (NOT ViennaRNA_FOUND)
include (ExternalProject)
ExternalProject_Add (
"ViennaRNA"
PREFIX "${CMAKE_CURRENT_BINARY_DIR}/ext/ViennaRNA"
LOG_DOWNLOAD 1
DOWNLOAD_NO_PROGRESS 1
TIMEOUT 240
URL https://github.com/ViennaRNA/ViennaRNA/releases/download/v2.4.17/ViennaRNA-2.4.17.tar.gz
URL_HASH MD5=530b5ce7caf0e7cf58535cad22265215
LOG_CONFIGURE 1
USES_TERMINAL_CONFIGURE 1
CONFIGURE_COMMAND <SOURCE_DIR>/configure CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER}
--prefix=<INSTALL_DIR> --without-swig --without-kinfold --disable-simd
--without-forester --without-rnalocmin --without-doc --without-tutorial
LOG_BUILD 1
USES_TERMINAL_BUILD 1
BUILD_IN_SOURCE 1
BUILD_COMMAND make -j
LOG_INSTALL 1
)
ExternalProject_Get_Property (ViennaRNA INSTALL_DIR)
endif()
set (DEPENDENCIES_FOUND TRUE)
# Provided dependencies.
add_library (Contrafold STATIC lib/ipknot/contrafold/SStruct.cpp lib/ipknot/contrafold/Utilities.cpp)
target_include_directories (Contrafold SYSTEM PUBLIC lib/ipknot/contrafold)
add_library (Nupack STATIC lib/ipknot/nupack/nupack.cpp)
target_include_directories (Nupack SYSTEM PUBLIC lib/ipknot/nupack)
if (Boost_FOUND)
target_include_directories (Nupack SYSTEM PUBLIC ${Boost_INCLUDE_DIRS})
else()
message (WARNING "Boost not found, but it is required for building.")
set (DEPENDENCIES_FOUND FALSE)
endif()
add_library (IPknot STATIC lib/ipknot/aln.cpp lib/ipknot/fold.cpp lib/ipknot/ip.cpp lib/ipknot/ipknot.cpp)
target_include_directories (IPknot SYSTEM PUBLIC lib/ipknot)
target_link_libraries (IPknot PUBLIC Contrafold Nupack)
target_compile_definitions (IPknot PRIVATE "-DHAVE_LIBRNA" PRIVATE "-DHAVE_VIENNA20")
target_compile_options(IPknot PRIVATE "-w")
if (ViennaRNA_FOUND)
target_include_directories (IPknot SYSTEM PUBLIC ${ViennaRNA_INCLUDE_DIRS})
target_link_libraries (IPknot PUBLIC ${ViennaRNA_LDFLAGS})
else ()
add_dependencies (IPknot ViennaRNA)
target_include_directories (IPknot SYSTEM PUBLIC ${INSTALL_DIR}/include)
target_link_libraries (IPknot PUBLIC ${INSTALL_DIR}/lib/libRNA.a)
endif ()
# GLPK is needed for IPknot.
if (GLPK)
target_compile_definitions (IPknot PRIVATE "-DWITH_GLPK")
target_link_libraries (IPknot PUBLIC ${GLPK})
else()
set (DEPENDENCIES_FOUND FALSE)
endif ()
# MPFR is needed for IPknot.
if (MPFR)
target_link_libraries (IPknot PUBLIC ${MPFR})
else()
set (DEPENDENCIES_FOUND FALSE)
endif ()
# OpenMP is needed for IPknot.
if (OpenMP_CXX_FOUND)
target_link_libraries (IPknot PUBLIC OpenMP::OpenMP_CXX)
else()
message (STATUS "OpenMP_CXX not found.")
set (DEPENDENCIES_FOUND FALSE)
endif ()
add_subdirectory (src)
if (DEPENDENCIES_FOUND)
message (STATUS "${FontBold}You can run `make` to build the application.${FontReset}")
else()
message (STATUS "At least one dependency is missing.")
endif ()
## DOCUMENTATION
add_subdirectory (doc EXCLUDE_FROM_ALL)
## TEST
enable_testing ()
add_subdirectory (test EXCLUDE_FROM_ALL)
message (STATUS "The current build type is ${CMAKE_BUILD_TYPE}.")