meson.build 1.82 KB
Newer Older
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
project(
  'pbcopper',
  'cpp',
  version : '0.4.1',
  default_options : [
    'buildtype=release',
    'warning_level=3',
    'cpp_std=c++11',
    'b_ndebug=if-release'],
  license : 'BSD-3',
  meson_version : '>= 0.46.0')

############
# CXXFLAGS #
############

pbcopper_warning_flags = []
cpp = meson.get_compiler('cpp')
foreach cflag: [
  '-Wduplicated-cond',
  '-Wduplicated-branches',
  '-Wlogical-op',
  '-Wrestrict',
  '-Wnull-dereference',
  '-Wuseless-cast',
  '-Wdouble-promotion',
  '-Wshadow',
  '-Wformat=1']
    if cpp.has_argument(cflag)
      pbcopper_warning_flags += cflag
    endif
endforeach

################
# dependencies #
################

# threads
pbcopper_thread_dep = dependency('threads', required : true)

# boost
pbcopper_boost_dep = dependency('boost', required : true)

###########
# headers #
###########

subdir('include')

#####################
# sources + library #
#####################

subdir('src')

##########
# extras #
##########

if not meson.is_subproject()
  # examples
  if get_option('build-examples')
    subdir('examples')
  endif

  # documentation
  if get_option('build-docs')
    subdir('docs')
  endif

  # tests
  if get_option('tests')
    pbcopper_clang_formatter = find_program('tools/check-formatting')
    subdir('tests')
  endif
endif

###################
# dependency info #
###################

if not meson.is_subproject()
  import('pkgconfig').generate(
    libraries : pbcopper_lib,
    version : meson.project_version(),
    name : 'pbcopper',
    filebase : 'pbcopper',
    description : 'C++ library providing a suite of data structures, algorithms, and utilities')
endif

pbcopper_dep = declare_dependency(
  include_directories : pbcopper_include_directories,
  link_with : pbcopper_lib,
  dependencies : [pbcopper_thread_dep, pbcopper_boost_dep],
  version : meson.project_version())