-
Notifications
You must be signed in to change notification settings - Fork 5
/
meson.build
151 lines (132 loc) · 4.33 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
project('mcpanel', 'c',
version : '1.1',
default_options : [
'warning_level=1',
],
license : 'LGPL-3.0',
meson_version: '>= 0.49'
)
# follow semantic versionning (https://semver.org)
# * MAJOR version when you make incompatible API changes,
# * MINOR version when you add functionality in a backwards-compatible manner
# * PATCH version when you make backwards-compatible bug fixes.
major = '0'
minor = '2'
patch = '0'
version = major + '.' + minor + '.' + patch
cc = meson.get_compiler('c')
configuration_inc = include_directories('src')
# additional (optional) warnings
flags = [
'-Wshadow',
'-Wmissing-prototypes',
]
add_project_arguments(cc.get_supported_arguments(flags), language : 'c')
# define HAVE_CONFIG_H with compiler command line to include the generated
# config.h file (same as autotools)
add_project_arguments('-DHAVE_CONFIG_H', language : 'c')
config = configuration_data()
subdir('config/api-exports')
subdir('config/autotools-compat')
if get_option('glib-check')
config.set(G_DISABLE_CAST_CHECKS, 1)
endif
# write config file
build_cfg = 'config.h' # named as such to match autotools build system
configure_file(output : build_cfg, configuration : config)
mcpanel_headers = files(
'src/mcpanel.h',
)
mcpanel_sources = files(
'src/bargraph.c',
'src/bargraph.h',
'src/bartab.c',
'src/binary-scope.c',
'src/binary-scope.h',
'src/gtk-led.c',
'src/gtk-led.h',
'src/labelized-plot.c',
'src/labelized-plot.h',
'src/mcpanel.c',
'src/mcpanel.h',
'src/mcp_gui.c',
'src/mcp_gui.h',
'src/mcp_shared.h',
'src/mcp_sighandler.c',
'src/mcp_sighandler.h',
'src/misc.c',
'src/misc.c',
'src/plot-area.c',
'src/plot-area.h',
'src/plotgraph.c',
'src/plotgraph.h',
'src/plottk-types.h',
'src/scope.c',
'src/scope.h',
'src/scopetab.c',
'src/signaltab.c',
'src/signaltab.h',
'src/spectrum.c',
'src/spectrum.h',
'src/spectrumtab.c',
)
install_headers(mcpanel_headers)
libmath = cc.find_library('m', required : true)
glib2 = dependency('glib-2.0', required : true)
gtk2 = dependency('gtk+-2.0', required : true)
gthread2 = dependency('gthread-2.0', required : true)
rtfilter = cc.find_library('rtfilter', required : true)
mcpanel = shared_library('mcpanel',
mcpanel_sources,
install : true,
version : version,
include_directories : configuration_inc,
dependencies : [libmath, gtk2, gthread2, glib2, rtfilter],
)
pkg = import('pkgconfig')
pkg.generate(mcpanel)
# install data
install_data(
files('src/led_gray.png',
'src/led_green.png',
'src/led_red.png',
'src/led_blue.png',
'src/default.ui',
),
install_dir: get_option('datadir') / 'mcpanel'
)
if get_option('tests')
mmlib = cc.find_library('mmlib', required : true)
test_thread_panel_sources = files('test/thread_panel.c')
test_thread_panel = executable('test-thread-panel',
test_thread_panel_sources,
include_directories : configuration_inc,
link_with : mcpanel,
dependencies : [mmlib, gthread2],
)
test('test-thread-panel', test_thread_panel,
env : ['MCPANEL_DATADIR=' + meson.source_root() + '/src',
'XDG_CONFIG_HOME=' + meson.source_root() + '/test',
],
)
test_signal_panel_sources = files('test/signal_panel.c')
test_signal_panel = executable('test-signal-panel',
test_signal_panel_sources,
include_directories : configuration_inc,
link_with : mcpanel,
dependencies : [glib2, libmath],
)
test('test-signal-panel', test_signal_panel,
env : ['MCPANEL_DATADIR=' + meson.source_root() + '/src',
'XDG_CONFIG_HOME=' + meson.source_root() + '/test',
],
)
endif
# test public headers for most warnings and C++ compatibility
run_target('api-compat-test',
command : [
'bash',
files('devtools/api-compat-test.sh'),
mcpanel_headers,
]
)