diff options
Diffstat (limited to 'examples.meson.build')
-rw-r--r-- | examples.meson.build | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/examples.meson.build b/examples.meson.build new file mode 100644 index 0000000..4f3156e --- /dev/null +++ b/examples.meson.build @@ -0,0 +1,136 @@ +# Client examples are now available from a separate repository, +# https://gitlab.freedesktop.org/wlroots/wlr-clients +project( + 'wlroots-examples', + 'c', + meson_version: '>=0.58.0', + default_options: [ + 'c_std=c11', + 'warning_level=2', + 'werror=false', + ], +) + +cc = meson.get_compiler('c') +add_global_arguments('-DWLR_USE_UNSTABLE', language : 'c') + +cairo = dependency('cairo') +drm = dependency('libdrm') +egl = dependency('egl') +glesv2 = dependency('glesv2') +# Only needed for drm_fourcc.h +libdrm = dependency('libdrm').partial_dependency(compile_args: true, includes: true) +wayland_client = dependency('wayland-client') +wayland_egl = dependency('wayland-egl') +wayland_protos = dependency('wayland-protocols', version: '>=1.27') +wayland_scanner_dep = dependency('wayland-scanner', native: true) +wayland_scanner = find_program( + wayland_scanner_dep.get_variable('wayland_scanner'), + native: true, +) +wayland_server = dependency('wayland-server') +wlroots = dependency('wlroots-0.18') +xkbcommon = dependency('xkbcommon') + +wl_protocol_dir = wayland_protos.get_variable('pkgdatadir') + +protocols = { + # Stable upstream protocols + 'xdg-shell': wl_protocol_dir / 'stable/xdg-shell/xdg-shell.xml', + + # Unstable upstream protocols + 'fullscreen-shell-unstable-v1': wl_protocol_dir / 'unstable/fullscreen-shell/fullscreen-shell-unstable-v1.xml', +} + +protocols_code = {} +protocols_server_header = {} +protocols_client_header = {} + +foreach name, path : protocols + code = custom_target( + name.underscorify() + '_c', + input: path, + output: '@BASENAME@-protocol.c', + command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'], + ) + + server_header = custom_target( + name.underscorify() + '_server_h', + input: path, + output: '@BASENAME@-protocol.h', + command: [wayland_scanner, 'server-header', '@INPUT@', '@OUTPUT@'], + ) + + client_header = custom_target( + name.underscorify() + '_client_h', + input: path, + output: '@BASENAME@-client-protocol.h', + command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'], + build_by_default: false, + ) + + protocols_code += { name: code } + protocols_server_header += { name: server_header } + protocols_client_header += { name: client_header } +endforeach + + +compositors = { + 'simple': { + 'src': 'simple.c', + }, + 'pointer': { + 'src': 'pointer.c', + }, + 'touch': { + 'src': ['touch.c', 'cat.c'], + }, + 'tablet': { + 'src': 'tablet.c', + }, + 'rotation': { + 'src': ['rotation.c', 'cat.c'], + }, + 'output-layout': { + 'src': ['output-layout.c', 'cat.c'], + }, + 'fullscreen-shell': { + 'src': 'fullscreen-shell.c', + 'proto': ['fullscreen-shell-unstable-v1'], + }, + 'scene-graph': { + 'src': 'scene-graph.c', + 'proto': ['xdg-shell'], + }, + 'output-layers': { + 'src': 'output-layers.c', + 'proto': [ + 'xdg-shell', + ], + }, + 'cairo-buffer': { + 'src': 'cairo-buffer.c', + 'dep': cairo, + }, + 'embedded': { + 'src': [ + 'embedded.c', + protocols_code['xdg-shell'], + protocols_client_header['xdg-shell'], + ], + 'dep': [wayland_client, wayland_egl, egl, glesv2], + }, +} + +foreach name, info : compositors + extra_src = [] + foreach p : info.get('proto', []) + extra_src += protocols_server_header[p] + endforeach + + executable( + name, + [info.get('src'), extra_src], + dependencies: [libdrm, wlroots, wayland_server, xkbcommon, info.get('dep', [])], + ) +endforeach |