-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmeson.build
81 lines (67 loc) · 2.38 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
project('vaccel', 'c', 'cpp',
meson_version : '>=1.1',
default_options : ['c_std=c11'],
license : 'Apache-2.0',
license_files : 'LICENSE',
version : run_command('sh', '-c',
'git submodule update --init >/dev/null && ' +
'scripts/common/generate-version.sh .',
check: true).stdout().strip())
vaccel_common_args = ['-Wall','-Wextra','-Werror']
vaccel_c_args = vaccel_common_args
vaccel_cpp_args = vaccel_common_args
libvaccel_version = meson.project_version().split('-')[0]
opt_tests = get_option('tests')
opt_examples = get_option('examples').enable_if(opt_tests.enabled())
slog_subproj = subproject('slog')
libslog_dep = dependency('slog')
libcurl_dep = dependency('libcurl', required : false)
if libcurl_dep.found()
vaccel_c_args += '-DUSE_LIBCURL'
vaccel_cpp_args += '-DUSE_LIBCURL'
endif
cc = meson.get_compiler('c')
cpp = meson.get_compiler('cpp')
if cc.has_header('stb/stb_image.h')
vaccel_c_args += '-DUSE_STB_IMAGE'
endif
if cpp.has_header('stb/stb_image.h')
vaccel_cpp_args += '-DUSE_STB_IMAGE'
endif
subdir('src')
subdir('plugins')
subdir('python')
fs = import('fs')
if opt_examples.enabled()
subdir('examples')
endif
if opt_tests.enabled()
subdir('test')
endif
summary({
'Build the exec plugin': opt_plugin_exec.enabled(),
'Build the no-op debugging plugin': opt_plugin_noop.enabled(),
'Build the mbench plugin': opt_plugin_mbench.enabled(),
'Build the examples': opt_examples.enabled(),
'Enable testing': opt_tests.enabled(),
},
section : 'Configuration',
bool_yn : true)
meson.add_dist_script(
'scripts/common/dist.sh',
'-n', 'vaccel',
'-v', meson.project_version(),
'-t', get_option('buildtype'),
'-a', 'plugin-exec=' + (opt_plugin_exec.enabled() ? 'enabled' : 'disabled'),
'-a', 'plugin-noop=' + (opt_plugin_noop.enabled() ? 'enabled' : 'disabled'),
'-a', 'plugin-mbench=' + (opt_plugin_mbench.enabled() ? 'enabled' : 'disabled'),
'-a', 'examples=' + (opt_examples.enabled() ? 'enabled' : 'disabled'),
'-a', 'tests=' + (opt_tests.enabled() ? 'enabled' : 'disabled'))
if opt_examples.enabled() and opt_plugin_noop.enabled() and opt_plugin_exec.enabled()
run_target('run-examples',
command : 'scripts/run-examples.sh',
depends : [examples, libvaccel_noop, libvaccel_exec])
run_target('run-examples-valgrind',
command : ['scripts/run-examples.sh', '', 'true'],
depends : [examples, libvaccel_noop, libvaccel_exec])
endif