This repository has been archived by the owner on Jun 11, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
meson.build
132 lines (109 loc) · 3.53 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
project('tt', 'cpp',
version: '0.0.1',
license: 'GPL3',
meson_version: '>=0.50.0',
default_options: [
'cpp_std=c++17',
'warning_level=3',
],
)
add_project_arguments('-Werror', language: 'cpp')
add_project_arguments('-Wno-missing-braces', language: 'cpp')
spdlog_cxxargs = [
# Do not log thread id
'-DSPDLOG_NO_THREAD_ID',
# Log levels are set only at startup, no need for atomic levels
'-DSPDLOG_NO_ATOMIC_LEVELS',
# Do not let child inherit log file descriptors
'-DSPDLOG_PREVENT_CHILD_FD',
# Default logger is created inside CliLogger
'-DSPDLOG_DISABLE_DEFAULT_LOGGER',
]
add_global_arguments(spdlog_cxxargs, language: 'cpp')
pkg = import('pkgconfig')
fmt_dep = dependency('fmt', fallback: ['fmt', 'fmt_dep'])
spdlog_dep = dependency('spdlog', version : '>=1.4.2', fallback: ['spdlog', 'spdlog_dep'])
# Check that both fmt and spdlog are either installed on the system
# This way spdlog can use the external fmt instead of the embedded one
is_system_fmt = fmt_dep.type_name() == 'pkgconfig'
is_system_spdlog = spdlog_dep.type_name() == 'pkgconfig'
if is_system_fmt and is_system_fmt
add_global_arguments('-DSPDLOG_FMT_EXTERNAL', language: 'cpp')
endif
catch2_dep = dependency('catch2', required: get_option('tests'), fallback: ['catch2', 'catch2_dep'])
json_dep = dependency('nlohmann_json', version: '>=3.9.0', fallback: ['nlohmann_json', 'nlohmann_json_multiple_headers'])
nng_dep = dependency('nng', method : 'cmake', modules : ['nng::nng'], fallback: ['nng', 'nng_dep'])
tiny_process_inc = include_directories('ext/tiny-process-library')
tiny_process_lib = static_library(
'tiny-process-library',
[
'ext/tiny-process-library/process.cpp',
'ext/tiny-process-library/process_unix.cpp'
],
include_directories: tiny_process_inc
)
tiny_process_dep = declare_dependency(
link_with: tiny_process_lib,
include_directories: tiny_process_inc
)
deps = [
# It's safe to include catch2 because it will be disabled
# with the 'tests' option
catch2_dep,
fmt_dep,
json_dep,
nng_dep,
spdlog_dep,
tiny_process_dep,
]
prefix = get_option('prefix')
bindir = get_option('bindir')
datadir = get_option('datadir')
libexecdir = get_option('libexecdir')
localstatedir = get_option('localstatedir')
sysconfdir = get_option('sysconfdir')
if prefix == '/usr/local'
sysconfdir = prefix / sysconfdir
localstatedir = prefix / localstatedir
endif
if not bindir.startswith('/')
bindir = prefix / bindir
endif
if not libexecdir.startswith('/')
libexecdir = prefix / libexecdir
endif
if not datadir.startswith('/')
datadir = prefix / datadir
endif
livedir = get_option('livedir')
confdir = get_option('confdir')
if confdir == 'sysconfdir/tt'
confdir = sysconfdir / 'tt'
endif
logdir = get_option('logdir')
if logdir == 'localstatedir/log/tt'
logdir = localstatedir / 'log/tt'
endif
statedir = get_option('statedir')
if statedir == 'localstatedir/lib/tt'
statedir = localstatedir / 'lib/tt'
endif
servicedir = get_option('servicedir')
if servicedir == 'datadir/tt/services'
servicedir = datadir / 'tt/services'
endif
default_log_user = get_option('default_log_user')
default_log_group = get_option('default_log_group')
if default_log_group == 'default_log_user'
default_log_group = default_log_user
endif
subdir('ext')
subdir('include')
subdir('src')
if catch2_dep.found()
subdir('test')
if get_option('b_coverage')
run_target('coverage-sonarcloud',
command: ['scripts/coverage-sonarcloud.sh'])
endif
endif