-
Notifications
You must be signed in to change notification settings - Fork 31
/
meson.build
163 lines (129 loc) · 4.2 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
152
153
154
155
156
157
158
159
160
161
162
# https://gitlab.gnome.org/GNOME/gnome-system-monitor/issues
project('gnome-system-monitor',
'c', 'cpp',
default_options : [
'c_std=gnu2x',
'cpp_std=gnu++20',
'warning_level=3',
],
version: '47.0',
meson_version: '>=0.57.0',
)
gnome = import('gnome')
i18n = import('i18n')
cc = meson.get_compiler('c')
cx = meson.get_compiler('cpp')
if get_option('development')
app_id = 'org.gnome.SystemMonitor.Devel'
else
app_id = 'org.gnome.SystemMonitor'
endif
gettext_package = meson.project_name()
conf = configuration_data()
conf.set_quoted('APP_ID', app_id)
conf.set_quoted('VERSION', meson.project_version())
conf.set_quoted('GETTEXT_PACKAGE', gettext_package)
conf.set_quoted('GNOMELOCALEDIR',
join_paths(get_option('prefix'), get_option('localedir'))
)
conf.set_quoted('GSM_LIBEXEC_DIR',
join_paths(get_option('prefix'), get_option('libexecdir'), meson.project_name())
)
dataconf = configuration_data()
dataconf.set('APP_ID', app_id)
dataconf.set('VERSION', meson.project_version())
dataconf.set('GETTEXT_PACKAGE', gettext_package)
dataconf.set('pkglibexecdir',
join_paths(get_option('prefix'),get_option('libexecdir'),meson.project_name())
)
prefix = get_option('prefix')
datadir = join_paths(prefix, get_option('datadir'))
################################################################################
# Dependencies
giomm = dependency('giomm-2.68', version: '>=2.68')
glib = dependency('glib-2.0', version: '>=2.56.0')
glibmm = dependency('glibmm-2.68', version: '>=2.68')
gmodule = dependency('gmodule-2.0')
gtk = dependency('gtk4', version: '>=4.12.0')
gtkmm = dependency('gtkmm-4.0', version: '>=4.0.0')
libgtop = dependency('libgtop-2.0', version: '>=2.41.2')
libadwaita = dependency('libadwaita-1',version: '>=1.6.alpha')
librsvg = dependency('librsvg-2.0', version: '>=2.46')
libxml = dependency('libxml-2.0', version: '>=2.0')
if get_option('systemd')
libsystemd = dependency('libsystemd', version: '>=44')
else
libsystemd = dependency('', required: false)
endif
conf.set('HAVE_SYSTEMD', libsystemd.found())
################################################################################
# Compiler flags
extra_flags = [
'-Wcast-align',
'-Wchar-subscripts',
'-Winline',
'-Wmissing-declarations',
'-Wpointer-arith',
'-Wsign-compare',
]
extra_cflags = [
'-Wmissing-prototypes',
'-Wnested-externs',
]
extra_cxxflags = [
# '-fvisibility=hidden',
# '-fvisibility-inlines-hidden',
]
cflags = extra_flags + extra_cflags
cxxflags = extra_flags + extra_cxxflags
add_project_arguments(cc.get_supported_arguments(cflags),
language: 'c'
)
add_project_arguments(cx.get_supported_arguments(cxxflags),
language: 'cpp'
)
conf.set('HAVE_LKSTRFTIME', cc.has_function('strftime'))
configure_file(
output: 'config.h',
configuration: conf,
)
################################################################################
# Tests
python3 = find_program('python3', required: false)
git = find_program('git', required: false)
patch = find_program('patch', required: false)
uncrustify = find_program('uncrustify', required: false)
check_style_file = files('check-style.py')
check_style_prog = find_program(check_style_file)
if python3.found() and git.found() and patch.found() and uncrustify.found()
test('code formatting',
check_style_prog,
args: ['--all', '--dry-run'],
suite: 'formatting',
)
else
message('Code formatting test requires: python3, git, patch, uncrustify')
endif
################################################################################
# Subdirectories
rootInclude = include_directories('.')
subdir('data')
subdir('po')
subdir('scripts')
subdir('src')
subdir('help')
message('\n'.join(['',
'Configuration:',
'',
' Source code location: @0@'.format(meson.project_source_root()),
' C Compiler: @0@ @1@'.format(cc.get_id(), cc.version()),
' C++ Compiler: @0@ @1@'.format(cx.get_id(), cx.version()),
' CFLAGS: @0@'.format(cflags),
' CXXFLAGS: @0@'.format(cxxflags),
' systemd support: @0@'.format(libsystemd.found()),
]))
# Extra scripts
gnome.post_install(
glib_compile_schemas: true,
gtk_update_icon_cache: true,
)