File: using_htslib_from_component.patch

package info (click to toggle)
genomicsdb 1.4.4-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 24,788 kB
  • sloc: cpp: 78,988; ansic: 58,119; java: 8,531; python: 2,270; sh: 1,850; perl: 1,621; makefile: 490; xml: 455
file content (176 lines) | stat: -rw-r--r-- 8,170 bytes parent folder | download
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
Description: genomicsdb needs a fork of htslib, which is too different from the
 Debian-packaged one. We provide it as a component.
Author: Pierre Gruet <pgt@debian.org>
Forwarded: not-needed
Last-Update: 2022-07-26

--- a/cmake/Modules/Findhtslib.cmake
+++ /dev/null
@@ -1,100 +0,0 @@
-#
-# FindTileDB.cmake
-#
-# The MIT License
-#
-# Copyright (c) 2020-2021 Omics Data Automation, Inc.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-# Determine compiler flags for htslib
-# Once done this will define
-# HTSLIB_FOUND - htslib found
-
-include(FindPackageHandleStandardArgs)
-
-# Update git submodule if necessary
-if((DEFINED HTSLIB_SOURCE_DIR) AND (NOT "${HTSLIB_SOURCE_DIR}" STREQUAL "") AND (NOT EXISTS "${HTSLIB_SOURCE_DIR}/htslib/vcf.h"))
-  MESSAGE(STATUS "Installing submodule htslib at ${CMAKE_SOURCE_DIR}/dependencies")
-  execute_process(
-    COMMAND git submodule update --init ${CMAKE_SOURCE_DIR}/dependencies/htslib
-    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
-    RESULT_VARIABLE submodule_update_exit_code)
-  if(NOT(submodule_update_exit_code EQUAL 0))
-    message(FATAL_ERROR "Failure to update git submodule htslib")
-  endif()
-  set(HTSLIB_SOURCE_DIR "${CMAKE_SOURCE_DIR}/dependencies/htslib" CACHE PATH "Path to htslib source directory" FORCE)
-endif()
-
-#Build if htslib source directory specified
-if(HTSLIB_SOURCE_DIR)
-    set(HTSLIB_Debug_CFLAGS " -Wall -fPIC -DDEBUG  -g3 -gdwarf-3 -DVCF_ALLOW_INT64=1")  #will be picked if compiling in debug mode
-    if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
-        set(HTSLIB_Debug_CFLAGS "${HTSLIB_Debug_CFLAGS} -Wno-expansion-to-defined -Wno-nullability-completeness")
-    endif()
-    set(HTSLIB_Coverage_CFLAGS "${HTSLIB_Debug_CFLAGS}")
-    set(HTSLIB_Release_CFLAGS " -Wall -fPIC -O3 -DVCF_ALLOW_INT64=1")
-    if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
-      set(HTSLIB_Release_CFLAGS "${HTSLIB_Release_CFLAGS} -Wno-expansion-to-defined -Wno-nullability-completeness")
-    endif()
-    if(APPLE)
-      set(HTSLIB_LDFLAGS " -L /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lSystem")
-    endif()
-    set(HTSLIB_Debug_LDFLAGS "-g3 -gdwarf-3 ${HTSLIB_LDFLAGS}")
-    set(HTSLIB_Coverage_LDFLAGS "${HTSLIB_Debug_LDFLAGS}")
-    set(HTSLIB_Release_LDFLAGS "${HTSLIB_LDFLAGS}")
-    include(ExternalProject)
-    #Cross compiling for MacOSX
-    if((NOT (CMAKE_SYSTEM_NAME STREQUAL CMAKE_HOST_SYSTEM_NAME)) AND APPLE)
-        set(HTSLIB_OSXCROSS_COMPILE_FLAGS LIBS=${OSXCROSS_LIBS} CPPFLAGS=${OSXCROSS_CPPFLAGS} --host=${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_SYSTEM})
-    endif()
-    set(HTSLIB_${CMAKE_BUILD_TYPE}_CFLAGS "${HTSLIB_${CMAKE_BUILD_TYPE}_CFLAGS} -I${OPENSSL_INCLUDE_DIR} -I${CURL_INCLUDE_DIRS}")
-    if(APPLE AND BUILD_DISTRIBUTABLE_LIBRARY)
-      set(HTSLIB_ENV "MACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}")
-    endif()
-    ExternalProject_Add(
-        htslib
-        DOWNLOAD_COMMAND ""
-        SOURCE_DIR "${HTSLIB_SOURCE_DIR}"
-        UPDATE_COMMAND autoreconf -i ${HTSLIB_SOURCE_DIR}
-        PATCH_COMMAND ""
-        CONFIGURE_COMMAND ${HTSLIB_ENV} ${HTSLIB_SOURCE_DIR}/configure
-            CFLAGS=${HTSLIB_${CMAKE_BUILD_TYPE}_CFLAGS}
-            LDFLAGS=${HTSLIB_${CMAKE_BUILD_TYPE}_LDFLAGS}
-            CC=${CMAKE_C_COMPILER} AR=${CMAKE_AR} RANLIB=${CMAKE_RANLIB}
-            ${HTSLIB_OSXCROSS_COMPILE_FLAGS}
-            --disable-lzma --disable-bz2 --disable-s3 --disable-gcs
-        BUILD_COMMAND ${CMAKE_COMMAND} -E make_directory cram
-            COMMAND ${CMAKE_COMMAND} -E make_directory test
-            COMMAND ${CMAKE_COMMAND} -E make_directory test/fuzz
-            COMMAND ${CMAKE_COMMAND} -E copy ${HTSLIB_SOURCE_DIR}/version.sh .
-            COMMAND ${HTSLIB_ENV} $(MAKE) -f ${HTSLIB_SOURCE_DIR}/Makefile VPATH=${HTSLIB_SOURCE_DIR} SOURCE_DIR=${HTSLIB_SOURCE_DIR} AR=${CMAKE_AR}
-        #BUILD_IN_SOURCE 1
-        INSTALL_COMMAND ""
-        )
-    find_path(HTSLIB_INCLUDE_DIR NAMES htslib/vcf.h HINTS "${HTSLIB_SOURCE_DIR}" CMAKE_FIND_ROOT_PATH_BOTH NO_DEFAULT_PATH)
-    ExternalProject_Get_Property(htslib BINARY_DIR)
-    set(HTSLIB_DIR_IN_BUILD_DIR "${BINARY_DIR}")
-    set(HTSLIB_LIBRARY "${BINARY_DIR}/libhts.a")
-    find_package_handle_standard_args(htslib "Could not find htslib headers ${DEFAULT_MSG}" HTSLIB_INCLUDE_DIR)
-else()
-    find_path(HTSLIB_INCLUDE_DIR NAMES htslib/vcf.h HINTS "${HTSLIB_INSTALL_DIR}")
-    find_library(HTSLIB_LIBRARY NAMES libhts.a hts HINTS "${HTSLIB_INSTALL_DIR}")
-    find_package_handle_standard_args(htslib "Could not find htslib headers and/or libraries ${DEFAULT_MSG}" HTSLIB_INCLUDE_DIR HTSLIB_LIBRARY)
-endif()
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,6 +41,11 @@
 #set(FMT_ROOT_DIR "${SPDLOG_INCLUDE_DIR}" CACHE PATH "Path to fmt library")
 set(USING_FMT_BUNDLED_WITH_SPDLOG False CACHE BOOL "Disable if using fmt library that's not bundled with spdlog")
 
