1 project('agl-compositor',
9 meson_version: '>= 0.53',
13 config_h = configuration_data()
14 libweston_version = 'libweston-10'
15 pkgconfig = import('pkgconfig')
18 cc = meson.get_compiler('c')
19 cxx = meson.get_compiler('cpp')
21 add_project_arguments(
22 cc.get_supported_arguments([
23 '-Wno-unused-parameter',
29 add_project_arguments([
30 '-DPACKAGE_STRING="agl-compositor @0@"'.format(meson.project_version()),
37 optional_libc_funcs = [ 'memfd_create', 'strchrnul' ]
38 foreach func: optional_libc_funcs
39 if cc.has_function(func)
40 add_project_arguments('-DHAVE_@0@=1'.format(func.to_upper()), language: 'c')
44 dep_libsystemd = dependency('libsystemd', required: false)
45 dep_libsmack = dependency('libsmack', required: false)
46 dep_scanner = dependency('wayland-scanner')
47 prog_scanner = find_program(dep_scanner.get_pkgconfig_variable('wayland_scanner'))
48 dep_wp = dependency('wayland-protocols', version: '>= 1.18')
49 dir_wp_base = dep_wp.get_pkgconfig_variable('pkgdatadir')
52 'gstreamer-1.0', 'gstreamer-allocators-1.0',
53 'gstreamer-app-1.0', 'gstreamer-video-1.0',
54 'gobject-2.0', 'glib-2.0'
58 foreach depname : depnames
59 dep = dependency(depname, required: false)
61 message('Remoting requires @0@ which was not found. '.format(depname))
67 agl_shell_xml = files('protocol/agl-shell.xml')
68 agl_shell_desktop_xml = files('protocol/agl-shell-desktop.xml')
69 agl_screenshooter = files('protocol/agl-screenshooter.xml')
70 xdg_shell_xml = join_paths(dir_wp_base, 'stable', 'xdg-shell', 'xdg-shell.xml')
73 { 'name': 'agl-shell', 'source': 'internal' },
74 { 'name': 'agl-shell-desktop', 'source': 'internal' },
75 { 'name': 'agl-screenshooter', 'source': 'internal' },
76 { 'name': 'xdg-shell', 'source': 'wp-stable' },
77 { 'name': 'xdg-output', 'source': 'unstable', 'version': 'v1' },
80 foreach proto: protocols
81 proto_name = proto['name']
82 if proto['source'] == 'internal'
83 base_file = proto_name
84 xml_path = join_paths('protocol', '@0@.xml'.format(base_file))
85 elif proto['source'] == 'wp-stable'
86 base_file = proto_name
87 xml_path = join_paths(dir_wp_base, 'stable', proto_name, '@0@.xml'.format(base_file))
89 base_file = '@0@-unstable-@1@'.format(proto_name, proto['version'])
90 xml_path = join_paths(dir_wp_base, 'unstable', proto_name, '@0@.xml'.format(base_file))
93 foreach output_type: [ 'client-header', 'server-header', 'private-code' ]
94 if output_type == 'client-header'
95 output_file = '@0@-client-protocol.h'.format(base_file)
96 elif output_type == 'server-header'
97 output_file = '@0@-server-protocol.h'.format(base_file)
99 output_file = '@0@-protocol.c'.format(base_file)
100 if dep_scanner.version().version_compare('< 1.14.91')
105 var_name = output_file.underscorify()
106 target = custom_target(
107 '@0@ @1@'.format(base_file, output_type),
108 command: [ prog_scanner, output_type, '@INPUT@', '@OUTPUT@' ],
113 set_variable(var_name, target)
117 prefix_path = get_option('prefix')
118 dir_data = join_paths(prefix_path, get_option('datadir'))
119 dir_data_agl_compositor = join_paths('agl-compositor', 'protocols')
120 dir_data_pc = join_paths(dir_data, 'pkgconfig')
121 libweston_dep = dependency(libweston_version)
124 dependency('wayland-server'),
125 dependency('weston'),
127 dependency('libweston-desktop-10'),
131 srcs_agl_compositor = [
137 'src/screenshooter.c',
139 'shared/option-parser.c',
140 'shared/os-compatibility.c',
141 'shared/process-util.c',
142 agl_shell_server_protocol_h,
143 agl_shell_desktop_server_protocol_h,
144 agl_screenshooter_server_protocol_h,
145 agl_shell_protocol_c,
146 agl_shell_desktop_protocol_c,
147 agl_screenshooter_protocol_c,
148 xdg_shell_protocol_c,
151 policy_to_install = get_option('policy-default')
152 if policy_to_install == 'auto' or policy_to_install == 'allow-all'
153 srcs_agl_compositor += 'src/policy-default.c'
154 message('Installing allow all policy')
155 elif policy_to_install == 'deny-all'
156 srcs_agl_compositor += 'src/policy-deny.c'
157 message('Installing deny all policy')
158 elif policy_to_install == 'rba'
159 srcs_agl_compositor += ['src/policy-rba.c', 'src/rba_adapter.cpp']
160 deps_libweston += dependency('librba')
161 message('Installing rba policy')
164 # From meson documentation:
165 # In order to look for headers in a specific directory you can use args :
166 # '-I/extra/include/dir, but this should only be used in exceptional cases for
167 # includes that can't be detected via pkg-config and passed via dependencies.
168 if libweston_dep.found()
169 if not meson.is_cross_build()
170 if not prefix_path.contains('/usr')
171 dir_path_x11_backend = join_paths(prefix_path, 'include', libweston_version, 'libweston', 'backend-x11.h')
172 dir_path_headless_backend = join_paths(prefix_path, 'include', libweston_version, 'libweston', 'backend-headless.h')
174 dir_path_x11_backend = join_paths(libweston_version, 'libweston', 'backend-x11.h')
175 dir_path_x11_backend = join_paths(libweston_version, 'libweston', 'backend-headless.h')
178 message('Building with cross environment')
179 dir_path_x11_backend = join_paths(libweston_version, 'libweston', 'backend-x11.h')
180 dir_path_headless_backend = join_paths(libweston_version, 'libweston', 'backend-headless.h')
184 if cc.has_header(dir_path_x11_backend)
185 config_h.set('HAVE_BACKEND_X11', 1)
186 message('Building with X11 backend')
189 if cc.has_header(dir_path_headless_backend)
190 config_h.set('HAVE_BACKEND_HEADLESS', 1)
191 message('Building with headless backend')
195 if dep_libsystemd.found()
196 config_h.set('HAVE_SYSTEMD', 1)
198 srcs_agl_compositor += 'src/systemd-notify.c'
199 deps_libweston += dep_libsystemd
201 message('Found systemd, enabling notify support')
204 if deps_remoting.length() == depnames.length()
205 config_h.set('HAVE_REMOTING', 1)
206 message('Found remoting depends, enabling remoting')
209 if dep_libsmack.found()
210 config_h.set('HAVE_SMACK', 1)
211 deps_libweston += dep_libsmack
214 dir_module_agl_compositor = join_paths(join_paths(prefix_path, get_option('libdir')), 'agl-compositor')
216 libexec_compositor = shared_library(
218 sources: srcs_agl_compositor,
219 dependencies: deps_libweston,
220 install_dir: dir_module_agl_compositor,
222 version: meson.project_version(),
226 dep_libexec_compositor = declare_dependency(
227 link_with: libexec_compositor,
228 include_directories: [ include_directories('.') ],
229 dependencies: deps_libweston,
232 configure_file(output: 'config.h', configuration: config_h)
234 exe_agl_compositor = executable(
237 dependencies: dep_libexec_compositor,
238 install_rpath: dir_module_agl_compositor,
243 filebase: 'agl-compositor-@0@-protocols'.format(meson.project_version()),
244 name: 'agl-compositor private protocols',
245 version: meson.project_version(),
246 description: 'agl-compositor protocol files',
248 'datarootdir=' + join_paths('${prefix}', get_option('datadir')),
249 'pkgdatadir=' + join_paths('${pc_sysrootdir}${datarootdir}', dir_data_agl_compositor)
251 install_dir: dir_data_pc
255 [ agl_shell_xml, agl_shell_desktop_xml ],
256 install_dir: join_paths(dir_data, dir_data_agl_compositor)
259 common_inc = [ include_directories('src'), include_directories('.') ]
262 if get_option('grpc-proxy')