-
Notifications
You must be signed in to change notification settings - Fork 14
/
CMakeLists.txt
187 lines (162 loc) · 8.47 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
cmake_minimum_required(VERSION 3.12) # required by hunter ZLIB installation
# include hunter
option(HUNTER_STATUS_DEBUG "Hunter debug" OFF) # comment if does not want hunter debug on
set(HUNTER_ROOT ${CMAKE_BINARY_DIR}/hunter)
include("cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/v0.23.289.tar.gz"
SHA1 "7d7323704780200a1575fc089d26f8a8a393a1fa"
LOCAL
)
# project configuration
set(PROJECT_NAME_STR pandora)
project(${PROJECT_NAME_STR} VERSION "0.12.0" LANGUAGES C CXX)
set(ADDITIONAL_VERSION_LABELS "")
configure_file( include/version.h.in ${CMAKE_BINARY_DIR}/include/version.h )
# C++14 required
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
if (COMPILER_SUPPORTS_CXX14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
else ()
message(FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER} has no C++14 support")
endif ()
# default flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_SYSTEM_NO_DEPRECATED -Wall -Wextra")
# compile with openmp only on Linux
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(MACOSX TRUE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNO_OPENMP")
else ()
find_package(OpenMP 4.0 REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
endif()
# always link rt
set(RT_LIBRARY "rt")
if(NOT BIOCONDA)
# static C and C++ flags
set(STATIC_C_CXX "-static-libgcc -static-libstdc++")
endif()
########################################################################################################################
# EXTERNAL LIBS INSTALLATION
########################################################################################################################
########################################################################################################################
# INSTALL ZLIB
hunter_add_package(ZLIB)
find_package(ZLIB 1.2.11 REQUIRED)
set(ZLIB_LIBRARY ZLIB::ZLIB)
########################################################################################################################
########################################################################################################################
# INSTALL libarchive
SET(ENABLE_TAR OFF CACHE BOOL "Enable tar building" FORCE)
SET(ENABLE_CPIO OFF CACHE BOOL "Enable cpio building" FORCE)
SET(ENABLE_CAT OFF CACHE BOOL "Enable cat building" FORCE)
SET(ENABLE_XATTR OFF CACHE BOOL "Enable extended attribute support" FORCE)
SET(ENABLE_ACL OFF CACHE BOOL "Enable ACL support" FORCE)
SET(ENABLE_ICONV OFF CACHE BOOL "Enable iconv support" FORCE)
SET(ENABLE_TEST OFF CACHE BOOL "Enable unit and regression tests" FORCE)
SET(ENABLE_WERROR OFF CACHE BOOL "Treat warnings as errors - default is ON for Debug, OFF otherwise." FORCE)
add_subdirectory(thirdparty/libarchive)
set(LIBARCHIVE_LIBRARY archive_static)
########################################################################################################################
########################################################################################################################
# INSTALL libzip
SET(ENABLE_COMMONCRYPTO OFF CACHE BOOL "Enable use of CommonCrypto" FORCE)
SET(ENABLE_GNUTLS OFF CACHE BOOL "Enable use of GnuTLS" FORCE)
SET(ENABLE_MBEDTLS OFF CACHE BOOL "Enable use of mbed TLS" FORCE)
SET(ENABLE_OPENSSL OFF CACHE BOOL "Enable use of OpenSSL" FORCE)
SET(ENABLE_WINDOWS_CRYPTO OFF CACHE BOOL "Enable use of Windows cryptography libraries" FORCE)
SET(ENABLE_BZIP2 OFF CACHE BOOL "Enable use of BZip2" FORCE)
SET(ENABLE_LZMA OFF CACHE BOOL "Enable use of LZMA" FORCE)
SET(ENABLE_ZSTD ON CACHE BOOL "Enable use of Zstandard" FORCE)
SET(BUILD_TOOLS OFF CACHE BOOL "Build tools in the src directory (zipcmp, zipmerge, ziptool)" FORCE)
SET(BUILD_REGRESS OFF CACHE BOOL "Build regression tests" FORCE)
SET(BUILD_EXAMPLES OFF CACHE BOOL "Build examples" FORCE)
SET(BUILD_DOC OFF CACHE BOOL "Build documentation" FORCE)
SET(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries" FORCE)
SET(LIBZIP_DO_INSTALL OFF CACHE BOOL "Install libzip and the related files" FORCE)
SET(SHARED_LIB_VERSIONNING OFF CACHE BOOL "Add SO version in .so build" FORCE)
add_subdirectory(thirdparty/libzip)
set(LIBZIP_LIBRARY libzip::zip)
########################################################################################################################
########################################################################################################################
# CUSTOM CONFIG MINIMAP2
file(REMOVE_RECURSE ${PROJECT_SOURCE_DIR}/thirdparty/minimap2/lib)
########################################################################################################################
########################################################################################################################
# INSTALL Racon
add_subdirectory(thirdparty/racon)
set(RACON_LIBRARY racon)
########################################################################################################################
########################################################################################################################
# INSTALL GTEST
hunter_add_package(GTest)
find_package(GTest CONFIG REQUIRED)
set(Gtest_LIBRARIES GTest::gtest GTest::gmock_main)
########################################################################################################################
########################################################################################################################
# INSTALL BOOST
set(Boost_USE_STATIC_LIBS ON)
hunter_add_package(Boost COMPONENTS filesystem iostreams log serialization system thread)
find_package(Boost CONFIG REQUIRED filesystem iostreams log serialization system thread)
set(Boost_LIBRARIES Boost::filesystem Boost::iostreams Boost::log Boost::serialization Boost::system Boost::thread)
########################################################################################################################
########################################################################################################################
# END EXTERNAL LIBS INSTALLATION
########################################################################################################################
########################################################################################################################
# PANDORA INSTALLATION
########################################################################################################################
# allows Seqan to be found
list(APPEND CMAKE_PREFIX_PATH "${PROJECT_SOURCE_DIR}/thirdparty/seqan/util/cmake")
set(SEQAN_INCLUDE_PATH "${PROJECT_SOURCE_DIR}/thirdparty/seqan/include")
# Load the SeqAn module and fail if not found
find_package (SeqAn REQUIRED)
#include directories as SYSTEM includes, thus warnings will be ignored for these
include_directories(SYSTEM
${CMAKE_BINARY_DIR}/include
${PROJECT_SOURCE_DIR}/thirdparty/cgranges/cpp
${SEQAN_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/thirdparty/minimap2/
${PROJECT_SOURCE_DIR}/thirdparty/libzip/lib
${PROJECT_SOURCE_DIR}/thirdparty/libarchive/libarchive
)
# normal includes: warnings will be reported for these
include_directories(
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/thirdparty/include
${PROJECT_SOURCE_DIR}/thirdparty/src
${PROJECT_SOURCE_DIR}/thirdparty/racon/src
)
# Add definitions set by find_package (SeqAn).
add_definitions (${SEQAN_DEFINITIONS})
file(GLOB_RECURSE SRC_FILES
${PROJECT_SOURCE_DIR}/src/*.cpp
${PROJECT_SOURCE_DIR}/src/*/*.cpp
${PROJECT_SOURCE_DIR}/include/*/*.cpp
${PROJECT_SOURCE_DIR}/include/*.hpp
${PROJECT_SOURCE_DIR}/include/*.h
${PROJECT_SOURCE_DIR}/include/*/*.hpp
${PROJECT_SOURCE_DIR}/include/*/*.h
${PROJECT_SOURCE_DIR}/thirdparty/src/*.cpp
${PROJECT_SOURCE_DIR}/thirdparty/include/*.hpp
${PROJECT_SOURCE_DIR}/thirdparty/include/*.h
${PROJECT_SOURCE_DIR}/thirdparty/minimap2/*.c
)
list(REMOVE_ITEM SRC_FILES ${PROJECT_SOURCE_DIR}/thirdparty/minimap2/main.c ${PROJECT_SOURCE_DIR}/thirdparty/minimap2/example.c)
add_executable(${PROJECT_NAME} ${SRC_FILES})
target_link_libraries(${PROJECT_NAME}
${LIBARCHIVE_LIBRARY}
${LIBZIP_LIBRARY}
${RACON_LIBRARY}
${Boost_LIBRARIES}
${ZLIB_LIBRARY}
${CMAKE_DL_LIBS}
${STATIC_C_CXX}
${SEQAN_LIBRARIES}
${RT_LIBRARY}
)
# enable_testing()
# add_subdirectory(test)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)