Debian Codegraph @

src/CMakeLists.txt

raw ◀ ▶
1 Debian patch touch this file
1 file(GLOB sources *.cpp)
2 file(GLOB headers *.h *.hpp)
3
4 list(REMOVE_ITEM sources main.cpp)
5
•6 if(!DEBIAN_BUILD)
7 if (USE_BAM)
8 include_directories(../ext/htslib)
9 endif(USE_BAM)
•10 endif()
11
12 if(NOT MAX_KMER_SIZE)
13 set(MAX_KMER_SIZE "32")
14 endif()
15
16 add_compile_options(-Wno-subobject-linkage) # Suppress bifrost warning
17
18 add_library(kallisto_core ${sources} ${headers})
19 target_include_directories(kallisto_core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
20
21 add_executable(kallisto main.cpp)
22
•23 if (DEBIAN_BUILD)
24 if(USE_BAM)
25 # Link system htslib for Debian builds
26 find_package(PkgConfig REQUIRED)
27 pkg_check_modules(HTSLIB htslib)
28 target_link_libraries(kallisto ${HTSLIB_LIBRARIES})
29 target_link_libraries(kallisto_core ${HTSLIB_LIBRARIES})
30 endif()
31 endif()
32
33 find_package( Threads REQUIRED )
34 ExternalProject_Get_Property(bifrost install_dir)
•35 if(!DEBIAN_BUILD)
36 if (USE_BAM)
37 target_link_libraries(kallisto kallisto_core pthread ${CMAKE_CURRENT_SOURCE_DIR}/../ext/htslib/libhts.a ${install_dir}/build/src/libbifrost.a -DMAX_KMER_SIZE=${MAX_KMER_SIZE})
38 else()
39 target_link_libraries(kallisto kallisto_core pthread ${install_dir}/build/src/libbifrost.a -DMAX_KMER_SIZE=${MAX_KMER_SIZE})
40 endif(USE_BAM)
•41 else()
42 # FIXME: once bifrost is accepted this should be linked against the Debian packaged library
43 target_link_libraries(kallisto kallisto_core pthread ${install_dir}/build/src/libbifrost.a)
44 endif()
45
46 if(LINK MATCHES static)
47 set(BUILD_SHARED_LIBS OFF)
48 set(HDF5_USE_STATIC_LIBRARIES 1)
49
50 if (UNIX AND NOT APPLE)
51 #set(CMAKE_EXE_LINKER_FLAGS "-static -static-libgcc -static-libstdc++")
52 set(CMAKE_EXE_LINKER_FLAGS "-static -static-libstdc++")
53 SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
54 set(CMAKE_EXE_LINKER_FLAGS "-static -static-libgcc -static-libstdc++")
55 endif(UNIX AND NOT APPLE)
56
57 SET_TARGET_PROPERTIES(kallisto kallisto_core PROPERTIES LINK_SEARCH_END_STATIC 1)
58 endif(LINK MATCHES static)
59
60
61 if(USE_HDF5)
62 find_package( HDF5 REQUIRED )
63 endif(USE_HDF5)
64
65 if (NOT ZLIBNG)
66 find_package( ZLIB REQUIRED )
67
68 if ( ZLIB_FOUND )
69 if (DEFINED ZLIB_INCLUDE_DIRS)
70 include_directories( ${ZLIB_INCLUDE_DIRS} )
71 elseif (DEFINED ZLIB_INCLUDE_DIR)
72 include_directories( ${ZLIB_INCLUDE_DIR} )
73 else()
74 message(FATAL_ERROR "zlib found but no include directories are set.")
75 endif()
76 target_link_libraries(kallisto kallisto_core ${ZLIB_LIBRARIES})
77 else()
78 message(FATAL_ERROR "zlib not found. Required for to output files" )
79 endif( ZLIB_FOUND )
80 endif(NOT ZLIBNG)
81
82 if (ZLIBNG)
83 add_definitions(-DKALLISTO_USE_ZLIB_NG)
84 include_directories(../ext/zlib-ng/zlib-ng)
85 include_directories(../ext/zlib-ng)
86 if(WIN32)
87 target_link_libraries(kallisto ${CMAKE_CURRENT_SOURCE_DIR}/../ext/zlib-ng/zlib-ng/libz.lib)
88 else()
89 target_link_libraries(kallisto ${CMAKE_CURRENT_SOURCE_DIR}/../ext/zlib-ng/zlib-ng/libz.a)
90 endif(WIN32)
91 endif(ZLIBNG)
92
93 if(USE_HDF5)
94 if(HDF5_FOUND)
95 include_directories( ${HDF5_INCLUDE_DIRS} )
96 target_link_libraries( kallisto_core ${HDF5_LIBRARIES} )
97 target_link_libraries( kallisto ${HDF5_LIBRARIES} )
98 else()
99 message(FATAL_ERROR "HDF5 not found. Required to output files")
100 endif()
101 endif(USE_HDF5)
102
103 if(LINK MATCHES static)
104 if (UNIX AND NOT APPLE)
105 target_link_libraries(kallisto librt.a)
106 endif()
107 else()
108 if (UNIX AND NOT APPLE)
109 target_link_libraries(kallisto rt)
110 endif()
111 endif(LINK MATCHES static)
112
113
•114 #install(TARGETS kallisto DESTINATION "${CMAKE_INSTALL_BINDIR}")