-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
208 lines (182 loc) · 5.74 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
project('phoc', 'c',
version: '0.39.0',
license: 'GPLv3+',
meson_version: '>= 0.63.0',
default_options: [
'warning_level=1',
'buildtype=debugoptimized',
'c_std=gnu11',
],
)
add_project_arguments([
'-DWLR_USE_UNSTABLE',
'-I' + meson.project_build_root(),
], language: 'c')
root_inc = include_directories('.')
src_inc = include_directories('src')
protocol_inc = include_directories('protocols')
prefix = get_option('prefix')
bindir = prefix / get_option('bindir')
datadir = prefix / get_option('datadir')
localedir = prefix / get_option('localedir')
desktopdir = prefix / datadir / 'applications'
pkgdatadir = prefix / datadir / meson.project_name()
cc = meson.get_compiler('c')
glib_ver = '2.70'
glib_ver_str = 'GLIB_VERSION_@0@'.format(glib_ver.replace('.','_'))
glib_ver_cmp = '>=@0@'.format(glib_ver)
gio = dependency('gio-2.0', version: glib_ver_cmp)
glib = dependency('glib-2.0', version: glib_ver_cmp)
gobject = dependency('gobject-2.0', version: glib_ver_cmp)
glesv2 = dependency('glesv2')
gnome_desktop = dependency('gnome-desktop-3.0', version: '>=3.26')
gsettings_desktop_schemas_dep = dependency('gsettings-desktop-schemas')
input = dependency('libinput')
udev = dependency('libudev')
drm = dependency('libdrm')
pixman = dependency('pixman-1')
wayland_client = dependency('wayland-client')
wayland_protos = dependency('wayland-protocols', version: '>=1.15')
wayland_server = dependency('wayland-server')
xkbcommon = dependency('xkbcommon')
math = cc.find_library('m')
gmobile_dep = dependency('gmobile',
version: '>= 0.1.0',
fallback: ['gmobile', 'gmobile_dep'],
default_options: [
'examples=false',
'introspection=false',
'gtk_doc=false',
'tests=false',
])
embed_wlroots = get_option('embed-wlroots')
if not embed_wlroots.disabled()
# Try first to find wlroots as a subproject, then as a system dependency
wlroots_proj = subproject(
'wlroots',
default_options: ['examples=false', 'renderers=gles2'],
required: false,
)
if embed_wlroots.enabled() and not wlroots_proj.found()
error('Wlroots subproject not found but enabled')
endif
endif
if not embed_wlroots.disabled() and wlroots_proj.found()
wlroots = wlroots_proj.get_variable('wlroots')
else
wlroots = dependency('wlroots', version: ['>= 0.17.0', '< 0.18.0'])
endif
wlroots_has_xwayland = wlroots.get_variable(pkgconfig: 'have_xwayland',
internal: 'have_xwayland') == 'true'
if get_option('xwayland').enabled() and not wlroots_has_xwayland
error('Cannot enable Xwayland in phoc: wlroots has been built without Xwayland support')
endif
have_xwayland = get_option('xwayland').enabled()
use_dtrace = false
if not get_option('dtrace').disabled()
has_sdt = cc.has_header('sys/sdt.h')
if get_option('dtrace').enabled() and not has_sdt
error('Cannot enable tracing, sys/sdt.h not found')
endif
use_dtrace = has_sdt
endif
global_c_args = []
test_c_args = [
'-Wcast-align',
'-Wdate-time',
['-Werror=format-security', '-Werror=format=2'],
'-Wendif-labels',
'-Werror=incompatible-pointer-types',
'-Werror=missing-declarations',
'-Werror=overflow',
'-Werror=return-type',
'-Werror=shift-count-overflow',
'-Werror=shift-overflow=2',
'-Werror=implicit-fallthrough=3',
'-Wformat-nonliteral',
'-Wformat-security',
'-Winit-self',
'-Wmaybe-uninitialized',
'-Wmissing-field-initializers',
'-Wmissing-include-dirs',
'-Wmissing-noreturn',
'-Wnested-externs',
'-Wno-missing-field-initializers',
'-Wno-sign-compare',
'-Wno-strict-aliasing',
'-Wno-unused-parameter',
'-Wold-style-definition',
'-Wpointer-arith',
'-Wredundant-decls',
'-Wshadow',
'-Wstrict-prototypes',
'-Wtype-limits',
'-Wundef',
'-Wunused-function',
'-Wswitch-default',
]
# TODO:
# '-Wfloat-equal',
# '-Wswitch-enum',
if get_option('buildtype') != 'plain'
test_c_args += '-fstack-protector-strong'
endif
c_args = cc.get_supported_arguments(test_c_args)
if cc.get_id() == 'clang'
# Avoid cast align warnings for wl_container_of, etc
c_args += '-Wno-cast-align'
endif
add_project_arguments(
c_args,
language: 'c'
)
gnome = import('gnome')
i18n = import('i18n')
config_h = configuration_data()
config_h.set_quoted('GETTEXT_PACKAGE', meson.project_name())
config_h.set_quoted('LOCALEDIR', localedir)
config_h.set_quoted('PHOC_APP_ID', 'mobi.phosh.Phoc')
config_h.set_quoted('PHOC_VERSION', meson.project_version())
config_h.set('PHOC_XWAYLAND', have_xwayland,
description: 'Whether xwayland is enabled')
config_h.set('PHOC_USE_DTRACE', use_dtrace,
description: 'Whether tracing via dtrace/stp is enabled')
phoc_config_h = configure_file(
output: 'phoc-config.h',
configuration: config_h,
)
subdir('po')
subdir('protocols')
subdir('src')
subdir('tests')
subdir('helpers')
subdir('data')
subdir('doc')
subdir('examples')
run_data = configuration_data()
run_data.set('ABS_BUILDDIR', meson.current_build_dir())
run_data.set('ABS_SRCDIR', meson.current_source_dir())
configure_file(
input: 'run.in',
output: 'run',
configuration: run_data)
summary({
'wlroots version': wlroots.version(),
'wlroots as subproject': not embed_wlroots.disabled() and wlroots_proj.found(),
'Xwayland': have_xwayland,
'Documentation': get_option('gtk_doc'),
'Manual pages': get_option('man'),
'Tracing': use_dtrace,
'Tests': get_option('tests'),
},
bool_yn: true,
section: 'Build',
)
# gnome.post_install() is available since meson 0.59.0
# Distributions use their own tooling (e.g. postinst, triggers, etc)
# so it is okay if the post_install() is not run on distro builds
if meson.version().version_compare('>=0.59.0')
gnome.post_install(
glib_compile_schemas: true,
)
endif