-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
90 lines (80 loc) · 3.23 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
cmake_minimum_required(VERSION 3.4)
include(CheckCXXSourceCompiles)
project(CoCo)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1")
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
add_definitions("-DGIT_SHA1=${GIT_SHA1}")
include_directories(lib/kseq)
include_directories(lib/kmer-cnt)
set(coco_source_files ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp)
list (APPEND KSIZE_DEFAULT_LIST 64)
SET (GATB_CORE_EXCLUDE_TOOLS 1)
SET (GATB_CORE_EXCLUDE_TESTS 1)
SET (GATB_CORE_EXCLUDE_EXAMPLES 1)
add_subdirectory(lib/gatb-core/gatb-core)
add_subdirectory(src)
add_definitions (${gatb-core-flags})
include_directories (${gatb-core-includes})
link_directories (${gatb-core-extra-libraries-path})
set_target_properties(gatbcore-static PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS} -w" LINK_FLAGS "${CMAKE_CXX_FLAGS} -w")
add_executable(coco ${coco_source_files} ${coco_header_files})
target_link_libraries (coco ${gatb-core-libraries})
find_package(ZLIB QUIET)
if (ZLIB_FOUND)
message("-- Found ZLIB")
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(OLD_CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES})
set(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
set(CMAKE_REQUIRED_FLAGS -lz)
set(CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARIES})
check_cxx_source_compiles("
#include <zlib.h>
int main() { gzFile file; return 0; }"
HAVE_ZLIB_CHECK)
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_INCLUDES ${OLD_CMAKE_REQUIRED_INCLUDES})
set(CMAKE_REQUIRED_LIBRARIES ${OLD_CMAKE_REQUIRED_LIBRARIES})
if(HAVE_ZLIB_CHECK)
message("-- ZLIB works")
target_include_directories(coco PUBLIC ${ZLIB_INCLUDE_DIRS})
target_compile_definitions(coco PUBLIC -DHAVE_ZLIB=1)
target_link_libraries(coco ${ZLIB_LIBRARIES})
else ()
message("-- ZLIB does not work")
endif()
else ()
message("-- Could not find ZLIB")
endif ()
find_package(BZip2 QUIET)
if (BZIP2_FOUND)
message("-- Found BZLIB")
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(OLD_CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES})
set(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
set(CMAKE_REQUIRED_FLAGS -lbz2)
set(CMAKE_REQUIRED_INCLUDES ${BZIP_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${BZIP2_LIBRARIES})
check_cxx_source_compiles("
#include <bzlib.h>
int main() { bz_stream stream; return 0; }"
HAVE_BZLIB_CHECK)
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_INCLUDES ${OLD_CMAKE_REQUIRED_INCLUDES})
set(CMAKE_REQUIRED_LIBRARIES ${OLD_CMAKE_REQUIRED_LIBRARIES})
if(HAVE_BZLIB_CHECK)
message("-- BZLIB works")
target_include_directories(coco PUBLIC ${BZIP_INCLUDE_DIRS})
target_compile_definitions(coco PUBLIC -DHAVE_BZLIB=1)
target_link_libraries(coco ${BZIP2_LIBRARIES})
else ()
message("-- BZLIB does not work")
endif()
else ()
message("-- Could not find BZLIB")
endif ()