Debian Codegraph @

debian/patches/use_debian_packaged_htslib.patch

raw symbols SCIP
1 Author: Andreas Tille <[email protected]>
2 Last-Update: Thu, 21 Mar 2019 15:53:04 +0100
3 Description: Adapt build system to Debian packaged libhts
4
5 --- a/CMakeLists.txt
6 +++ b/CMakeLists.txt
7 @@ -71,8 +71,17 @@ ELSE(LINK MATCHES shared)
8 message("shared build")
9 ENDIF(LINK MATCHES static)
10
11 -
12 include(ExternalProject)
13 +ExternalProject_Add(bifrost
14 + PREFIX ${PROJECT_SOURCE_DIR}/ext/bifrost
15 + SOURCE_DIR ${PROJECT_SOURCE_DIR}/ext/bifrost
16 + BUILD_IN_SOURCE 1
17 + CONFIGURE_COMMAND mkdir -p build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=${PREFIX} -DCMAKE_CXX_FLAGS=${PROJECT_BIFROST_CMAKE_CXX_FLAGS}
18 + BUILD_COMMAND cd build && make
19 + INSTALL_COMMAND ""
20 +)
21 +
22 +if(!DEBIAN_BUILD)
23 if (USE_BAM)
24 ExternalProject_Add(htslib
25 PREFIX ${PROJECT_SOURCE_DIR}/ext/htslib
26 @@ -107,15 +116,24 @@ if (ZLIBNG)
27 endif(ZLIBNG)
28
29 if (USE_BAM)
30 -include_directories(${htslib_PREFIX}/src/htslib)
31 + if(DEBIAN_BUILD)
32 + # For Debian builds, use system htslib
33 + find_package(PkgConfig REQUIRED)
34 + pkg_check_modules(HTSLIB REQUIRED htslib)
35 + include_directories(${HTSLIB_INCLUDE_DIRS})
36 + link_libraries(${HTSLIB_LIBRARIES})
37 + else()
38 + # For non-Debian builds, use bundled htslib
39 + include_directories(${htslib_PREFIX}/src/htslib)
40 + endif()
41 endif(USE_BAM)
42 +endif()
43 include_directories(${EXT_PROJECTS_DIR}/bifrost/build/src)
44
45 ExternalProject_Get_Property(bifrost install_dir)
46 include_directories(${install_dir}/src)
47
48
49 -
50 # add_compile_options(-Wdeprecated-register)
51
52 add_subdirectory(src)
53 --- a/src/CMakeLists.txt
54 +++ b/src/CMakeLists.txt
55 @@ -3,9 +3,11 @@ file(GLOB headers *.h *.hpp)
56
57 list(REMOVE_ITEM sources main.cpp)
58
59 +if(!DEBIAN_BUILD)
60 if (USE_BAM)
61 include_directories(../ext/htslib)
62 endif(USE_BAM)
63 +endif()
64
65 if(NOT MAX_KMER_SIZE)
66 set(MAX_KMER_SIZE "32")
67 @@ -18,13 +20,28 @@ target_include_directories(kallisto_core
68
69 add_executable(kallisto main.cpp)
70
71 +if (DEBIAN_BUILD)
72 + if(USE_BAM)
73 + # Link system htslib for Debian builds
74 + find_package(PkgConfig REQUIRED)
75 + pkg_check_modules(HTSLIB htslib)
76 + target_link_libraries(kallisto ${HTSLIB_LIBRARIES})
77 + target_link_libraries(kallisto_core ${HTSLIB_LIBRARIES})
78 + endif()
79 +endif()
80 +
81 find_package( Threads REQUIRED )
82 ExternalProject_Get_Property(bifrost install_dir)
83 +if(!DEBIAN_BUILD)
84 if (USE_BAM)
85 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})
86 else()
87 target_link_libraries(kallisto kallisto_core pthread ${install_dir}/build/src/libbifrost.a -DMAX_KMER_SIZE=${MAX_KMER_SIZE})
88 endif(USE_BAM)
89 +else()
90 +# FIXME: once bifrost is accepted this should be linked against the Debian packaged library
91 +target_link_libraries(kallisto kallisto_core pthread ${install_dir}/build/src/libbifrost.a)
92 +endif()
93
94 if(LINK MATCHES static)
95 set(BUILD_SHARED_LIBS OFF)
96 @@ -94,4 +111,4 @@ else()
97 endif(LINK MATCHES static)
98
99
100 -install(TARGETS kallisto DESTINATION "${CMAKE_INSTALL_BINDIR}")
101 +#install(TARGETS kallisto DESTINATION "${CMAKE_INSTALL_BINDIR}")