From cff1c2f740a2f7d22339a0fae14c4923223a8d61 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Fri, 22 Nov 2019 20:11:15 +1300 Subject: meson: Various improvements Bumps minimum version to 0.51.0 - Remove all intermediate static libraries. They serve no purpose and are just add a bunch of boilerplate for managing dependencies and options. It's now managed as a list of files which are compiled into libwlroots directly. - Use install_subdir instead of installing headers individually. I've changed my mind since I did that. Listing them out is annoying as hell, and it's easy to forget to do it. - Add not_found_message for all of our optional dependencies that have a meson option. It gives some hints about what option to pass and what the optional dependency is for. - Move all backend subdirectories into their own meson.build. This keeps some of the backend-specific build logic (especially rdp and session) more neatly separated off. - Don't overlink example clients with code they're not using. This was done by merging the protocol dictionaries and setting some variables containing the code and client header file. Example clients now explicitly mention what extension protocols they want to link to. - Split compositor example logic from client example logic. - Minor formatting changes --- backend/drm/meson.build | 10 +++++ backend/headless/meson.build | 5 +++ backend/libinput/meson.build | 10 +++++ backend/meson.build | 90 +++++--------------------------------------- backend/multi/meson.build | 1 + backend/noop/meson.build | 4 ++ backend/rdp/meson.build | 36 ++++++++++++++++++ backend/session/meson.build | 53 ++++++++++++++++++++++++++ backend/wayland/meson.build | 20 ++++++++++ backend/x11/meson.build | 34 ++++++++--------- 10 files changed, 166 insertions(+), 97 deletions(-) create mode 100644 backend/drm/meson.build create mode 100644 backend/headless/meson.build create mode 100644 backend/libinput/meson.build create mode 100644 backend/multi/meson.build create mode 100644 backend/noop/meson.build create mode 100644 backend/rdp/meson.build create mode 100644 backend/session/meson.build create mode 100644 backend/wayland/meson.build (limited to 'backend') diff --git a/backend/drm/meson.build b/backend/drm/meson.build new file mode 100644 index 00000000..ffddfdfc --- /dev/null +++ b/backend/drm/meson.build @@ -0,0 +1,10 @@ +wlr_files += files( + 'atomic.c', + 'backend.c', + 'cvt.c', + 'drm.c', + 'legacy.c', + 'properties.c', + 'renderer.c', + 'util.c', +) diff --git a/backend/headless/meson.build b/backend/headless/meson.build new file mode 100644 index 00000000..e38ce133 --- /dev/null +++ b/backend/headless/meson.build @@ -0,0 +1,5 @@ +wlr_files += files( + 'backend.c', + 'input_device.c', + 'output.c', +) diff --git a/backend/libinput/meson.build b/backend/libinput/meson.build new file mode 100644 index 00000000..ff78d2f8 --- /dev/null +++ b/backend/libinput/meson.build @@ -0,0 +1,10 @@ +wlr_files += files( + 'backend.c', + 'events.c', + 'keyboard.c', + 'pointer.c', + 'switch.c', + 'tablet_pad.c', + 'tablet_tool.c', + 'touch.c', +) diff --git a/backend/meson.build b/backend/meson.build index e4a484f4..373102b6 100644 --- a/backend/meson.build +++ b/backend/meson.build @@ -1,82 +1,12 @@ -backend_parts = [] -backend_files = files( - 'backend.c', - 'drm/atomic.c', - 'drm/backend.c', - 'drm/cvt.c', - 'drm/drm.c', - 'drm/legacy.c', - 'drm/properties.c', - 'drm/renderer.c', - 'drm/util.c', - 'headless/backend.c', - 'headless/input_device.c', - 'headless/output.c', - 'libinput/backend.c', - 'libinput/events.c', - 'libinput/keyboard.c', - 'libinput/pointer.c', - 'libinput/switch.c', - 'libinput/tablet_pad.c', - 'libinput/tablet_tool.c', - 'libinput/touch.c', - 'multi/backend.c', - 'noop/backend.c', - 'noop/output.c', - 'session/direct-ipc.c', - 'session/noop.c', - 'session/session.c', - 'wayland/backend.c', - 'wayland/output.c', - 'wayland/wl_seat.c', - 'wayland/tablet_v2.c', -) - -backend_deps = [ - drm, - egl, - gbm, - libinput, - pixman, - xkbcommon, - wayland_server, - wlr_protos, - wlr_render, -] - -if host_machine.system().startswith('freebsd') - backend_files += files('session/direct-freebsd.c') -else - backend_files += files('session/direct.c') -endif - -if logind.found() - backend_files += files('session/logind.c') - backend_deps += logind -endif - -if freerdp.found() and winpr2.found() - backend_files += files( - 'rdp/backend.c', - 'rdp/keyboard.c', - 'rdp/listener.c', - 'rdp/output.c', - 'rdp/peer.c', - 'rdp/pointer.c', - ) - backend_deps += [ - freerdp, - winpr2 - ] - conf_data.set10('WLR_HAS_RDP_BACKEND', true) -endif - +wlr_files += files('backend.c') + +subdir('drm') +subdir('headless') +subdir('libinput') +subdir('multi') +subdir('noop') +subdir('rdp') +subdir('wayland') subdir('x11') -lib_wlr_backend = static_library( - 'wlr_backend', - backend_files, - include_directories: wlr_inc, - link_whole: backend_parts, - dependencies: backend_deps, -) +subdir('session') diff --git a/backend/multi/meson.build b/backend/multi/meson.build new file mode 100644 index 00000000..be4abfb6 --- /dev/null +++ b/backend/multi/meson.build @@ -0,0 +1 @@ +wlr_files += files('backend.c') diff --git a/backend/noop/meson.build b/backend/noop/meson.build new file mode 100644 index 00000000..950c0716 --- /dev/null +++ b/backend/noop/meson.build @@ -0,0 +1,4 @@ +wlr_files += files( + 'backend.c', + 'output.c', +) diff --git a/backend/rdp/meson.build b/backend/rdp/meson.build new file mode 100644 index 00000000..40259c65 --- /dev/null +++ b/backend/rdp/meson.build @@ -0,0 +1,36 @@ +rdp_libs = [] +rdp_required = [ + 'freerdp2', + 'winpr2', +] + +msg = [] +if get_option('freerdp').enabled() + msg += 'Install "@0@" or pass "-Dfreerdp=disabled".' +endif +if not get_option('freerdp').disabled() + msg += 'Required for RDP backend support.' +endif + +foreach lib : rdp_required + dep = dependency(lib, + required: get_option('freerdp'), + not_found_message: '\n'.join(msg).format(lib), + ) + if not dep.found() + subdir_done() + endif + + rdp_libs += dep +endforeach + +wlr_files += files( + 'backend.c', + 'keyboard.c', + 'listener.c', + 'output.c', + 'peer.c', + 'pointer.c', +) +wlr_deps += rdp_libs +conf_data.set10('WLR_HAS_RDP_BACKEND', true) diff --git a/backend/session/meson.build b/backend/session/meson.build new file mode 100644 index 00000000..2c3f09c7 --- /dev/null +++ b/backend/session/meson.build @@ -0,0 +1,53 @@ +wlr_files += files( + 'direct-ipc.c', + 'noop.c', + 'session.c', +) + +if host_machine.system().startswith('freebsd') + wlr_files += files('direct-freebsd.c') +else + wlr_files += files('direct.c') +endif + +# logind + +msg = [] +if get_option('logind').enabled() + msg += 'Install "lib@0@" or pass "-Dlogind=disabled".' +endif +if not get_option('logind').disabled() + msg += 'Required for logind support.' + msg += 'You may need to pass "-Dlogind-provider=elogind" or "-Dlogind-provider=systemd" to ensure the correct library is detected.' +endif + +logind = dependency('lib' + get_option('logind-provider'), + required: get_option('logind'), + not_found_message: '\n'.join(msg).format(get_option('logind-provider')), + version: '>=237', +) +if logind.found() + wlr_files += files('logind.c') + wlr_deps += logind + conf_data.set10('WLR_HAS_' + get_option('logind-provider').to_upper(), true) +endif + +# libcap + +msg = [] +if get_option('libcap').enabled() + msg += 'Install "libcap" or pass "-Dlibcap=disabled".' +endif +if not get_option('libcap').disabled() + msg += 'Required for POSIX capability support (Not needed if using logind).' +endif + +libcap = dependency('libcap', + required: get_option('libcap'), + not_found_message: '\n'.join(msg), +) +if libcap.found() + conf_data.set10('WLR_HAS_LIBCAP', true) + wlr_deps += libcap +endif + diff --git a/backend/wayland/meson.build b/backend/wayland/meson.build new file mode 100644 index 00000000..73336d20 --- /dev/null +++ b/backend/wayland/meson.build @@ -0,0 +1,20 @@ +wlr_files += files( + 'backend.c', + 'output.c', + 'wl_seat.c', + 'tablet_v2.c', +) + +client_protos = [ + 'linux-dmabuf-unstable-v1', + 'pointer-gestures-unstable-v1', + 'presentation-time', + 'relative-pointer-unstable-v1', + 'tablet-unstable-v2', + 'xdg-decoration-unstable-v1', + 'xdg-shell', +] + +foreach proto : client_protos + wlr_files += get_variable(proto.underscorify() + '_h') +endforeach diff --git a/backend/x11/meson.build b/backend/x11/meson.build index 19e873ab..40530bb0 100644 --- a/backend/x11/meson.build +++ b/backend/x11/meson.build @@ -6,8 +6,19 @@ x11_required = [ 'xcb-xfixes', ] +msg = [] +if get_option('x11-backend').enabled() + msg += 'Install "@0@" or pass "-Dx11-backend=disabled" to disable it.' +endif +if not get_option('x11-backend').disabled() + msg += 'Required for X11 backend support.' +endif + foreach lib : x11_required - dep = dependency(lib, required: get_option('x11-backend')) + dep = dependency(lib, + required: get_option('x11-backend'), + not_found_message: '\n'.join(msg).format(lib), + ) if not dep.found() subdir_done() endif @@ -15,21 +26,10 @@ foreach lib : x11_required x11_libs += dep 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, - ], +wlr_files += files( + 'backend.c', + 'input_device.c', + 'output.c', ) - -backend_parts += lib_wlr_backend_x11 +wlr_deps += x11_libs conf_data.set10('WLR_HAS_X11_BACKEND', true) -- cgit v1.2.3