1 project('agl-compositor',
8 meson_version: '>= 0.47',
12 config_h = configuration_data()
14 cc = meson.get_compiler('c')
15 add_project_arguments(
16 cc.get_supported_arguments([
17 '-Wno-unused-parameter',
25 add_project_arguments([
26 '-DPACKAGE_STRING="agl-compositor @0@"'.format(meson.project_version()),
33 optional_libc_funcs = [ 'memfd_create', 'strchrnul' ]
34 foreach func: optional_libc_funcs
35 if cc.has_function(func)
36 add_project_arguments('-DHAVE_@0@=1'.format(func.to_upper()), language: 'c')
40 dep_libsystemd = dependency('libsystemd', required: false)
41 dep_scanner = dependency('wayland-scanner', native: true)
42 prog_scanner = find_program(dep_scanner.get_pkgconfig_variable('wayland_scanner'))
43 dep_wp = dependency('wayland-protocols', version: '>= 1.18')
44 dir_wp_base = dep_wp.get_pkgconfig_variable('pkgdatadir')
46 agl_shell_xml = files('protocol/agl-shell.xml')
47 xdg_shell_xml = join_paths(dir_wp_base, 'stable', 'xdg-shell', 'xdg-shell.xml')
50 { 'name': 'agl-shell', 'source': 'internal' },
51 { 'name': 'xdg-shell', 'source': 'wp-stable' },
54 foreach proto: protocols
55 proto_name = proto['name']
56 if proto['source'] == 'internal'
57 base_file = proto_name
58 xml_path = join_paths('protocol', '@0@.xml'.format(base_file))
59 elif proto['source'] == 'wp-stable'
60 base_file = proto_name
61 xml_path = join_paths(dir_wp_base, 'stable', proto_name, '@0@.xml'.format(base_file))
63 base_file = '@0@-unstable-@1@'.format(proto_name, proto['version'])
64 xml_path = join_paths(dir_wp_base, 'unstable', proto_name, '@0@.xml'.format(base_file))
67 foreach output_type: [ 'client-header', 'server-header', 'private-code' ]
68 if output_type == 'client-header'
69 output_file = '@0@-client-protocol.h'.format(base_file)
70 elif output_type == 'server-header'
71 output_file = '@0@-server-protocol.h'.format(base_file)
73 output_file = '@0@-protocol.c'.format(base_file)
74 if dep_scanner.version().version_compare('< 1.14.91')
79 var_name = output_file.underscorify()
80 target = custom_target(
81 '@0@ @1@'.format(base_file, output_type),
82 command: [ prog_scanner, output_type, '@INPUT@', '@OUTPUT@' ],
87 set_variable(var_name, target)
91 # libweston-6 pkg-config file already has 'libweston-6' as prefix but
92 # agl-compositor uses 'libweston-6' also. This makes use of the prefix
93 # path as to allow building and installing the compositor locally
94 prefix_path = get_option('prefix')
95 message('prefix_path ' + prefix_path)
96 if not prefix_path.contains('/usr')
97 additional_include_dir = include_directories(prefix_path + '/' + 'include')
98 local_dep = declare_dependency(include_directories: additional_include_dir)
104 dependency('wayland-server'),
105 dependency('libweston-7'),
106 dependency('libweston-desktop-7'),
110 srcs_agl_compositor = [
115 'shared/option-parser.c',
116 'shared/os-compatibility.c',
117 agl_shell_server_protocol_h,
118 agl_shell_protocol_c,
119 xdg_shell_protocol_c,
122 if dep_libsystemd.found()
123 config_h.set('HAVE_SYSTEMD', 1)
125 srcs_agl_compositor += 'src/systemd-notify.c'
126 deps_libweston += dep_libsystemd
128 message('Found systemd, enabling notify support')
131 configure_file(output: 'config.h', configuration: config_h)
133 exe_agl_compositor = executable(
136 dependencies: deps_libweston,