+# add the genomicsdb-htslib bundled as a component
+add_subdirectory(genomicsdb-htslib)
+set(HTSLIB genomicsdb-hts)
+include_directories(${CMAKE_SOURCE_DIR}/genomicsdb-htslib)
+
 #GIT_COMMIT_HASH derived from git tag to be used as part of GENOMICSDB_VERSION
 execute_process(
     COMMAND git log -1 --format=%h
@@ -60,8 +65,6 @@
 option(DISABLE_MPI "Disable use of any MPI compiler/libraries")
 option(DISABLE_OPENMP "Disable OpenMP")
 
-set(HTSLIB_INSTALL_DIR "" CACHE PATH "Path to htslib install directory")
-
 #Sync the GENOMICSDB_PROTOBUF_VERSION with protobuf.version in pom.xml!
 set(GENOMICSDB_PROTOBUF_VERSION "3.19.4" CACHE STRING "Version of Google Protocol Buffer library")
 set(PROTOBUF_ROOT_DIR "$ENV{HOME}/protobuf-install/${GENOMICSDB_PROTOBUF_VERSION}" CACHE PATH "Path to installed protobuf")
@@ -210,10 +213,6 @@
 find_package(Spdlog REQUIRED)
 include_directories(${SPDLOG_INCLUDE_DIR})
 
-#htslib
-find_package(htslib REQUIRED)
-include_directories(BEFORE ${HTSLIB_INCLUDE_DIR})
-
 #TileDB
 find_package(TileDB REQUIRED)
 include_directories(${TILEDB_INCLUDE_DIR})
@@ -332,10 +331,6 @@
     add_custom_target(clean-TileDB ${CMAKE_COMMAND} -E remove_directory ${TILEDB_DIR_IN_BUILD_DIR})
     add_dependencies(clean-all clean-TileDB)
 endif()
-if(HTSLIB_SOURCE_DIR)
-    add_custom_target(clean-htslib ${CMAKE_COMMAND} -E remove_directory ${HTSLIB_DIR_IN_BUILD_DIR})
-    add_dependencies(clean-all clean-htslib)
-endif()
 
 #Uninstall GenomicsDB
 add_custom_target(
@@ -401,10 +396,7 @@
     else()
         target_link_libraries(${target} ${TILEDB_LIBRARY})
     endif()
-    if(HTSLIB_SOURCE_DIR)
-        add_dependencies(${target} htslib)
-    endif()
-    target_link_libraries(${target} ${HTSLIB_LIBRARY})
+    target_link_libraries(${target} ${HTSLIB})
     if(LIBCSV_FOUND)
         target_link_libraries(${target} ${LIBCSV_LIBRARY})
     endif()
--- a/src/main/CMakeLists.txt
+++ b/src/main/CMakeLists.txt
@@ -115,6 +115,7 @@
     add_dependencies(tiledbgenomicsdb htslib)
 endif()
 target_link_libraries(tiledbgenomicsdb ${HTSLIB_LIBRARY} ${GENOMICSDB_EXTERNAL_DEPENDENCIES_LIBRARIES})
+target_link_libraries(tiledbgenomicsdb genomicsdb-hts)
 if(LIBRT_LIBRARY)
     target_link_libraries(tiledbgenomicsdb ${LIBRT_LIBRARY})
 endif()