about summary refs log tree commit diff
path: root/vcflib-use-system-fastahack-smithwaterman.patch
blob: 91f372c158a05af1cad4d9c4201095a9b0e2d96c (plain)
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
diff --git a/CMakeLists.txt b/CMakeLists.txt
index af3fe67..f237563 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -63,8 +63,10 @@ set_package_properties(ZLIB PROPERTIES TYPE REQUIRED)
 find_package(Threads)
 set_package_properties(Threads PROPERTIES TYPE REQUIRED)
 
-pkg_check_modules(htslib IMPORTED_TARGET htslib)   # Optionally builds from contrib/
-pkg_check_modules(tabixpp IMPORTED_TARGET tabixpp) # Optionally builds from contrib/
+pkg_check_modules(htslib IMPORTED_TARGET htslib)           # Optionally builds from contrib/
+pkg_check_modules(tabixpp IMPORTED_TARGET tabixpp)         # Optionally builds from contrib/
+pkg_check_modules(fastahack IMPORTED_TARGET fastahack)     # Optionally builds from contrib/
+pkg_check_modules(smithwaterman IMPORTED_TARGET smithwaterman) # Optionally builds from contrib/
 
 # ---- Build switches
 set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ${ipo_supported})
@@ -113,12 +115,20 @@ endif(ZIG)
 # ---- Include files
 
 include_directories(include)
-include_directories(contrib/fastahack)
 include_directories(contrib/intervaltree)
-include_directories(contrib/smithwaterman)
 include_directories(contrib/filevercmp)
 include_directories(contrib/c-progress-bar)
 
+if(NOT fastahack_FOUND)
+  message(STATUS "Using included fastahack")
+  include_directories(contrib/fastahack)
+endif()
+
+if(NOT smithwaterman_FOUND)
+  message(STATUS "Using included smithwaterman")
+  include_directories(contrib/smithwaterman)
+endif()
+
 if(NOT htslib_FOUND)
   message(STATUS "Using included htslib")
   include(FindCURL) # for htslib
@@ -142,11 +152,19 @@ endif()
 file(GLOB INCLUDES
   src/*.h*
   contrib/intervaltree/*.h*
-  contrib/smithwaterman/*.h*
-  contrib/fastahack/*.h*
   contrib/filevercmp/*.h*
   )
 
+if(NOT fastahack_FOUND)
+  file(GLOB FASTAHACK_INCLUDES contrib/fastahack/*.h*)
+  list(APPEND INCLUDES ${FASTAHACK_INCLUDES})
+endif()
+
+if(NOT smithwaterman_FOUND)
+  file(GLOB SW_INCLUDES contrib/smithwaterman/*.h*)
+  list(APPEND INCLUDES ${SW_INCLUDES})
+endif()
+
 set(vcfwfa_SOURCE
     src/legacy.cpp # introduces a WFA dependency
     src/vcf-wfa.cpp
@@ -170,16 +188,24 @@ set(vcflib_SOURCE
     src/LeftAlign.cpp
     src/cigar.cpp
     src/allele.cpp
-    contrib/fastahack/Fasta.cpp
+    contrib/fsom/fsom.c
+    contrib/filevercmp/filevercmp.c
+    contrib/c-progress-bar/progress.c
+)
+
+if(NOT fastahack_FOUND)
+  list(APPEND vcflib_SOURCE contrib/fastahack/Fasta.cpp)
+endif()
+
+if(NOT smithwaterman_FOUND)
+  list(APPEND vcflib_SOURCE
     contrib/smithwaterman/SmithWatermanGotoh.cpp
     contrib/smithwaterman/Repeats.cpp
     contrib/smithwaterman/IndelAllele.cpp
     contrib/smithwaterman/disorder.cpp
     contrib/smithwaterman/LeftAlign.cpp
-    contrib/fsom/fsom.c
-    contrib/filevercmp/filevercmp.c
-    contrib/c-progress-bar/progress.c
-)
+  )
+endif()
 
 if (tabixpp_LOCAL) # add the tabixpp source file
     list(APPEND vcflib_SOURCE ${tabixpp_SOURCE})
@@ -440,6 +466,14 @@ if (NOT tabixpp_LOCAL)
   target_link_libraries(vcflib PkgConfig::tabixpp)
 endif()
 
+if(fastahack_FOUND)
+  target_link_libraries(vcflib PkgConfig::fastahack)
+endif()
+
+if(smithwaterman_FOUND)
+  target_link_libraries(vcflib PkgConfig::smithwaterman)
+endif()
+
 if(OPENMP)
   target_link_libraries(vcflib OpenMP::OpenMP_CXX)
 endif()