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
This commit is contained in:
Scott Anderson 2019-11-22 20:11:15 +13:00 committed by Drew DeVault
parent fc6c0ca12e
commit cff1c2f740
26 changed files with 479 additions and 533 deletions

10
backend/drm/meson.build Normal file
View File

@ -0,0 +1,10 @@
wlr_files += files(
'atomic.c',
'backend.c',
'cvt.c',
'drm.c',
'legacy.c',
'properties.c',
'renderer.c',
'util.c',
)

View File

@ -0,0 +1,5 @@
wlr_files += files(
'backend.c',
'input_device.c',
'output.c',
)

View File

@ -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',
)

View File

@ -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')

View File

@ -0,0 +1 @@
wlr_files += files('backend.c')

4
backend/noop/meson.build Normal file
View File

@ -0,0 +1,4 @@
wlr_files += files(
'backend.c',
'output.c',
)

36
backend/rdp/meson.build Normal file
View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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(
wlr_files += 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
wlr_deps += x11_libs
conf_data.set10('WLR_HAS_X11_BACKEND', true)

View File

@ -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

View File

@ -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,
)

View File

@ -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')

View File

@ -1 +0,0 @@
install_headers('interface.h', subdir: 'wlr/backend/session')

View File

@ -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',
)

View File

@ -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')

View File

@ -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',
)

View File

@ -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',
)

View File

@ -1,6 +0,0 @@
install_headers(
'edges.h',
'log.h',
'region.h',
subdir: 'wlr/util',
)

View File

@ -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'
@ -102,8 +100,6 @@ wayland_client = dependency('wayland-client')
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')
@ -111,54 +107,11 @@ 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 += [
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,

View File

@ -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,
)
set_variable(name.underscorify() + '_c', code)
set_variable(name.underscorify() + '_h', header)
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,
)

View File

@ -1,6 +1,4 @@
lib_wlr_render = static_library(
'wlr_render',
files(
wlr_files += files(
'dmabuf.c',
'egl.c',
'drm_format_set.c',
@ -10,17 +8,4 @@ lib_wlr_render = static_library(
'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,
)

View File

@ -1,6 +1,4 @@
lib_wlr_types = static_library(
'wlr_types',
files(
wlr_files += files(
'data_device/wlr_data_device.c',
'data_device/wlr_data_offer.c',
'data_device/wlr_data_source.c',
@ -68,13 +66,4 @@ lib_wlr_types = static_library(
'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,
],
)

View File

@ -1,12 +1,7 @@
lib_wlr_util = static_library(
'wlr_util',
files(
wlr_files += files(
'array.c',
'log.c',
'region.c',
'shm.c',
'signal.c',
),
include_directories: wlr_inc,
dependencies: [wayland_server, pixman, rt],
)

View File

@ -1,9 +1,4 @@
lib_wlr_xcursor = static_library(
'wlr_xcursor',
files(
wlr_files += files(
'wlr_xcursor.c',
'xcursor.c',
),
include_directories: wlr_inc,
dependencies: [egl] # header required via include/wlr/render.h
)

View File

@ -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,17 +30,26 @@ 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(
wlr_files += files(
'selection/dnd.c',
'selection/incoming.c',
'selection/outgoing.c',
@ -37,15 +57,6 @@ lib_wlr_xwayland = static_library(
'sockets.c',
'xwayland.c',
'xwm.c',
),
include_directories: wlr_inc,
dependencies: [
wayland_server,
xwayland_libs,
xkbcommon,
pixman,
],
)
wlr_parts += lib_wlr_xwayland
wlr_deps += xwayland_libs
conf_data.set10('WLR_HAS_XWAYLAND', true)