forked from freebayes/freebayes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
263 lines (240 loc) · 8.69 KB
/
meson.build
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# Meson build definition
#
# meson --buildtype [debug|release] [--default-library static] build/
# meson test -C build /
#
# Meson builds with locally installed htslib, vcflib, tabixpp and seqlib.
# If one is missing it should pick up the sources from git submodules.
#
# to compile htslib with local sources use
#
# meson build -Dprefer_system_deps=false
#
# to build static binary for release
#
# meson build -Dstatic=true -Dprefer_system_deps=false --buildtype release
project('freebayes', ['cpp', 'c'],
version : '1.3.6',
default_options : ['warning_level=1', 'cpp_std=c++14', 'optimization=3'])
static_build = get_option('static')
cc = meson.get_compiler('cpp')
zlib_dep = dependency('zlib', static: static_build)
lzma_dep = dependency('liblzma', static: static_build)
thread_dep = dependency('threads', static: static_build)
tabixpp_dep = cc.find_library('tabixpp', required: false, static: static_build)
# to compile htslib use
# meson build -Dprefer_system_deps=false
# otherwise it tries to pick up the local system libs
if get_option('prefer_system_deps')
htslib_dep = dependency('htslib', static: static_build, required: false)
tabixpp_dep = cc.find_library('tabixpp', static: static_build, required: false)
vcflib_dep = dependency('libvcflib', static: static_build, required: false)
seqlib_dep = dependency('libseqlib', static: static_build, required: false)
else
# uses the local git submodules
htslib_dep = dependency('', required : false)
tabixpp_dep = dependency('', required : false)
vcflib_dep = dependency('', required : false)
seqlib_dep = dependency('', required : false)
endif
# for setting a warning_level on the external code in custom_* targets below
warn_quiet = ['warning_level=0']
# optionally build from source
# note that the build version adds support for lzma and bzip2 in CRAM
if not htslib_dep.found()
htslib_inc = include_directories(
'contrib/htslib',
'contrib/htslib_config',
'contrib/htslib/cram',
)
htslib_src = files(
'contrib/htslib/tbx.c', # used by vcflib
'contrib/htslib/bgzf.c',
'contrib/htslib/sam.c',
'contrib/htslib/hts.c',
'contrib/htslib/hfile.c',
# 'contrib/htslib/hfile_net.c',
# 'contrib/htslib/knetfile.c',
'contrib/htslib/textutils.c',
'contrib/htslib/thread_pool.c',
'contrib/htslib/region.c',
'contrib/htslib/hts_os.c',
'contrib/htslib/cram/cram_index.c',
'contrib/htslib/cram/cram_io.c',
# the older 'contrib/htslib/cram/sam_header.c', was renamed to
'contrib/htslib/header.c',
'contrib/htslib/cram/pooled_alloc.c',
'contrib/htslib/cram/string_alloc.c',
'contrib/htslib/md5.c',
'contrib/htslib/cram/cram_encode.c',
'contrib/htslib/cram/cram_stats.c',
'contrib/htslib/cram/cram_codecs.c',
'contrib/htslib/cram/cram_decode.c',
# 'contrib/htslib/cram/cram_samtools.c',
'contrib/htslib/kstring.c',
'contrib/htslib/cram/cram_external.c',
# 'contrib/htslib/cram/files.c',
'contrib/htslib/cram/mFILE.c',
'contrib/htslib/faidx.c',
'contrib/htslib/hts_expr.c',
'contrib/htslib/htscodecs/htscodecs/rANS_static.c',
'contrib/htslib/htscodecs/htscodecs/arith_dynamic.c',
'contrib/htslib/htscodecs/htscodecs/fqzcomp_qual.c',
'contrib/htslib/htscodecs/htscodecs/htscodecs.c',
'contrib/htslib/htscodecs/htscodecs/rANS_static.c',
'contrib/htslib/htscodecs/htscodecs/tokenise_name3.c',
'contrib/htslib/cram/open_trace_file.c',
'contrib/htslib/multipart.c',
'contrib/htslib/htscodecs/htscodecs/rANS_static4x16pr.c',
'contrib/htslib/htscodecs/htscodecs/pack.c',
'contrib/htslib/htscodecs/htscodecs/rle.c',
)
htslib_lib = static_library('custom_htslib',
htslib_src,
include_directories : htslib_inc,
override_options : warn_quiet)
htslib_dep = declare_dependency(link_with : htslib_lib,
include_directories : htslib_inc)
else
htslib_inc = []
endif
if not tabixpp_dep.found()
tabixpp_inc = include_directories('vcflib/tabixpp')
tabixpp_src = files('vcflib/tabixpp/tabix.cpp')
tabixpp_lib = static_library('custom_tabixpp',
tabixpp_src,
include_directories : [tabixpp_inc, htslib_inc],
override_options : warn_quiet)
tabixpp_dep = declare_dependency(link_with : tabixpp_lib,
include_directories : tabixpp_inc)
else
tabixpp_inc = []
endif
if not vcflib_dep.found()
vcflib_inc = include_directories(
'vcflib/src',
'vcflib/smithwaterman',
'vcflib/multichoose',
'vcflib/filevercmp',
'vcflib/fastahack',
)
vcflib_src = files(
'vcflib/src/Variant.cpp',
'vcflib/smithwaterman/SmithWatermanGotoh.cpp',
'vcflib/smithwaterman/disorder.cpp',
'vcflib/smithwaterman/Repeats.cpp',
'vcflib/smithwaterman/LeftAlign.cpp',
'vcflib/smithwaterman/IndelAllele.cpp',
'vcflib/fastahack/Fasta.cpp',
'vcflib/src/split.cpp',
)
vcflib_lib = static_library('custom_vcflib',
vcflib_src,
include_directories : [htslib_inc, tabixpp_inc, vcflib_inc],
override_options : warn_quiet)
vcflib_dep = declare_dependency(link_with : vcflib_lib,
include_directories : vcflib_inc)
endif
if not seqlib_dep.found()
seqlib_inc = include_directories(
'contrib',
'contrib/SeqLib',
)
seqlib_src = files(
'contrib/SeqLib/src/BamReader.cpp',
'contrib/SeqLib/src/BamRecord.cpp',
'contrib/SeqLib/src/BamHeader.cpp',
'contrib/SeqLib/src/BamWriter.cpp',
'contrib/SeqLib/src/GenomicRegion.cpp',
'contrib/SeqLib/src/ssw_cpp.cpp',
'contrib/SeqLib/src/ssw.c',
)
seqlib_lib = static_library('custom_seqlib',
seqlib_src,
include_directories : [htslib_inc, vcflib_inc, seqlib_inc],
override_options : warn_quiet)
seqlib_dep = declare_dependency(link_with : seqlib_lib,
include_directories : seqlib_inc)
endif
#
# Sources
#
freebayes_common_src = files(
'src/Allele.cpp',
'src/AlleleParser.cpp',
'src/BedReader.cpp',
'src/Bias.cpp',
'src/CNV.cpp',
'src/Contamination.cpp',
'src/DataLikelihood.cpp',
'src/Dirichlet.cpp',
'src/Ewens.cpp',
'src/FBFasta.cpp',
'src/Genotype.cpp',
'src/IndelAllele.cpp',
'src/LeftAlign.cpp',
'src/Marginals.cpp',
'src/Multinomial.cpp',
'src/NonCall.cpp',
'src/Parameters.cpp',
'src/Result.cpp',
'src/ResultData.cpp',
'src/Sample.cpp',
'src/SegfaultHandler.cpp',
'src/Utility.cpp',
)
freebayes_src = files('src/freebayes.cpp')
bamleftalign_src = files('src/bamleftalign.cpp')
# Include paths
incdir = include_directories(
'src',
'ttmath',
)
extra_cpp_args = cc.get_supported_arguments(
'-fpermissive',
'-Wno-reorder',
'-Wno-sign-compare',
'-Wno-unused-variable',
'-Wno-unused-but-set-variable',
)
freebayes_lib = static_library(
'freebayes_common',
freebayes_common_src,
include_directories : incdir,
cpp_args : extra_cpp_args,
dependencies : [zlib_dep, lzma_dep, thread_dep, htslib_dep, tabixpp_dep,
vcflib_dep, seqlib_dep],
install : false,
)
if static_build
link_arguments = '-static'
else
link_arguments = []
endif
executable('freebayes',
freebayes_src,
include_directories : incdir,
cpp_args : extra_cpp_args,
link_args: link_arguments,
dependencies: [zlib_dep, lzma_dep, thread_dep,
htslib_dep, tabixpp_dep, vcflib_dep, seqlib_dep],
link_with : freebayes_lib,
install: true
)
executable('bamleftalign',
bamleftalign_src,
include_directories : incdir,
cpp_args : extra_cpp_args,
link_args: link_arguments,
dependencies: [zlib_dep, lzma_dep, thread_dep,
htslib_dep, vcflib_dep, seqlib_dep],
link_with : freebayes_lib,
install: true
)
testdir = meson.current_source_dir()+'/test'
prove = find_program('prove')
test('T00', prove, args : ['-e','bash','-v','t/00_region_and_target_handling.t'], workdir: testdir)
test('T01', prove, args : ['-e','bash','-v','t/01_call_variants.t'], workdir : testdir )
test('T01b', prove, args : ['-e','bash','-v','t/01b_call_variants.t'], workdir : testdir )
test('T02', prove, args : ['-e','bash','-v','t/02_multi_bam.t'], workdir : testdir )
test('T03', prove, args : ['-e','bash','-v','t/03_reference_bases.t'], workdir: testdir )