-
Notifications
You must be signed in to change notification settings - Fork 10
/
meson.build
101 lines (93 loc) · 2.45 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
project('gnome-power-manager', 'c',
version : '43.1',
default_options : ['warning_level=1'],
meson_version : '>=0.46.0'
)
conf = configuration_data()
conf.set('VERSION', meson.project_version())
# get suported warning flags
test_args = [
'-Waggregate-return',
'-Warray-bounds',
'-Wcast-align',
'-Wclobbered',
'-Wdeclaration-after-statement',
'-Wempty-body',
'-Wextra',
'-Wformat=2',
'-Wformat-nonliteral',
'-Wformat-security',
'-Wformat-signedness',
'-Wignored-qualifiers',
'-Wimplicit-function-declaration',
'-Winit-self',
'-Winline',
'-Wmissing-declarations',
'-Wmissing-format-attribute',
'-Wmissing-include-dirs',
'-Wmissing-noreturn',
'-Wmissing-parameter-type',
'-Wmissing-prototypes',
'-Wnested-externs',
'-Wno-discarded-qualifiers',
'-Wno-missing-field-initializers',
'-Wno-strict-aliasing',
'-Wno-suggest-attribute=format',
'-Wno-unused-parameter',
'-Wold-style-definition',
'-Woverride-init',
'-Wpacked',
'-Wpointer-arith',
'-Wredundant-decls',
'-Wreturn-type',
'-Wshadow',
'-Wsign-compare',
'-Wstrict-aliasing',
'-Wstrict-prototypes',
'-Wswitch-default',
'-Wtype-limits',
'-Wundef',
'-Wuninitialized',
'-Wunused-but-set-variable',
'-Wwrite-strings'
]
cc = meson.get_compiler('c')
foreach arg: test_args
if cc.has_argument(arg)
add_project_arguments(arg, language : 'c')
endif
endforeach
# enable full RELRO where possible
# FIXME: until https://github.com/mesonbuild/meson/issues/1140 is fixed
test_link_args = [
'-Wl,-z,relro',
'-Wl,-z,now',
]
foreach arg: test_link_args
if cc.has_link_argument(arg)
add_project_link_arguments(arg, language : 'c')
endif
endforeach
gtk = dependency('gtk4', version: '>= 4.0.0')
cairo = dependency('cairo', version : '>= 1.0.0')
upower = dependency('upower-glib', version : '>= 0.99.8')
libm = cc.find_library('libm', required: false)
gnome = import('gnome')
i18n = import('i18n')
conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
conf.set_quoted('LOCALEDIR',
join_paths(get_option('prefix'),
get_option('localedir')))
conf.set_quoted('DATADIR',
join_paths(get_option('prefix'),
get_option('datadir')))
configure_file(
output : 'config.h',
configuration : conf
)
subdir('src')
subdir('man')
subdir('po')
subdir('data')
# FIXME: remove when https://github.com/mesonbuild/meson/issues/837 fixed
meson.add_install_script('meson_post_install.sh')