From 784c20c82fb6fb84c5ce49993b5a2ec0bda13475 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 22 Aug 2018 20:27:37 +1200 Subject: [PATCH] Use new options for X11 backend and Xwayland --- backend/meson.build | 11 +++------ backend/x11/meson.build | 44 ++++++++++++++++++++++++++++++++++ meson.build | 53 ++++------------------------------------- meson_options.txt | 3 --- rootston/meson.build | 6 +++-- xwayland/meson.build | 41 +++++++++++++++++++++++++------ 6 files changed, 90 insertions(+), 68 deletions(-) create mode 100644 backend/x11/meson.build diff --git a/backend/meson.build b/backend/meson.build index 48a0511a..dd1f4df3 100644 --- a/backend/meson.build +++ b/backend/meson.build @@ -1,3 +1,4 @@ +backend_parts = [] backend_files = files( 'backend.c', 'drm/atomic.c', @@ -49,18 +50,12 @@ if logind.found() backend_deps += logind endif -if conf_data.get('WLR_HAS_X11_BACKEND', false) - backend_files += files( - 'x11/backend.c', - 'x11/input_device.c', - 'x11/output.c', - ) - backend_deps += xcb_xkb -endif +subdir('x11') lib_wlr_backend = static_library( 'wlr_backend', backend_files, include_directories: wlr_inc, + link_whole: backend_parts, dependencies: backend_deps, ) diff --git a/backend/x11/meson.build b/backend/x11/meson.build new file mode 100644 index 00000000..1164df1e --- /dev/null +++ b/backend/x11/meson.build @@ -0,0 +1,44 @@ +x11_libs = [] +x11_required = [ + 'xcb', + 'x11-xcb', +] +x11_optional = [ + 'xcb-xkb', +] + +foreach lib : x11_required + dep = dependency(lib, required: get_option('x11-backend')) + if not dep.found() + subdir_done() + endif + + x11_libs += dep +endforeach + +foreach lib : x11_optional + dep = dependency(lib, required: get_option(lib)) + if dep.found() + x11_libs += dep + conf_data.set('WLR_HAS_' + lib.underscorify().to_upper(), true) + endif +endforeach + +lib_wlr_backend_x11 = static_library( + 'wlr_backend_x11', + files( + 'backend.c', + 'input_device.c', + 'output.c', + ), + include_directories: wlr_inc, + dependencies: [ + wayland_server, + pixman, + xkbcommon, + x11_libs, + ], +) + +backend_parts += lib_wlr_backend_x11 +conf_data.set('WLR_HAS_X11_BACKEND', true) diff --git a/meson.build b/meson.build index 7d5266d2..ff1a4ee8 100644 --- a/meson.build +++ b/meson.build @@ -80,64 +80,21 @@ if logind.found() wlr_deps += logind endif -if get_option('enable-x11_backend') or get_option('enable-xwayland') - xcb = dependency('xcb') - xcb_composite = dependency('xcb-composite') - xcb_xfixes = dependency('xcb-xfixes') - xcb_image = dependency('xcb-image') - xcb_render = dependency('xcb-render') - x11_xcb = dependency('x11-xcb') - - xcb_icccm = dependency('xcb-icccm', required: false) - xcb_xkb = dependency('xcb-xkb', required: false) - xcb_errors = dependency('xcb-errors', required: get_option('enable-xcb_errors') == 'true') - - if xcb_icccm.found() - conf_data.set('WLR_HAS_XCB_ICCCM', true) - endif - - if xcb_xkb.found() - conf_data.set('WLR_HAS_XCB_XKB', true) - endif - - if xcb_errors.found() and get_option('enable-xcb_errors') != 'false' - conf_data.set('WLR_HAS_XCB_ERRORS', true) - endif - - wlr_deps += [ - xcb, - xcb_composite, - x11_xcb, - ] -else - add_project_arguments('-DMESA_EGL_NO_X11_HEADERS', language: 'c') -endif - -if get_option('enable-x11_backend') - conf_data.set('WLR_HAS_X11_BACKEND', true) -endif - -if get_option('enable-xwayland') - subdir('xwayland') - wlr_parts += [lib_wlr_xwayland] - conf_data.set('WLR_HAS_XWAYLAND', true) -else - exclude_headers += 'xwayland.h' -endif - if cc.has_header_symbol('fcntl.h', 'posix_fallocate', prefix: '#define _POSIX_C_SOURCE 200112L') conf_data.set('WLR_HAS_POSIX_FALLOCATE', true) endif +subdir('protocol') +subdir('render') +subdir('backend') +subdir('xwayland') + includedir = get_option('includedir') exclude_headers += 'meson.build' install_subdir('include/wlr', install_dir: includedir, exclude_files: exclude_headers) subdir('include') -subdir('protocol') -subdir('render') -subdir('backend') subdir('types') subdir('util') subdir('xcursor') diff --git a/meson_options.txt b/meson_options.txt index fd1fbf05..854022e7 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,6 +1,3 @@ -option('enable-xcb_errors', type: 'combo', choices: ['auto', 'true', 'false'], value: 'auto', description: 'Use xcb-errors util library') -option('enable-xwayland', type: 'boolean', value: true, description: 'Enable support X11 applications') -option('enable-x11_backend', type: 'boolean', value: true, description: 'Enable X11 backend') option('enable-rootston', type: 'boolean', value: true, description: 'Build the rootston example compositor') option('enable-examples', type: 'boolean', value: true, description: 'Build example applications') option('libcap', type: 'feature', value: 'auto', description: 'Enable support for rootless session via capabilities (cap_sys_admin)') diff --git a/rootston/meson.build b/rootston/meson.build index 8ab872b5..b461e1a0 100644 --- a/rootston/meson.build +++ b/rootston/meson.build @@ -14,9 +14,11 @@ sources = [ 'xdg_shell_v6.c', 'xdg_shell.c', ] -if get_option('enable-xwayland') - sources += ['xwayland.c'] + +if conf_data.get('WLR_HAS_XWAYLAND', false) + sources += 'xwayland.c' endif + executable( 'rootston', sources, dependencies: [wlroots, wlr_protos, pixman] ) diff --git a/xwayland/meson.build b/xwayland/meson.build index ec486f58..637f565e 100644 --- a/xwayland/meson.build +++ b/xwayland/meson.build @@ -1,3 +1,33 @@ +xwayland_libs = [] +xwayland_required = [ + 'xcb', + 'xcb-composite', + 'xcb-render', + 'xcb-xfixes', +] +xwayland_optional = [ + 'xcb-errors', + 'xcb-icccm', +] + +foreach lib : xwayland_required + dep = dependency(lib, required: get_option('xwayland')) + if not dep.found() + exclude_headers += 'xwayland.h' + subdir_done() + endif + + xwayland_libs += dep +endforeach + +foreach lib : xwayland_optional + dep = dependency(lib, required: get_option(lib)) + if dep.found() + xwayland_libs += dep + conf_data.set('WLR_HAS_' + lib.underscorify().to_upper(), true) + endif +endforeach + lib_wlr_xwayland = static_library( 'wlr_xwayland', files( @@ -12,14 +42,11 @@ lib_wlr_xwayland = static_library( include_directories: wlr_inc, dependencies: [ wayland_server, - xcb, - xcb_composite, - xcb_xfixes, - xcb_image, - xcb_render, - xcb_icccm, - xcb_errors, + xwayland_libs, xkbcommon, pixman, ], ) + +wlr_parts += lib_wlr_xwayland +conf_data.set('WLR_HAS_XWAYLAND', true)