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