File: meson.build

package info (click to toggle)
libatomic-queue 1.7.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,336 kB
  • sloc: cpp: 1,704; javascript: 368; makefile: 126; ansic: 91; python: 82; sh: 60
file content (70 lines) | stat: -rw-r--r-- 2,137 bytes parent folder | download
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
# Copyright (c) 2019 Maxim Egorushkin. MIT License. See the full licence in file LICENSE.

# (rm -rf build; meson setup build; time ninja -C build -v)

project(
  'atomic_queue', 'cpp',
  license : 'MIT License',
  default_options : ['cpp_std=gnu++14', 'buildtype=release', 'b_ndebug=if-release']
)

threads_dep = dependency('threads')

atomic_queue_dep = declare_dependency(include_directories : ['include'], dependencies : threads_dep)

if get_option('tests')
  unit_test_framework_dep = dependency('boost', modules : ['unit_test_framework'])

  tests_exe = executable(
    'tests',
    'src/tests.cc',
    dependencies : [atomic_queue_dep, unit_test_framework_dep],
  )
  test('tests', tests_exe)

  example_exe = executable(
    'example',
    'src/example.cc',
    dependencies : [atomic_queue_dep],
  )
  test('example', example_exe)
endif

if get_option('benchmarks')
  incompatible_cpp_std = ['c++98', 'c++03', 'c++11', 'c++14', 'gnu++03', 'gnu++11', 'gnu++14', 'vc++14']
  if incompatible_cpp_std.contains(get_option('cpp_std'))
    error('Benchmarks require C++17 or higher')
  endif

  cxx = meson.get_compiler('cpp')
  dl_dep = cxx.find_library('dl')
  xenium_dep = declare_dependency(include_directories : '../xenium')
  boost_dep = dependency('boost')
  tbb_dep = cxx.find_library('tbb')
  moodycamel_dep = declare_dependency(include_directories : '../')

  benchmarks_exe = executable(
    'benchmarks',
    ['src/benchmarks.cc', 'src/cpu_base_frequency.cc', 'src/huge_pages.cc'],
    include_directories : ['src'],
    dependencies : [atomic_queue_dep, dl_dep, xenium_dep, boost_dep, tbb_dep, moodycamel_dep],
  )
  benchmark('benchmarks', benchmarks_exe)
endif

install_headers(
  files(
    'include/atomic_queue/atomic_queue.h',
    'include/atomic_queue/atomic_queue_mutex.h',
    'include/atomic_queue/barrier.h',
    'include/atomic_queue/defs.h',
    'include/atomic_queue/spinlock.h',
  ),
  subdir: 'atomic_queue'
)
pkg = import('pkgconfig')
pkg.generate(
  name: 'atomic_queue',
  description: 'C++14 multiple-producer-multiple-consumer lock-free queues based on circular buffers',
  libraries: [threads_dep]
)