forked from vcflib/vcflib
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
592 lines (507 loc) · 16.6 KB
/
CMakeLists.txt
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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
# For Debian currently with
#
# cd build
# cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DZIG=OFF -DWFA_GITMODULE=OFF ..
# make
# make test
# make install
#
cmake_minimum_required(VERSION 3.16)
project(vcflib)
set(CMAKE_CXX_STANDARD 17)
include(ExternalProject)
include(FeatureSummary)
include(GNUInstallDirs)
find_package(PkgConfig REQUIRED)
find_package(pybind11 CONFIG)
include(GNUInstallDirs)
include(FindBZip2)
include(FindLibLZMA)
include(FindZLIB)
include(FindCURL) # for htslib
feature_summary(
FATAL_ON_MISSING_REQUIRED_PACKAGES
WHAT REQUIRED_PACKAGES_NOT_FOUND)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) # for pybind11
# ---- Options
option(BUILD_DOC "Build documentation" ON)
option(OPENMP "Enable OpenMP" ON) # disabling does not work because of vcfwave
option(PROFILING "Enable profiling" OFF)
option(GPROF "Enable gprof profiling" OFF)
option(ASAN "Use address sanitiser" OFF)
option(ZIG "Set to OFF to disable the zig code" ON)
option(WFA_GITMODULE "Force local git submodule for WFA2LIB" ON) # disable in distros, you may need to add path to WFA_INCLUDE_DIRS
include(CheckIPOSupported) # adds lto
check_ipo_supported(RESULT ipo_supported OUTPUT output)
set(EXTRA_FLAGS " ") # otherwise it injects OFF
# ---- Dependencies
if(OPENMP)
include(FindOpenMP)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif(OPENMP)
find_package(ZLIB)
set_package_properties(ZLIB PROPERTIES TYPE REQUIRED)
find_package(Threads)
set_package_properties(Threads PROPERTIES TYPE REQUIRED)
pkg_check_modules(HTSLIB htslib) # Optionally builds from contrib/
pkg_check_modules(TABIXPP tabixpp) # Optionally builds from contrib/
# ---- Build switches
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ${ipo_supported})
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING
"Choose the type of build, options are: Release|Debug|RelWithDebInfo (for distros)." FORCE)
endif()
if (${CMAKE_BUILD_TYPE} MATCHES Release)
set(EXTRA_FLAGS "-march=native -D_FILE_OFFSET_BITS=64")
# set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG") # reset CXX_FLAGS to replace -O3 with -Ofast
endif()
if ((${CMAKE_BUILD_TYPE} MATCHES Release) OR (${CMAKE_BUILD_TYPE} MATCHES RelWithDebInfo))
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_FLAGS}")
endif ()
if (${CMAKE_BUILD_TYPE} MATCHES "Debug")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_FLAGS}")
add_definitions(-Wfatal-errors)
endif ()
if (ASAN)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fno-common")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fno-common")
endif(ASAN)
if(PROFILING)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
endif(PROFILING)
if(GPROF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
endif(GPROF)
if (ZIG)
find_program(ZIG_EXE NAMES "zig")
if (NOT ZIG_EXE)
MESSAGE(FATAL_ERROR "zig binary not found in PATH. zig is used for vcfcreatemulti's latest features. Either use cmake -DZIG=OFF option or add zig to the PATH")
endif (NOT ZIG_EXE)
endif(ZIG)
# ---- Include files
include_directories(include)
include_directories(contrib/fastahack)
include_directories(contrib/intervaltree)
include_directories(contrib/smithwaterman)
include_directories(contrib/multichoose)
include_directories(contrib/filevercmp)
include_directories(contrib/c-progress-bar)
if(HTSLIB_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${HTSLIB_CFLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${HTSLIB_CFLAGS}")
else(HTSLIB_FOUND)
message(STATUS "Using included htslib")
set(HTSLIB_LOCAL contrib/tabixpp/htslib)
set(TABIXPP_FOUND OFF) # also build tabixpp if htslib is missing
endif()
if(TABIXPP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TABIXPP_CFLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TABIXPP_CFLAGS}")
else(TABIXPP_FOUND)
message(STATUS "Using included tabixpp")
set(TABIXPP_LOCAL contrib/tabixpp)
include_directories(contrib/tabixpp)
set(tabixpp_SOURCE
contrib/tabixpp/tabix.cpp
)
endif()
if(WFA_GITMODULE)
set(WFA_LOCAL contrib/WFA2-lib)
endif()
file(GLOB INCLUDES
src/*.h*
contrib/multichoose/*.h*
contrib/intervaltree/*.h*
contrib/smithwaterman/*.h*
contrib/fastahack/*.h*
contrib/filevercmp/*.h*
)
set(vcflib_SOURCE
src/vcf-c-api.cpp
src/legacy.cpp
src/vcf-wfa.cpp
src/Variant.cpp
src/rnglib.cpp
src/var.cpp
src/pdflib.cpp
src/cdflib.cpp
src/split.cpp
src/legacy.cpp
src/rkmh.cpp
src/murmur3.cpp
src/LeftAlign.cpp
src/cigar.cpp
src/allele.cpp
contrib/fastahack/Fasta.cpp
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
)
if (TABIXPP_LOCAL) # add the tabixpp source file
list(APPEND vcflib_SOURCE ${tabixpp_SOURCE})
endif()
add_library(vcflib STATIC
${vcflib_SOURCE}
)
set(BINS
vcfecho
dumpContigsFromHeader
bFst
pVst
hapLrt
popStats
wcFst
iHS
segmentFst
segmentIhs
genotypeSummary
sequenceDiversity
pFst
smoother
vcfld
plotHaps
abba-baba
permuteGPAT++
permuteSmooth
normalize-iHS
meltEHH
vcfnullgenofields
vcfaltcount
vcfhetcount
vcfhethomratio
vcffilter
vcf2tsv
vcfgenotypes
vcfannotategenotypes
vcfcommonsamples
vcfremovesamples
vcfkeepsamples
vcfsamplenames
vcfgenotypecompare
vcffixup
vcfclassify
vcfsamplediff
vcfremoveaberrantgenotypes
vcfrandom
vcfparsealts
vcfstats
vcfflatten
vcfprimers
vcfnumalt
vcfcleancomplex
vcfintersect
vcfannotate
vcfallelicprimitives
vcfwave
vcfoverlay
vcfaddinfo
vcfkeepinfo
vcfkeepgeno
vcfafpath
vcfcountalleles
vcflength
vcfdistance
vcfrandomsample
vcfentropy
vcfglxgt
vcfroc
vcfcheck
vcfstreamsort
vcfuniq
vcfuniqalleles
vcfremap
vcf2fasta
vcfsitesummarize
vcfbreakmulti
vcfevenregions
vcfcat
vcfgenosummarize
vcfgenosamplenames
vcfgeno2haplo
vcfleftalign
vcfcombine
vcfgeno2alleles
vcfindex
vcf2dag
vcfsample2info
vcfqual2info
vcfinfo2qual
vcfglbound
vcfinfosummarize
vcfcreatemulti
)
set(SCRIPTS
bed2region
bgziptabix
vcf2bed.py
vcf2sqlite.py
vcfbiallelic
vcfclearid
vcfclearinfo
vcfcomplex
vcffirstheader
vcfgtcompare.sh
vcfindelproximity
vcfindels
vcfjoincalls
vcfmultiallelic
vcfmultiway
vcfmultiwayscripts
vcfnobiallelicsnps
vcfnoindels
vcfnosnps
vcfnulldotslashdot
vcfplotaltdiscrepancy.r
vcfplotaltdiscrepancy.sh
vcfplotsitediscrepancy.r
vcfplottstv.sh
vcfprintaltdiscrepancy.r
vcfprintaltdiscrepancy.sh
vcfqualfilter
vcfregionreduce
vcfregionreduce_and_cut
vcfregionreduce_pipe
vcfregionreduce_uncompressed
vcfremovenonATGC
vcfsnps
vcfsort
vcf_strip_extra_headers
vcfvarstats
)
# ---- Get version
file (STRINGS "VERSION" BUILD_NUMBER)
add_definitions(-DVCFLIB_VERSION="${BUILD_NUMBER}")
add_definitions(-DVERSION="${BUILD_NUMBER}")
# ---- Build htslib
#
# Note by default we use the distributed htslib! These are
# the older instructions which allow for a local build from
# git submodules
if (HTSLIB_LOCAL)
include_directories(${HTSLIB_LOCAL})
set(flags "-O2 -g -fPIC")
ExternalProject_Add(htslib-EXT
SOURCE_DIR "${CMAKE_SOURCE_DIR}/${HTSLIB_LOCAL}"
UPDATE_COMMAND autoreconf -i
CONFIGURE_COMMAND ./configure --disable-s3
INSTALL_COMMAND ""
BUILD_IN_SOURCE ON
BUILD_COMMAND $(MAKE) CFLAGS=${flags} lib-static
)
ExternalProject_Get_property(htslib-EXT SOURCE_DIR)
ExternalProject_Get_property(htslib-EXT INSTALL_DIR)
set(htslib_INCLUDE "${SOURCE_DIR}")
set(htslib_static "${SOURCE_DIR}/libhts.a")
set(htslib_lib "${htslib_static}")
set(HTSLIB_LINK_LIBRARIES "${htslib_static}")
add_custom_target(htslib
DEPENDS htslib-EXT
VERBATIM)
# set_property(TARGET htslib PROPERTY IMPORTED_LOCATION ${hstlib_lib})
# add_dependencies(htslib htslib-EXT)
add_library(HTSLIB_LIBRARIES STATIC IMPORTED)
set_target_properties(HTSLIB_LIBRARIES PROPERTIES IMPORTED_LOCATION ${htslib_lib})
add_dependencies(HTSLIB_LIBRARIES htslib-EXT)
# If the user wants to configure our HTSlib to build with libddeflate, we need
# to make sure to link against libdeflate as a transitive dependency. To do
# that, pass -DHTSLIB_EXTRA_LIBS="-ldeflate" when configuring the project with
# cmake.
# TODO: Stop vendoring in htslib and just use find_package
# set(HTSLIB_EXTRA_LIBS "-lcurl" CACHE STRING "Library flags needed to link with htslib's dependencies, for chosen configuration")
# set_property(TARGET htslib PROPERTY INTERFACE_LINK_LIBRARIES ${HTSLIB_EXTRA_LIBS})
endif(HTSLIB_LOCAL)
if(WFA_GITMODULE)
message(STATUS "Using included libwfa")
set(WFA_INCLUDE_DIRS ${WFA_LOCAL})
add_subdirectory(${WFA_LOCAL} EXCLUDE_FROM_ALL)
set(WFALIB wfa2) # pick up the wfa2 lib target from the included CMakeLists.txt
else(WFA_GITMODULE)
set(WFA_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/wfa2lib)
find_library(WFALIB wfa2 wfa) # distro search for shared lib
if(NOT WFALIB)
message(STATUS "ERROR: Can not find libfwa! Make sure it is installed or use the git submodule instead")
endif()
endif(WFA_GITMODULE)
include_directories(${WFA_INCLUDE_DIRS})
MESSAGE(STATUS "WFA using include ${WFA_INCLUDE_DIRS}")
# ZIG VCF imported library is part of VCFLIB source tree. We designate it an
# external project so we can run 'zig build'
if (ZIG)
ExternalProject_Add(ZIG-EXT
SOURCE_DIR "${CMAKE_SOURCE_DIR}/src/zig"
UPDATE_COMMAND ""
CONFIGURE_COMMAND ""
INSTALL_COMMAND ""
BUILD_IN_SOURCE ON
BUILD_ALWAYS ON
BUILD_COMMAND ${CMAKE_SOURCE_DIR}/src/zig/compile.sh # -Drelease-fast=true -freference-trace
)
ExternalProject_Get_property(ZIG-EXT SOURCE_DIR)
set(ZIG_INCLUDE_DIRS ${SOURCE_DIR})
set(ZIG_LINK_LIBRARIES ${SOURCE_DIR}/zig-out/lib/libzig.a)
add_library(ZIGCPP_STATIC_LIB STATIC IMPORTED)
set_target_properties(ZIGCPP_STATIC_LIB PROPERTIES IMPORTED_LOCATION ${ZIG_LINK_LIBRARIES})
add_dependencies(ZIGCPP_STATIC_LIB ZIG-EXT vcf.zig)
include_directories(${ZIG_INCLUDE_DIRS})
else (ZIG)
set (ZIG_LINK_LIBRARIES )
add_definitions(-DNO_ZIG=1)
endif (ZIG)
set(vcflib_DEPS
CURL::libcurl
)
if (ZIG)
list(APPEND vcflib_DEPS ZIG-EXT)
endif ()
if (HTSLIB_LOCAL)
list(APPEND vcflib_DEPS htslib)
endif()
set(vcflib_LIBS
${HTSLIB_LIBRARIES}
${CURL_LIBRARIES}
${ZLIB_LIBRARIES}
${LIBLZMA_LIBRARIES}
${BZIP2_LIBRARIES}
${TABIXPP_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${WFA_LINK_LIBRARIES}
${HTSLIB_LINK_LIBRARIES}
)
if (ZIG)
list(APPEND vcflib_LIBS ${ZIG_LINK_LIBRARIES})
endif()
add_dependencies(vcflib ${vcflib_DEPS})
# ---- Build all
if (NOT BUILD_ONLY_LIB)
foreach(BIN ${BINS})
add_executable(${BIN} src/${BIN}.cpp)
add_dependencies(${BIN} vcflib)
target_link_libraries(${BIN} PUBLIC ${vcflib_LIBS} vcflib)
endforeach(BIN ${BINS})
# These binaries include WFALIB
target_link_libraries(vcfallelicprimitives PUBLIC ${WFALIB})
target_link_libraries(vcfcleancomplex PUBLIC ${WFALIB})
target_link_libraries(vcfparsealts PUBLIC ${WFALIB})
target_link_libraries(vcfroc PUBLIC ${WFALIB})
target_link_libraries(vcfstats PUBLIC ${WFALIB})
target_link_libraries(vcfwave PUBLIC ${WFALIB})
install(TARGETS ${BINS} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
# ---- Copy scripts
foreach(SCRIPT ${SCRIPTS})
install(PROGRAMS ./scripts/${SCRIPT} DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME ${SCRIPT})
endforeach(SCRIPT ${SCRIPTS})
endif()
# ---- Python bindings - mostly for testing at this stage
pybind11_add_module(pyvcflib "${CMAKE_SOURCE_DIR}/src/pythonffi.cpp")
add_dependencies(pyvcflib ${vcflib_DEPS})
target_link_libraries(pyvcflib PUBLIC vcflib ${vcflib_LIBS} ${WFALIB})
install(TARGETS pyvcflib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
# ---- Test
enable_testing()
function(add_pytest TEST_FILE)
add_test(
NAME ${TEST_FILE}
COMMAND python3 tests/${TEST_FILE}.py
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test
)
SET_TESTS_PROPERTIES(${TEST_FILE}
PROPERTIES ENVIRONMENT "LSAN_OPTIONS=suppressions=../test/libasan-suppress.txt;PYTHONPATH=${PROJECT_SOURCE_DIR}/build;LD_LIBRARY_PATH=$ENV{LIBRARY_PATH}")
endfunction()
function(add_pydoctest TEST_FILE)
add_test(
NAME ${TEST_FILE}
COMMAND python3 -m doctest -o NORMALIZE_WHITESPACE -o REPORT_UDIFF pytest/${TEST_FILE}.md
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test
)
SET_TESTS_PROPERTIES(${TEST_FILE}
# PROPERTIES ENVIRONMENT "ASAN_OPTIONS=detect_leaks=1:symbolize=1;LSAN_OPTIONS=verbosity=2:log_threads=1:suppressions=../test/libasan-suppress.txt")
PROPERTIES ENVIRONMENT "LSAN_OPTIONS=suppressions=../test/libasan-suppress.txt;PYTHONPATH=${PROJECT_SOURCE_DIR}/build:${PROJECT_SOURCE_DIR}/test/pytest;LD_LIBRARY_PATH=$ENV{LIBRARY_PATH}")
endfunction()
function(add_doctest TEST_FILE)
add_test(
NAME ${TEST_FILE}
COMMAND python3 -m doctest -o NORMALIZE_WHITESPACE -o REPORT_UDIFF ../${TEST_FILE}.md
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test
)
endfunction()
function(add_pydoctest_fullname TEST_FILE)
add_test(
NAME ${TEST_FILE}
COMMAND python3 -m doctest -o NORMALIZE_WHITESPACE -o REPORT_UDIFF ${TEST_FILE}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test
)
endfunction()
if (ZIG_TEST) # currently disabled
function(add_zigtest)
add_test(
NAME zigvcf
COMMAND zig build test
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/zig
)
endfunction()
add_zigtest()
endif(ZIG_TEST)
add_pytest(realign)
add_pydoctest(pyvcflib)
add_pydoctest(vcflib-api)
add_pydoctest(vcf2tsv)
add_pydoctest(vcfallelicprimitives)
add_pydoctest(vcfwave)
add_pydoctest(vcffilter)
if (ZIG)
add_pydoctest(vcfcreatemulti)
endif (ZIG)
add_pydoctest(vcfnulldotslashdot)
add_doctest(doc/vcfintersect)
# ---- Build docs
#
# Generates man pages for the python doctests. Don't need
# to run every time so it is a separate command. For pandoc logic see
# https://www.howtogeek.com/682871/how-to-create-a-man-page-on-linux/
#
# cmake --build . --target man ; cmake --install .
find_program(PANDOC pandoc)
set(pytest vcfnulldotslashdot vcfallelicprimitives vcfwave)
# vcfcreatemulti)
if (PANDOC)
# note the option ALL which allows to build the docs together with the application
add_custom_target( man
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ruby ./test/scripts/bin2md.rb --man test/scripts/bin2md-template.erb
COMMAND ruby ./test/scripts/bin2md.rb --man --index
# overwrite markdown from tests
COMMAND ${CMAKE_COMMAND} -E copy ./test/pytest/vcfnulldotslashdot.md ./doc/vcfnulldotslashdot.md
COMMAND ${CMAKE_COMMAND} -E copy ./test/pytest/vcfallelicprimitives.md ./doc/vcfallelicprimitives.md
COMMAND ${CMAKE_COMMAND} -E copy ./test/pytest/vcfwave.md ./doc/vcfwave.md
COMMAND ${CMAKE_COMMAND} -E copy ./test/pytest/vcfcreatemulti.md ./doc/vcfcreatemulti.md
COMMAND ${CMAKE_COMMAND} -E copy ./test/pytest/vcflib-api.md ./doc/vcflib-api.md
COMMAND ${CMAKE_COMMAND} -E copy ./test/pytest/pyvcflib.md ./doc/pyvcflib.md
# generate man pages from markdown
COMMAND ruby ./test/scripts/md2man
# regenerate to allow for URLs in markdown docs
COMMAND ruby ./test/scripts/bin2md.rb test/scripts/bin2md-template.erb
COMMAND ruby ./test/scripts/bin2md.rb --index
COMMAND ${CMAKE_COMMAND} -E copy ./test/pytest/vcfnulldotslashdot.md ./doc/vcfnulldotslashdot.md
COMMAND ${CMAKE_COMMAND} -E copy ./test/pytest/vcfallelicprimitives.md ./doc/vcfallelicprimitives.md
COMMAND ${CMAKE_COMMAND} -E copy ./test/pytest/vcfwave.md ./doc/vcfwave.md
COMMAND ${CMAKE_COMMAND} -E copy ./test/pytest/vcfcreatemulti.md ./doc/vcfcreatemulti.md
# Documented test cases for Python bindings
COMMAND ${CMAKE_COMMAND} -E copy ./test/pytest/pyvcflib.md ./doc/pyvcflib.md
COMMAND ${CMAKE_COMMAND} -E copy ./test/pytest/vcflib-api.md ./doc/vcflib-api.md
)
else (PANDOC)
message("Pandoc needs to be installed to generate the man pages")
endif (PANDOC)
# ---- Install
install(TARGETS vcflib ARCHIVE DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES ${INCLUDES} DESTINATION include)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/man/ DESTINATION ${CMAKE_INSTALL_PREFIX}/man/man1)