diff options
author | Scott Anderson <scott@anderso.nz> | 2019-11-22 20:11:15 +1300 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-12-23 07:48:29 -0500 |
commit | cff1c2f740a2f7d22339a0fae14c4923223a8d61 (patch) | |
tree | f1ecfe2a5345f3b1ef5b94260e909c5143fcd64d | |
parent | fc6c0ca12e941d5d7d567834bff3ab7df9447001 (diff) |
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
-rw-r--r-- | backend/drm/meson.build | 10 | ||||
-rw-r--r-- | backend/headless/meson.build | 5 | ||||
-rw-r--r-- | backend/libinput/meson.build | 10 | ||||
-rw-r--r-- | backend/meson.build | 90 | ||||
-rw-r--r-- | backend/multi/meson.build | 1 | ||||
-rw-r--r-- | backend/noop/meson.build | 4 | ||||
-rw-r--r-- | backend/rdp/meson.build | 36 | ||||
-rw-r--r-- | backend/session/meson.build | 53 | ||||
-rw-r--r-- | backend/wayland/meson.build | 20 | ||||
-rw-r--r-- | backend/x11/meson.build | 34 | ||||
-rw-r--r-- | examples/meson.build | 108 | ||||
-rw-r--r-- | include/meson.build | 13 | ||||
-rw-r--r-- | include/wlr/backend/meson.build | 17 | ||||
-rw-r--r-- | include/wlr/backend/session/meson.build | 1 | ||||
-rw-r--r-- | include/wlr/interfaces/meson.build | 11 | ||||
-rw-r--r-- | include/wlr/meson.build | 24 | ||||
-rw-r--r-- | include/wlr/render/meson.build | 10 | ||||
-rw-r--r-- | include/wlr/types/meson.build | 53 | ||||
-rw-r--r-- | include/wlr/util/meson.build | 6 | ||||
-rw-r--r-- | meson.build | 104 | ||||
-rw-r--r-- | protocol/meson.build | 131 | ||||
-rw-r--r-- | render/meson.build | 35 | ||||
-rw-r--r-- | types/meson.build | 147 | ||||
-rw-r--r-- | util/meson.build | 17 | ||||
-rw-r--r-- | xcursor/meson.build | 11 | ||||
-rw-r--r-- | xwayland/meson.build | 65 |
26 files changed, 481 insertions, 535 deletions
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) diff --git a/examples/meson.build b/examples/meson.build index 4a6d1634..cfc4df86 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -8,9 +8,9 @@ libavformat = dependency('libavformat', version: '>=58.12.100', required: false, # epoll is a separate library in FreeBSD if host_machine.system() == 'freebsd' - libepoll = [dependency('epoll-shim')] + libepoll = dependency('epoll-shim') else - libepoll = [] + libepoll = dependency('', required: false) endif # Check if libavutil is found because of https://github.com/mesonbuild/meson/issues/6010 @@ -18,62 +18,84 @@ if libavutil.found() and not cc.has_header('libavutil/hwcontext_drm.h', dependen libavutil = disabler() endif -examples = { +compositors = { 'simple': { 'src': 'simple.c', - 'dep': [wlroots], }, 'pointer': { 'src': 'pointer.c', - 'dep': [wlroots], }, 'touch': { 'src': ['touch.c', 'cat.c'], - 'dep': [wlroots], }, 'tablet': { 'src': 'tablet.c', - 'dep': [wlroots], }, 'rotation': { 'src': ['rotation.c', 'cat.c'], - 'dep': [wlroots], }, 'multi-pointer': { 'src': 'multi-pointer.c', - 'dep': [wlroots], }, 'output-layout': { 'src': ['output-layout.c', 'cat.c'], - 'dep': [wlroots], }, + 'fullscreen-shell': { + 'src': 'fullscreen-shell.c', + }, +} + +clients = { 'idle': { 'src': 'idle.c', - 'dep': [wayland_client, wlr_protos, threads], + 'dep': threads, + 'proto': ['kde-idle'], }, 'idle-inhibit': { 'src': 'idle-inhibit.c', - 'dep': [wayland_client, wlr_protos, wlroots], + 'dep': wlroots, + 'proto': [ + 'idle-inhibit-unstable-v1', + 'xdg-shell', + ], }, 'layer-shell': { 'src': 'layer-shell.c', - 'dep': [wayland_client, wayland_cursor, wlr_protos, wlroots], + 'dep': [wayland_cursor, wlroots], + 'proto': [ + 'wlr-layer-shell-unstable-v1', + 'xdg-shell', + ], }, 'input-inhibitor': { 'src': 'input-inhibitor.c', - 'dep': [wayland_client, wayland_cursor, wlr_protos, wlroots], + 'dep': [wayland_cursor, wlroots], + 'proto': [ + 'wlr-input-inhibitor-unstable-v1', + 'xdg-shell', + ], }, 'gamma-control': { 'src': 'gamma-control.c', - 'dep': [wayland_client, wayland_cursor, wlr_protos, math], + 'dep': [wayland_cursor, math], + 'proto': ['wlr-gamma-control-unstable-v1'], }, 'pointer-constraints': { 'src': 'pointer-constraints.c', - 'dep': [wayland_client, wlr_protos, wlroots], + 'dep': wlroots, + 'proto': [ + 'pointer-constraints-unstable-v1', + 'xdg-shell', + ], }, 'relative-pointer': { 'src': 'relative-pointer-unstable-v1.c', - 'dep': [wayland_client, wlr_protos, wlroots], + 'dep': wlroots, + 'proto': [ + 'pointer-constraints-unstable-v1', + 'relative-pointer-unstable-v1', + 'xdg-shell', + ], }, 'dmabuf-capture': { 'src': 'dmabuf-capture.c', @@ -83,41 +105,67 @@ examples = { libavutil, drm.partial_dependency(compile_args: true), # <drm_fourcc.h> threads, - wayland_client, - wlr_protos, ], + 'proto': ['wlr-export-dmabuf-unstable-v1'], }, 'screencopy': { 'src': 'screencopy.c', - 'dep': [libpng, wayland_client, wlr_protos, rt], + 'dep': [libpng, rt], + 'proto': ['wlr-screencopy-unstable-v1'], }, 'toplevel-decoration': { 'src': 'toplevel-decoration.c', - 'dep': [wayland_client, wlr_protos, wlroots], + 'dep': wlroots, + 'proto': [ + 'xdg-decoration-unstable-v1', + 'xdg-shell', + ], }, 'input-method': { 'src': 'input-method.c', - 'dep': [wayland_client, wlr_protos] + libepoll, + 'dep': libepoll, + 'proto': [ + 'input-method-unstable-v2', + 'text-input-unstable-v3', + 'xdg-shell', + ], }, 'text-input': { 'src': 'text-input.c', - 'dep': [wayland_cursor, wayland_client, wlr_protos, wlroots], + 'dep': [wayland_cursor, wlroots], + 'proto': [ + 'text-input-unstable-v3', + 'xdg-shell', + ], }, 'foreign-toplevel': { 'src': 'foreign-toplevel.c', - 'dep': [wayland_client, wlr_protos, wlroots], - }, - 'fullscreen-shell': { - 'src': 'fullscreen-shell.c', - 'dep': [wlr_protos, wlroots], + 'dep': [wlroots], + 'proto': ['wlr-foreign-toplevel-management-unstable-v1'], }, } -foreach name, info : examples +foreach name, info : compositors executable( name, info.get('src'), - dependencies: info.get('dep'), + dependencies: wlroots, + include_directories: [wlr_inc, proto_inc], + build_by_default: get_option('examples'), + ) +endforeach + +foreach name, info : clients + extra_src = [] + foreach p : info.get('proto') + extra_src += get_variable(p.underscorify() + '_c') + extra_src += get_variable(p.underscorify() + '_h') + endforeach + + executable( + name, + [info.get('src'), extra_src], + dependencies: [wayland_client, info.get('dep')], build_by_default: get_option('examples'), ) endforeach diff --git a/include/meson.build b/include/meson.build index d16d6ef4..e2428e8d 100644 --- a/include/meson.build +++ b/include/meson.build @@ -1 +1,14 @@ subdir('wlr') + +exclude_files = ['meson.build', 'config.h.in', 'version.h.in'] +if conf_data.get('WLR_HAS_X11_BACKEND', 0) != 1 + exclude_files += 'backend/x11.h' +endif +if conf_data.get('WLR_HAS_XWAYLAND', 0) != 1 + exclude_files += 'xwayland.h' +endif + +install_subdir('wlr', + install_dir: get_option('includedir'), + exclude_files: exclude_files, +) diff --git a/include/wlr/backend/meson.build b/include/wlr/backend/meson.build deleted file mode 100644 index 47de62d2..00000000 --- a/include/wlr/backend/meson.build +++ /dev/null @@ -1,17 +0,0 @@ -install_headers( - 'drm.h', - 'headless.h', - 'interface.h', - 'libinput.h', - 'multi.h', - 'noop.h', - 'session.h', - 'wayland.h', - subdir: 'wlr/backend', -) - -if conf_data.get('WLR_HAS_X11_BACKEND', 0) == 1 - install_headers('x11.h', subdir: 'wlr/backend') -endif - -subdir('session') diff --git a/include/wlr/backend/session/meson.build b/include/wlr/backend/session/meson.build deleted file mode 100644 index 21b5a96b..00000000 --- a/include/wlr/backend/session/meson.build +++ /dev/null @@ -1 +0,0 @@ -install_headers('interface.h', subdir: 'wlr/backend/session') diff --git a/include/wlr/interfaces/meson.build b/include/wlr/interfaces/meson.build deleted file mode 100644 index 7d4d811d..00000000 --- a/include/wlr/interfaces/meson.build +++ /dev/null @@ -1,11 +0,0 @@ -install_headers( - 'wlr_input_device.h', - 'wlr_keyboard.h', - 'wlr_output.h', - 'wlr_pointer.h', - 'wlr_switch.h', - 'wlr_tablet_pad.h', - 'wlr_tablet_tool.h', - 'wlr_touch.h', - subdir: 'wlr/interfaces', -) diff --git a/include/wlr/meson.build b/include/wlr/meson.build index 8874dbc7..032c08d2 100644 --- a/include/wlr/meson.build +++ b/include/wlr/meson.build @@ -8,19 +8,15 @@ version_data.set('WLR_VERSION_API_CURRENT', so_version[0]) version_data.set('WLR_VERSION_API_REVISION', so_version[1]) version_data.set('WLR_VERSION_API_AGE', so_version[2]) -install_headers( - configure_file(input: 'config.h.in', output: 'config.h',configuration: conf_data), - configure_file(input: 'version.h.in', output: 'version.h', configuration: version_data), - 'backend.h', - 'xcursor.h', - subdir: 'wlr' +conf_h = configure_file( + input: 'config.h.in', + output: 'config.h', + configuration: conf_data, +) +ver_h = configure_file( + input: 'version.h.in', + output: 'version.h', + configuration: version_data, ) -if conf_data.get('WLR_HAS_XWAYLAND', 0) == 1 - install_headers('xwayland.h', subdir: 'wlr') -endif -subdir('backend') -subdir('interfaces') -subdir('render') -subdir('types') -subdir('util') +install_headers(conf_h, ver_h, subdir: 'wlr') diff --git a/include/wlr/render/meson.build b/include/wlr/render/meson.build deleted file mode 100644 index 06ebcc37..00000000 --- a/include/wlr/render/meson.build +++ /dev/null @@ -1,10 +0,0 @@ -install_headers( - 'dmabuf.h', - 'egl.h', - 'drm_format_set.h', - 'gles2.h', - 'interface.h', - 'wlr_renderer.h', - 'wlr_texture.h', - subdir: 'wlr/render', -) diff --git a/include/wlr/types/meson.build b/include/wlr/types/meson.build deleted file mode 100644 index aee5c6d9..00000000 --- a/include/wlr/types/meson.build +++ /dev/null @@ -1,53 +0,0 @@ -install_headers( - 'wlr_box.h', - 'wlr_buffer.h', - 'wlr_compositor.h', - 'wlr_cursor.h', - 'wlr_data_control_v1.h', - 'wlr_data_device.h', - 'wlr_export_dmabuf_v1.h', - 'wlr_foreign_toplevel_management_v1.h', - 'wlr_fullscreen_shell_v1.h', - 'wlr_gamma_control_v1.h', - 'wlr_gtk_primary_selection.h', - 'wlr_idle_inhibit_v1.h', - 'wlr_idle.h', - 'wlr_input_device.h', - 'wlr_input_inhibitor.h', - 'wlr_input_method_v2.h', - 'wlr_keyboard.h', - 'wlr_keyboard_group.h', - 'wlr_layer_shell_v1.h', - 'wlr_linux_dmabuf_v1.h', - 'wlr_list.h', - 'wlr_matrix.h', - 'wlr_output_damage.h', - 'wlr_output_layout.h', - 'wlr_output_management_v1.h', - 'wlr_output.h', - 'wlr_pointer_constraints_v1.h', - 'wlr_pointer_gestures_v1.h', - 'wlr_pointer.h', - 'wlr_presentation_time.h', - 'wlr_primary_selection_v1.h', - 'wlr_primary_selection.h', - 'wlr_region.h', - 'wlr_relative_pointer_v1.h', - 'wlr_screencopy_v1.h', - 'wlr_seat.h', - 'wlr_server_decoration.h', - 'wlr_surface.h', - 'wlr_switch.h', - 'wlr_tablet_pad.h', - 'wlr_tablet_tool.h', - 'wlr_tablet_v2.h', - 'wlr_text_input_v3.h', - 'wlr_touch.h', - 'wlr_virtual_keyboard_v1.h', - 'wlr_xcursor_manager.h', - 'wlr_xdg_decoration_v1.h', - 'wlr_xdg_output_v1.h', - 'wlr_xdg_shell_v6.h', - 'wlr_xdg_shell.h', - subdir: 'wlr/types', -) diff --git a/include/wlr/util/meson.build b/include/wlr/util/meson.build deleted file mode 100644 index ee72cbd6..00000000 --- a/include/wlr/util/meson.build +++ /dev/null @@ -1,6 +0,0 @@ -install_headers( - 'edges.h', - 'log.h', - 'region.h', - subdir: 'wlr/util', -) diff --git a/meson.build b/meson.build index 18528df2..87af465e 100644 --- a/meson.build +++ b/meson.build @@ -3,7 +3,7 @@ project( 'c', version: '0.8.1', license: 'MIT', - meson_version: '>=0.49.0', + meson_version: '>=0.51.0', default_options: [ 'c_std=c11', 'warning_level=2', @@ -88,8 +88,6 @@ conf_data.set10('WLR_HAS_XWAYLAND', false) conf_data.set10('WLR_HAS_XCB_ERRORS', false) conf_data.set10('WLR_HAS_XCB_ICCCM', false) -wlr_inc = include_directories('.', 'include') - # Clang complains about some zeroed initializer lists (= {0}), even though they # are valid if cc.get_id() == 'clang' @@ -99,66 +97,21 @@ endif wayland_server = dependency('wayland-server', version: '>=1.16') wayland_client = dependency('wayland-client') -wayland_egl = dependency('wayland-egl') +wayland_egl = dependency('wayland-egl') wayland_protos = dependency('wayland-protocols', version: '>=1.17') -egl = dependency('egl') -freerdp = dependency('freerdp2', required: get_option('freerdp')) -winpr2 = dependency('winpr2', required: get_option('freerdp')) -glesv2 = dependency('glesv2') -drm = dependency('libdrm', version: '>=2.4.95') -gbm = dependency('gbm', version: '>=17.1.0') -libinput = dependency('libinput', version: '>=1.9.0') -xkbcommon = dependency('xkbcommon') -udev = dependency('libudev') -pixman = dependency('pixman-1') -libcap = dependency('libcap', required: get_option('libcap')) -logind = dependency('lib' + get_option('logind-provider'), required: get_option('logind'), version: '>=237') -math = cc.find_library('m') -rt = cc.find_library('rt') - -wlr_parts = [] -wlr_deps = [] - -if libcap.found() - conf_data.set10('WLR_HAS_LIBCAP', true) - wlr_deps += libcap -endif - -if logind.found() - conf_data.set10('WLR_HAS_' + get_option('logind-provider').to_upper(), true) - wlr_deps += logind -endif - -if libinput.found() - ver = libinput.version().split('.') - add_project_arguments([ - '-DLIBINPUT_MAJOR=' + ver[0], - '-DLIBINPUT_MINOR=' + ver[1], - '-DLIBINPUT_PATCH=' + ver[2], - ], language: 'c') -endif - -subdir('protocol') -subdir('render') - -subdir('backend') -subdir('types') -subdir('util') -subdir('xcursor') -subdir('xwayland') - -subdir('include') - -wlr_parts += [ - lib_wl_protos, - lib_wlr_backend, - lib_wlr_render, - lib_wlr_types, - lib_wlr_util, - lib_wlr_xcursor, -] - -wlr_deps += [ +egl = dependency('egl') +glesv2 = dependency('glesv2') +drm = dependency('libdrm', version: '>=2.4.95') +gbm = dependency('gbm', version: '>=17.1.0') +libinput = dependency('libinput', version: '>=1.9.0') +xkbcommon = dependency('xkbcommon') +udev = dependency('libudev') +pixman = dependency('pixman-1') +math = cc.find_library('m') +rt = cc.find_library('rt') + +wlr_files = [] +wlr_deps = [ wayland_server, wayland_client, wayland_egl, @@ -172,16 +125,37 @@ wlr_deps += [ udev, pixman, math, + rt, ] +libinput_ver = libinput.version().split('.') +add_project_arguments([ + '-DLIBINPUT_MAJOR=' + libinput_ver[0], + '-DLIBINPUT_MINOR=' + libinput_ver[1], + '-DLIBINPUT_PATCH=' + libinput_ver[2], +], language: 'c') + +subdir('protocol') +subdir('render') + +subdir('backend') +subdir('types') +subdir('util') +subdir('xcursor') +subdir('xwayland') + +subdir('include') + +wlr_inc = include_directories('.', 'include') +proto_inc = include_directories('protocol') + symbols_file = 'wlroots.syms' symbols_flag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), symbols_file) lib_wlr = library( - meson.project_name(), + meson.project_name(), wlr_files, version: '.'.join(so_version), - link_whole: wlr_parts, dependencies: wlr_deps, - include_directories: wlr_inc, + include_directories: [wlr_inc, proto_inc], install: true, link_args : symbols_flag, link_depends: symbols_file, diff --git a/protocol/meson.build b/protocol/meson.build index ed5491c8..c39be751 100644 --- a/protocol/meson.build +++ b/protocol/meson.build @@ -1,103 +1,72 @@ -wl_protocol_dir = wayland_protos.get_pkgconfig_variable('pkgdatadir') +wl_protocol_dir = wayland_protos.get_variable(pkgconfig: 'pkgdatadir') wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true) if wayland_scanner_dep.found() wayland_scanner = find_program( - wayland_scanner_dep.get_pkgconfig_variable('wayland_scanner'), + wayland_scanner_dep.get_variable(pkgconfig: 'wayland_scanner'), native: true, ) else wayland_scanner = find_program('wayland-scanner', native: true) endif -protocols = [ - [wl_protocol_dir, 'stable/presentation-time/presentation-time.xml'], - [wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'], - [wl_protocol_dir, 'unstable/fullscreen-shell/fullscreen-shell-unstable-v1.xml'], - [wl_protocol_dir, 'unstable/idle-inhibit/idle-inhibit-unstable-v1.xml'], - [wl_protocol_dir, 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml'], - [wl_protocol_dir, 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml'], - [wl_protocol_dir, 'unstable/pointer-gestures/pointer-gestures-unstable-v1.xml'], - [wl_protocol_dir, 'unstable/primary-selection/primary-selection-unstable-v1.xml'], - [wl_protocol_dir, 'unstable/relative-pointer/relative-pointer-unstable-v1.xml'], - [wl_protocol_dir, 'unstable/tablet/tablet-unstable-v2.xml'], - [wl_protocol_dir, 'unstable/text-input/text-input-unstable-v3.xml'], - [wl_protocol_dir, 'unstable/xdg-decoration/xdg-decoration-unstable-v1.xml'], - [wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'], - [wl_protocol_dir, 'unstable/xdg-shell/xdg-shell-unstable-v6.xml'], - 'gtk-primary-selection.xml', - 'idle.xml', - 'input-method-unstable-v2.xml', - 'server-decoration.xml', - 'virtual-keyboard-unstable-v1.xml', - 'wlr-data-control-unstable-v1.xml', - 'wlr-export-dmabuf-unstable-v1.xml', - 'wlr-foreign-toplevel-management-unstable-v1.xml', - 'wlr-gamma-control-unstable-v1.xml', - 'wlr-input-inhibitor-unstable-v1.xml', - 'wlr-layer-shell-unstable-v1.xml', - 'wlr-output-management-unstable-v1.xml', - 'wlr-screencopy-unstable-v1.xml', -] +protocols = { + # Stable upstream protocols + 'xdg-shell': wl_protocol_dir / 'stable/xdg-shell/xdg-shell.xml', + 'presentation-time': wl_protocol_dir / 'stable/presentation-time/presentation-time.xml', + # Unstable upstream protocols + 'fullscreen-shell-unstable-v1': wl_protocol_dir / 'unstable/fullscreen-shell/fullscreen-shell-unstable-v1.xml', + 'idle-inhibit-unstable-v1': wl_protocol_dir / 'unstable/idle-inhibit/idle-inhibit-unstable-v1.xml', + 'linux-dmabuf-unstable-v1': wl_protocol_dir / 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml', + 'pointer-constraints-unstable-v1': wl_protocol_dir / 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml', + 'pointer-gestures-unstable-v1': wl_protocol_dir / 'unstable/pointer-gestures/pointer-gestures-unstable-v1.xml', + 'primary-selection-unstable-v1': wl_protocol_dir / 'unstable/primary-selection/primary-selection-unstable-v1.xml', + 'relative-pointer-unstable-v1': wl_protocol_dir / 'unstable/relative-pointer/relative-pointer-unstable-v1.xml', + 'tablet-unstable-v2': wl_protocol_dir / 'unstable/tablet/tablet-unstable-v2.xml', + 'text-input-unstable-v3': wl_protocol_dir / 'unstable/text-input/text-input-unstable-v3.xml', + 'xdg-decoration-unstable-v1': wl_protocol_dir / 'unstable/xdg-decoration/xdg-decoration-unstable-v1.xml', + 'xdg-output-unstable-v1': wl_protocol_dir / 'unstable/xdg-output/xdg-output-unstable-v1.xml', + 'xdg-shell-unstable-v6': wl_protocol_dir / 'unstable/xdg-shell/xdg-shell-unstable-v6.xml', + # Other protocols + 'gtk-primary-selection': 'gtk-primary-selection.xml', + 'kde-idle': 'idle.xml', + 'kde-server-decoration': 'server-decoration.xml', + 'input-method-unstable-v2': 'input-method-unstable-v2.xml', + 'virtual-keyboard-unstable-v1': 'virtual-keyboard-unstable-v1.xml', + 'wlr-data-control-unstable-v1': 'wlr-data-control-unstable-v1.xml', + 'wlr-export-dmabuf-unstable-v1': 'wlr-export-dmabuf-unstable-v1.xml', + 'wlr-foreign-toplevel-management-unstable-v1': 'wlr-foreign-toplevel-management-unstable-v1.xml', + 'wlr-gamma-control-unstable-v1': 'wlr-gamma-control-unstable-v1.xml', + 'wlr-input-inhibitor-unstable-v1': 'wlr-input-inhibitor-unstable-v1.xml', + 'wlr-layer-shell-unstable-v1': 'wlr-layer-shell-unstable-v1.xml', + 'wlr-output-management-unstable-v1': 'wlr-output-management-unstable-v1.xml', + 'wlr-screencopy-unstable-v1': 'wlr-screencopy-unstable-v1.xml', +} -client_protocols = [ - [wl_protocol_dir, 'stable/presentation-time/presentation-time.xml'], - [wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'], - [wl_protocol_dir, 'unstable/idle-inhibit/idle-inhibit-unstable-v1.xml'], - [wl_protocol_dir, 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml'], - [wl_protocol_dir, 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml'], - [wl_protocol_dir, 'unstable/pointer-gestures/pointer-gestures-unstable-v1.xml'], - [wl_protocol_dir, 'unstable/relative-pointer/relative-pointer-unstable-v1.xml'], - [wl_protocol_dir, 'unstable/tablet/tablet-unstable-v2.xml'], - [wl_protocol_dir, 'unstable/text-input/text-input-unstable-v3.xml'], - [wl_protocol_dir, 'unstable/xdg-decoration/xdg-decoration-unstable-v1.xml'], - [wl_protocol_dir, 'unstable/xdg-shell/xdg-shell-unstable-v6.xml'], - 'idle.xml', - 'input-method-unstable-v2.xml', - 'wlr-export-dmabuf-unstable-v1.xml', - 'wlr-foreign-toplevel-management-unstable-v1.xml', - 'wlr-gamma-control-unstable-v1.xml', - 'wlr-input-inhibitor-unstable-v1.xml', - 'wlr-layer-shell-unstable-v1.xml', - 'wlr-screencopy-unstable-v1.xml', -] - -wl_protos_src = [] -wl_protos_headers = [] - -foreach p : protocols - xml = join_paths(p) - wl_protos_src += custom_target( - xml.underscorify() + '_server_c', - input: xml, +foreach name, path : protocols + code = custom_target( + name.underscorify() + '_c', + input: path, output: '@BASENAME@-protocol.c', command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'], ) - wl_protos_headers += custom_target( - xml.underscorify() + '_server_h', - input: xml, + wlr_files += code + + wlr_files += custom_target( + name.underscorify() + '_server_h', + input: path, output: '@BASENAME@-protocol.h', command: [wayland_scanner, 'server-header', '@INPUT@', '@OUTPUT@'], ) -endforeach -foreach p : client_protocols - xml = join_paths(p) - wl_protos_headers += custom_target( - xml.underscorify() + '_client_h', - input: xml, + 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, ) -endforeach - -lib_wl_protos = static_library( - 'wl_protos', - wl_protos_src + wl_protos_headers, - dependencies: wayland_client.partial_dependency(compile_args: true), -) -wlr_protos = declare_dependency( - link_with: lib_wl_protos, - sources: wl_protos_headers, -) + set_variable(name.underscorify() + '_c', code) + set_variable(name.underscorify() + '_h', header) +endforeach diff --git a/render/meson.build b/render/meson.build index 79daba93..9486c22d 100644 --- a/render/meson.build +++ b/render/meson.build @@ -1,26 +1,11 @@ -lib_wlr_render = static_library( - 'wlr_render', - files( - 'dmabuf.c', - 'egl.c', - 'drm_format_set.c', - 'gles2/pixel_format.c', - 'gles2/renderer.c', - 'gles2/shaders.c', - 'gles2/texture.c', - 'wlr_renderer.c', - 'wlr_texture.c', - ), - include_directories: wlr_inc, - dependencies: [ - egl, - drm.partial_dependency(compile_args: true), # <drm_fourcc.h> - glesv2, - pixman, - wayland_server, - ], -) - -wlr_render = declare_dependency( - link_with: lib_wlr_render, +wlr_files += files( + 'dmabuf.c', + 'egl.c', + 'drm_format_set.c', + 'gles2/pixel_format.c', + 'gles2/renderer.c', + 'gles2/shaders.c', + 'gles2/texture.c', + 'wlr_renderer.c', + 'wlr_texture.c', ) diff --git a/types/meson.build b/types/meson.build index 6e9c2826..4e141fb3 100644 --- a/types/meson.build +++ b/types/meson.build @@ -1,80 +1,69 @@ -lib_wlr_types = static_library( - 'wlr_types', - files( - 'data_device/wlr_data_device.c', - 'data_device/wlr_data_offer.c', - 'data_device/wlr_data_source.c', - 'data_device/wlr_drag.c', - 'seat/wlr_seat_keyboard.c', - 'seat/wlr_seat_pointer.c', - 'seat/wlr_seat_touch.c', - 'seat/wlr_seat.c', - 'tablet_v2/wlr_tablet_v2_pad.c', - 'tablet_v2/wlr_tablet_v2_tablet.c', - 'tablet_v2/wlr_tablet_v2_tool.c', - 'tablet_v2/wlr_tablet_v2.c', - 'xdg_shell_v6/wlr_xdg_popup_v6.c', - 'xdg_shell_v6/wlr_xdg_positioner_v6.c', - 'xdg_shell_v6/wlr_xdg_shell_v6.c', - 'xdg_shell_v6/wlr_xdg_surface_v6.c', - 'xdg_shell_v6/wlr_xdg_toplevel_v6.c', - 'xdg_shell/wlr_xdg_popup.c', - 'xdg_shell/wlr_xdg_positioner.c', - 'xdg_shell/wlr_xdg_shell.c', - 'xdg_shell/wlr_xdg_surface.c', - 'xdg_shell/wlr_xdg_toplevel.c', - 'wlr_box.c', - 'wlr_buffer.c', - 'wlr_compositor.c', - 'wlr_cursor.c', - 'wlr_data_control_v1.c', - 'wlr_export_dmabuf_v1.c', - 'wlr_foreign_toplevel_management_v1.c', - 'wlr_fullscreen_shell_v1.c', - 'wlr_gamma_control_v1.c', - 'wlr_gtk_primary_selection.c', - 'wlr_idle_inhibit_v1.c', - 'wlr_idle.c', - 'wlr_input_device.c', - 'wlr_input_inhibitor.c', - 'wlr_input_method_v2.c', - 'wlr_keyboard.c', - 'wlr_keyboard_group.c', - 'wlr_layer_shell_v1.c', - 'wlr_linux_dmabuf_v1.c', - 'wlr_list.c', - 'wlr_matrix.c', - 'wlr_output_damage.c', - 'wlr_output_layout.c', - 'wlr_output_management_v1.c', - 'wlr_output.c', - 'wlr_pointer_constraints_v1.c', - 'wlr_pointer_gestures_v1.c', - 'wlr_pointer.c', - 'wlr_presentation_time.c', - 'wlr_primary_selection_v1.c', - 'wlr_primary_selection.c', - 'wlr_region.c', - 'wlr_relative_pointer_v1.c', - 'wlr_screencopy_v1.c', - 'wlr_server_decoration.c', - 'wlr_surface.c', - 'wlr_switch.c', - 'wlr_tablet_pad.c', - 'wlr_tablet_tool.c', - 'wlr_text_input_v3.c', - 'wlr_touch.c', - 'wlr_virtual_keyboard_v1.c', - 'wlr_xcursor_manager.c', - 'wlr_xdg_decoration_v1.c', - 'wlr_xdg_output_v1.c', - ), - include_directories: wlr_inc, - dependencies: [ - drm.partial_dependency(compile_args: true), # <drm_fourcc.h> - pixman, - wayland_server, - wlr_protos, - xkbcommon, - ], +wlr_files += files( + 'data_device/wlr_data_device.c', + 'data_device/wlr_data_offer.c', + 'data_device/wlr_data_source.c', + 'data_device/wlr_drag.c', + 'seat/wlr_seat_keyboard.c', + 'seat/wlr_seat_pointer.c', + 'seat/wlr_seat_touch.c', + 'seat/wlr_seat.c', + 'tablet_v2/wlr_tablet_v2_pad.c', + 'tablet_v2/wlr_tablet_v2_tablet.c', + 'tablet_v2/wlr_tablet_v2_tool.c', + 'tablet_v2/wlr_tablet_v2.c', + 'xdg_shell_v6/wlr_xdg_popup_v6.c', + 'xdg_shell_v6/wlr_xdg_positioner_v6.c', + 'xdg_shell_v6/wlr_xdg_shell_v6.c', + 'xdg_shell_v6/wlr_xdg_surface_v6.c', + 'xdg_shell_v6/wlr_xdg_toplevel_v6.c', + 'xdg_shell/wlr_xdg_popup.c', + 'xdg_shell/wlr_xdg_positioner.c', + 'xdg_shell/wlr_xdg_shell.c', + 'xdg_shell/wlr_xdg_surface.c', + 'xdg_shell/wlr_xdg_toplevel.c', + 'wlr_box.c', + 'wlr_buffer.c', + 'wlr_compositor.c', + 'wlr_cursor.c', + 'wlr_data_control_v1.c', + 'wlr_export_dmabuf_v1.c', + 'wlr_foreign_toplevel_management_v1.c', + 'wlr_fullscreen_shell_v1.c', + 'wlr_gamma_control_v1.c', + 'wlr_gtk_primary_selection.c', + 'wlr_idle_inhibit_v1.c', + 'wlr_idle.c', + 'wlr_input_device.c', + 'wlr_input_inhibitor.c', + 'wlr_input_method_v2.c', + 'wlr_keyboard.c', + 'wlr_keyboard_group.c', + 'wlr_layer_shell_v1.c', + 'wlr_linux_dmabuf_v1.c', + 'wlr_list.c', + 'wlr_matrix.c', + 'wlr_output_damage.c', + 'wlr_output_layout.c', + 'wlr_output_management_v1.c', + 'wlr_output.c', + 'wlr_pointer_constraints_v1.c', + 'wlr_pointer_gestures_v1.c', + 'wlr_pointer.c', + 'wlr_presentation_time.c', + 'wlr_primary_selection_v1.c', + 'wlr_primary_selection.c', + 'wlr_region.c', + 'wlr_relative_pointer_v1.c', + 'wlr_screencopy_v1.c', + 'wlr_server_decoration.c', + 'wlr_surface.c', + 'wlr_switch.c', + 'wlr_tablet_pad.c', + 'wlr_tablet_tool.c', + 'wlr_text_input_v3.c', + 'wlr_touch.c', + 'wlr_virtual_keyboard_v1.c', + 'wlr_xcursor_manager.c', + 'wlr_xdg_decoration_v1.c', + 'wlr_xdg_output_v1.c', ) diff --git a/util/meson.build b/util/meson.build index dca3e9a4..c6614275 100644 --- a/util/meson.build +++ b/util/meson.build @@ -1,12 +1,7 @@ -lib_wlr_util = static_library( - 'wlr_util', - files( - 'array.c', - 'log.c', - 'region.c', - 'shm.c', - 'signal.c', - ), - include_directories: wlr_inc, - dependencies: [wayland_server, pixman, rt], +wlr_files += files( + 'array.c', + 'log.c', + 'region.c', + 'shm.c', + 'signal.c', ) diff --git a/xcursor/meson.build b/xcursor/meson.build index 31040a92..a85051e9 100644 --- a/xcursor/meson.build +++ b/xcursor/meson.build @@ -1,9 +1,4 @@ -lib_wlr_xcursor = static_library( - 'wlr_xcursor', - files( - 'wlr_xcursor.c', - 'xcursor.c', - ), - include_directories: wlr_inc, - dependencies: [egl] # header required via include/wlr/render.h +wlr_files += files( + 'wlr_xcursor.c', + 'xcursor.c', ) diff --git a/xwayland/meson.build b/xwayland/meson.build index e5f9b9be..12c69da4 100644 --- a/xwayland/meson.build +++ b/xwayland/meson.build @@ -5,13 +5,24 @@ xwayland_required = [ 'xcb-render', 'xcb-xfixes', ] -xwayland_optional = [ - 'xcb-errors', - 'xcb-icccm', -] +xwayland_optional = { + 'xcb-errors': 'Required for printing X11 errors.', + 'xcb-icccm': 'Required for extended X11 window manager hints.', +} + +msg = [] +if get_option('xwayland').enabled() + msg += 'Install "@0@" or pass "-Dxwayland=disabled".' +endif +if not get_option('xwayland').disabled() + msg += 'Required for Xwayland support.' +endif foreach lib : xwayland_required - dep = dependency(lib, required: get_option('xwayland')) + dep = dependency(lib, + required: get_option('xwayland'), + not_found_message: '\n'.join(msg).format(lib), + ) if not dep.found() subdir_done() endif @@ -19,33 +30,33 @@ foreach lib : xwayland_required xwayland_libs += dep endforeach -foreach lib : xwayland_optional - dep = dependency(lib, required: get_option(lib)) +foreach lib, desc : xwayland_optional + msg = [] + if get_option(lib).enabled() + msg += 'Install "@0@" or pass "-D@0@=disabled".' + endif + if not get_option(lib).disabled() + msg += desc + endif + + dep = dependency(lib, + required: get_option(lib), + not_found_message: '\n'.join(msg).format(lib), + ) if dep.found() xwayland_libs += dep conf_data.set10('WLR_HAS_' + lib.underscorify().to_upper(), true) endif endforeach -lib_wlr_xwayland = static_library( - 'wlr_xwayland', - files( - 'selection/dnd.c', - 'selection/incoming.c', - 'selection/outgoing.c', - 'selection/selection.c', - 'sockets.c', - 'xwayland.c', - 'xwm.c', - ), - include_directories: wlr_inc, - dependencies: [ - wayland_server, - xwayland_libs, - xkbcommon, - pixman, - ], +wlr_files += files( + 'selection/dnd.c', + 'selection/incoming.c', + 'selection/outgoing.c', + 'selection/selection.c', + 'sockets.c', + 'xwayland.c', + 'xwm.c', ) - -wlr_parts += lib_wlr_xwayland +wlr_deps += xwayland_libs conf_data.set10('WLR_HAS_XWAYLAND', true) |