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
|
project('btllib', 'cpp',
version : '1.4.9',
license : 'GPL3',
default_options : [ 'cpp_std=c++11', 'warning_level=3', 'werror=false' ],
meson_version : '>= 0.60.0')
# Configuration
# ===========================================================
conf = configuration_data()
conf.set('PROJECT_VERSION', meson.project_version(), description : 'btllib version. Useful to append to the help prompt of recipes.')
configure_file(input : 'include/btllib/config.hpp.in', output : 'config.hpp', configuration : conf)
# Modules
# ===========================================================
fs = import('fs')
cmake = import('cmake')
# Compiler and global flags
# ===========================================================
compiler = meson.get_compiler('cpp')
compiler_id = compiler.get_id()
compiler_version = compiler.version()
if compiler_id == 'gcc' and compiler_version.version_compare('<6.0.0')
error('GCC ' + compiler_version + ' is unsupported.')
endif
if compiler_id == 'clang' and compiler_version.version_compare('<5.0.0')
error('Clang ' + compiler_version + ' is unsupported.')
endif
global_args = []
global_link_args = [ '-ldl' ]
if compiler_id == 'clang'
global_link_args += [ '-lstdc++', '-lm' ]
endif
add_global_arguments(global_args, language : 'cpp')
add_global_link_arguments(global_link_args, language : 'cpp')
# Build dependencies and subprojects
# ===========================================================
threads_dep = dependency('threads')
openmp_dep = dependency('openmp', required : false)
deps = [ threads_dep, openmp_dep ]
# These are unfortunate hacks. Currently, neither cpptoml nor sdsl-lite install their headers (even when set_install(true) is called), and so we need to do it manually
meson.add_install_script('scripts/install-cpptoml')
meson.add_install_script('scripts/install-sdsl-lite')
# Run time dependencies
# ===========================================================
samtools = find_program('samtools', required : false)
gzip = find_program('gzip', required : false)
xz = find_program('xz', required : false)
bzip2 = find_program('bzip2', required : false)
tar = find_program('tar', required : false)
# Custom run commands
# ===========================================================
rootpath = meson.project_source_root()
swig = find_program('swig', required : false)
if swig.found()
run_target('wrap', command: join_paths(rootpath, 'scripts/wrap'))
endif
run_target('sanitize-address', command: [
join_paths(rootpath, 'scripts/sanitize'),
'address'
])
run_target('sanitize-memory', command: [
join_paths(rootpath, 'scripts/sanitize'),
'memory'
])
run_target('sanitize-thread', command: [
join_paths(rootpath, 'scripts/sanitize'),
'thread'
])
run_target('sanitize-undefined', command: [
join_paths(rootpath, 'scripts/sanitize'),
'undefined'
])
doxygen = find_program('doxygen', required : false)
if doxygen.found()
run_target('docs', command: join_paths(rootpath, 'scripts/docs'))
endif
run_target('quality-assurance', command: join_paths(rootpath, 'scripts/quality-assurance'))
run_target('test-wrappers', command: join_paths(rootpath, 'scripts/test-wrappers'))
# The library
# ===========================================================
btllib_include = [ include_directories('include'), include_directories('.') ]
btllib_sources = run_command('scripts/get-files', 'src').stdout().strip().split()
btllib_lib = static_library('btllib',
btllib_sources,
include_directories : btllib_include,
dependencies : deps,
install : true,
install_dir : 'lib')
btllib_dep = declare_dependency(
link_with : btllib_lib,
include_directories : btllib_include
)
subdir('include')
subdir('wrappers')
subdir('recipes')
if get_option('buildtype') != 'release'
subdir('tests')
endif
|