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
master
Scott Anderson 5 years ago committed by Drew DeVault
parent fc6c0ca12e
commit cff1c2f740

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

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

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

@ -1,82 +1,12 @@
backend_parts = [] wlr_files += files('backend.c')
backend_files = files(
'backend.c', subdir('drm')
'drm/atomic.c', subdir('headless')
'drm/backend.c', subdir('libinput')
'drm/cvt.c', subdir('multi')
'drm/drm.c', subdir('noop')
'drm/legacy.c', subdir('rdp')
'drm/properties.c', subdir('wayland')
'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
subdir('x11') subdir('x11')
lib_wlr_backend = static_library( subdir('session')
'wlr_backend',
backend_files,
include_directories: wlr_inc,
link_whole: backend_parts,
dependencies: backend_deps,
)

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

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

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

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

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

@ -6,8 +6,19 @@ x11_required = [
'xcb-xfixes', '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 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() if not dep.found()
subdir_done() subdir_done()
endif endif
@ -15,21 +26,10 @@ foreach lib : x11_required
x11_libs += dep x11_libs += dep
endforeach endforeach
lib_wlr_backend_x11 = static_library( wlr_files += files(
'wlr_backend_x11',
files(
'backend.c', 'backend.c',
'input_device.c', 'input_device.c',
'output.c', 'output.c',
),
include_directories: wlr_inc,
dependencies: [
wayland_server,
pixman,
xkbcommon,
x11_libs,
],
) )
wlr_deps += x11_libs
backend_parts += lib_wlr_backend_x11
conf_data.set10('WLR_HAS_X11_BACKEND', true) conf_data.set10('WLR_HAS_X11_BACKEND', true)

@ -8,9 +8,9 @@ libavformat = dependency('libavformat', version: '>=58.12.100', required: false,
# epoll is a separate library in FreeBSD # epoll is a separate library in FreeBSD
if host_machine.system() == 'freebsd' if host_machine.system() == 'freebsd'
libepoll = [dependency('epoll-shim')] libepoll = dependency('epoll-shim')
else else
libepoll = [] libepoll = dependency('', required: false)
endif endif
# Check if libavutil is found because of https://github.com/mesonbuild/meson/issues/6010 # 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() libavutil = disabler()
endif endif
examples = { compositors = {
'simple': { 'simple': {
'src': 'simple.c', 'src': 'simple.c',
'dep': [wlroots],
}, },
'pointer': { 'pointer': {
'src': 'pointer.c', 'src': 'pointer.c',
'dep': [wlroots],
}, },
'touch': { 'touch': {
'src': ['touch.c', 'cat.c'], 'src': ['touch.c', 'cat.c'],
'dep': [wlroots],
}, },
'tablet': { 'tablet': {
'src': 'tablet.c', 'src': 'tablet.c',
'dep': [wlroots],
}, },
'rotation': { 'rotation': {
'src': ['rotation.c', 'cat.c'], 'src': ['rotation.c', 'cat.c'],
'dep': [wlroots],
}, },
'multi-pointer': { 'multi-pointer': {
'src': 'multi-pointer.c', 'src': 'multi-pointer.c',
'dep': [wlroots],
}, },
'output-layout': { 'output-layout': {
'src': ['output-layout.c', 'cat.c'], 'src': ['output-layout.c', 'cat.c'],
'dep': [wlroots],
}, },
'fullscreen-shell': {
'src': 'fullscreen-shell.c',
},
}
clients = {
'idle': { 'idle': {
'src': 'idle.c', 'src': 'idle.c',
'dep': [wayland_client, wlr_protos, threads], 'dep': threads,
'proto': ['kde-idle'],
}, },
'idle-inhibit': { 'idle-inhibit': {
'src': 'idle-inhibit.c', 'src': 'idle-inhibit.c',
'dep': [wayland_client, wlr_protos, wlroots], 'dep': wlroots,
'proto': [
'idle-inhibit-unstable-v1',
'xdg-shell',
],
}, },
'layer-shell': { 'layer-shell': {
'src': 'layer-shell.c', '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': { 'input-inhibitor': {
'src': 'input-inhibitor.c', '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': { 'gamma-control': {
'src': 'gamma-control.c', 'src': 'gamma-control.c',
'dep': [wayland_client, wayland_cursor, wlr_protos, math], 'dep': [wayland_cursor, math],
'proto': ['wlr-gamma-control-unstable-v1'],
}, },
'pointer-constraints': { 'pointer-constraints': {
'src': 'pointer-constraints.c', 'src': 'pointer-constraints.c',
'dep': [wayland_client, wlr_protos, wlroots], 'dep': wlroots,
'proto': [
'pointer-constraints-unstable-v1',
'xdg-shell',
],
}, },
'relative-pointer': { 'relative-pointer': {
'src': 'relative-pointer-unstable-v1.c', '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': { 'dmabuf-capture': {
'src': 'dmabuf-capture.c', 'src': 'dmabuf-capture.c',
@ -83,41 +105,67 @@ examples = {
libavutil, libavutil,
drm.partial_dependency(compile_args: true), # <drm_fourcc.h> drm.partial_dependency(compile_args: true), # <drm_fourcc.h>
threads, threads,
wayland_client,
wlr_protos,
], ],
'proto': ['wlr-export-dmabuf-unstable-v1'],
}, },
'screencopy': { 'screencopy': {
'src': 'screencopy.c', 'src': 'screencopy.c',
'dep': [libpng, wayland_client, wlr_protos, rt], 'dep': [libpng, rt],
'proto': ['wlr-screencopy-unstable-v1'],
}, },
'toplevel-decoration': { 'toplevel-decoration': {
'src': 'toplevel-decoration.c', 'src': 'toplevel-decoration.c',
'dep': [wayland_client, wlr_protos, wlroots], 'dep': wlroots,
'proto': [
'xdg-decoration-unstable-v1',
'xdg-shell',
],
}, },
'input-method': { 'input-method': {
'src': 'input-method.c', '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': { 'text-input': {
'src': 'text-input.c', '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': { 'foreign-toplevel': {
'src': 'foreign-toplevel.c', 'src': 'foreign-toplevel.c',
'dep': [wayland_client, wlr_protos, wlroots], 'dep': [wlroots],
}, 'proto': ['wlr-foreign-toplevel-management-unstable-v1'],
'fullscreen-shell': {
'src': 'fullscreen-shell.c',
'dep': [wlr_protos, wlroots],
}, },
} }
foreach name, info : examples foreach name, info : compositors
executable( executable(
name, name,
info.get('src'), 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'), build_by_default: get_option('examples'),
) )
endforeach endforeach

@ -1 +1,14 @@
subdir('wlr') 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,
)

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

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

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

@ -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_REVISION', so_version[1])
version_data.set('WLR_VERSION_API_AGE', so_version[2]) version_data.set('WLR_VERSION_API_AGE', so_version[2])
install_headers( conf_h = configure_file(
configure_file(input: 'config.h.in', output: 'config.h',configuration: conf_data), input: 'config.h.in',
configure_file(input: 'version.h.in', output: 'version.h', configuration: version_data), output: 'config.h',
'backend.h', configuration: conf_data,
'xcursor.h', )
subdir: 'wlr' 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') install_headers(conf_h, ver_h, subdir: 'wlr')
subdir('interfaces')
subdir('render')
subdir('types')
subdir('util')

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

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

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

@ -3,7 +3,7 @@ project(
'c', 'c',
version: '0.8.1', version: '0.8.1',
license: 'MIT', license: 'MIT',
meson_version: '>=0.49.0', meson_version: '>=0.51.0',
default_options: [ default_options: [
'c_std=c11', 'c_std=c11',
'warning_level=2', '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_ERRORS', false)
conf_data.set10('WLR_HAS_XCB_ICCCM', 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 # Clang complains about some zeroed initializer lists (= {0}), even though they
# are valid # are valid
if cc.get_id() == 'clang' if cc.get_id() == 'clang'
@ -102,8 +100,6 @@ wayland_client = dependency('wayland-client')
wayland_egl = dependency('wayland-egl') wayland_egl = dependency('wayland-egl')
wayland_protos = dependency('wayland-protocols', version: '>=1.17') wayland_protos = dependency('wayland-protocols', version: '>=1.17')
egl = dependency('egl') egl = dependency('egl')
freerdp = dependency('freerdp2', required: get_option('freerdp'))
winpr2 = dependency('winpr2', required: get_option('freerdp'))
glesv2 = dependency('glesv2') glesv2 = dependency('glesv2')
drm = dependency('libdrm', version: '>=2.4.95') drm = dependency('libdrm', version: '>=2.4.95')
gbm = dependency('gbm', version: '>=17.1.0') gbm = dependency('gbm', version: '>=17.1.0')
@ -111,54 +107,11 @@ libinput = dependency('libinput', version: '>=1.9.0')
xkbcommon = dependency('xkbcommon') xkbcommon = dependency('xkbcommon')
udev = dependency('libudev') udev = dependency('libudev')
pixman = dependency('pixman-1') 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') math = cc.find_library('m')
rt = cc.find_library('rt') rt = cc.find_library('rt')
wlr_parts = [] wlr_files = []
wlr_deps = [] 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 += [
wayland_server, wayland_server,
wayland_client, wayland_client,
wayland_egl, wayland_egl,
@ -172,16 +125,37 @@ wlr_deps += [
udev, udev,
pixman, pixman,
math, 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_file = 'wlroots.syms'
symbols_flag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), symbols_file) symbols_flag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), symbols_file)
lib_wlr = library( lib_wlr = library(
meson.project_name(), meson.project_name(), wlr_files,
version: '.'.join(so_version), version: '.'.join(so_version),
link_whole: wlr_parts,
dependencies: wlr_deps, dependencies: wlr_deps,
include_directories: wlr_inc, include_directories: [wlr_inc, proto_inc],
install: true, install: true,
link_args : symbols_flag, link_args : symbols_flag,
link_depends: symbols_file, link_depends: symbols_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) wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)
if wayland_scanner_dep.found() if wayland_scanner_dep.found()
wayland_scanner = find_program( wayland_scanner = find_program(
wayland_scanner_dep.get_pkgconfig_variable('wayland_scanner'), wayland_scanner_dep.get_variable(pkgconfig: 'wayland_scanner'),
native: true, native: true,
) )
else else
wayland_scanner = find_program('wayland-scanner', native: true) wayland_scanner = find_program('wayland-scanner', native: true)
endif endif
protocols = [ protocols = {
[wl_protocol_dir, 'stable/presentation-time/presentation-time.xml'], # Stable upstream protocols
[wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'], 'xdg-shell': wl_protocol_dir / 'stable/xdg-shell/xdg-shell.xml',
[wl_protocol_dir, 'unstable/fullscreen-shell/fullscreen-shell-unstable-v1.xml'], 'presentation-time': wl_protocol_dir / 'stable/presentation-time/presentation-time.xml',
[wl_protocol_dir, 'unstable/idle-inhibit/idle-inhibit-unstable-v1.xml'], # Unstable upstream protocols
[wl_protocol_dir, 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml'], 'fullscreen-shell-unstable-v1': wl_protocol_dir / 'unstable/fullscreen-shell/fullscreen-shell-unstable-v1.xml',
[wl_protocol_dir, 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml'], 'idle-inhibit-unstable-v1': wl_protocol_dir / 'unstable/idle-inhibit/idle-inhibit-unstable-v1.xml',
[wl_protocol_dir, 'unstable/pointer-gestures/pointer-gestures-unstable-v1.xml'], 'linux-dmabuf-unstable-v1': wl_protocol_dir / 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml',
[wl_protocol_dir, 'unstable/primary-selection/primary-selection-unstable-v1.xml'], 'pointer-constraints-unstable-v1': wl_protocol_dir / 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml',
[wl_protocol_dir, 'unstable/relative-pointer/relative-pointer-unstable-v1.xml'], 'pointer-gestures-unstable-v1': wl_protocol_dir / 'unstable/pointer-gestures/pointer-gestures-unstable-v1.xml',
[wl_protocol_dir, 'unstable/tablet/tablet-unstable-v2.xml'], 'primary-selection-unstable-v1': wl_protocol_dir / 'unstable/primary-selection/primary-selection-unstable-v1.xml',
[wl_protocol_dir, 'unstable/text-input/text-input-unstable-v3.xml'], 'relative-pointer-unstable-v1': wl_protocol_dir / 'unstable/relative-pointer/relative-pointer-unstable-v1.xml',
[wl_protocol_dir, 'unstable/xdg-decoration/xdg-decoration-unstable-v1.xml'], 'tablet-unstable-v2': wl_protocol_dir / 'unstable/tablet/tablet-unstable-v2.xml',
[wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'], 'text-input-unstable-v3': wl_protocol_dir / 'unstable/text-input/text-input-unstable-v3.xml',
[wl_protocol_dir, 'unstable/xdg-shell/xdg-shell-unstable-v6.xml'], 'xdg-decoration-unstable-v1': wl_protocol_dir / 'unstable/xdg-decoration/xdg-decoration-unstable-v1.xml',
'gtk-primary-selection.xml', 'xdg-output-unstable-v1': wl_protocol_dir / 'unstable/xdg-output/xdg-output-unstable-v1.xml',
'idle.xml', 'xdg-shell-unstable-v6': wl_protocol_dir / 'unstable/xdg-shell/xdg-shell-unstable-v6.xml',
'input-method-unstable-v2.xml', # Other protocols
'server-decoration.xml', 'gtk-primary-selection': 'gtk-primary-selection.xml',
'virtual-keyboard-unstable-v1.xml', 'kde-idle': 'idle.xml',
'wlr-data-control-unstable-v1.xml', 'kde-server-decoration': 'server-decoration.xml',
'wlr-export-dmabuf-unstable-v1.xml', 'input-method-unstable-v2': 'input-method-unstable-v2.xml',
'wlr-foreign-toplevel-management-unstable-v1.xml', 'virtual-keyboard-unstable-v1': 'virtual-keyboard-unstable-v1.xml',
'wlr-gamma-control-unstable-v1.xml', 'wlr-data-control-unstable-v1': 'wlr-data-control-unstable-v1.xml',
'wlr-input-inhibitor-unstable-v1.xml', 'wlr-export-dmabuf-unstable-v1': 'wlr-export-dmabuf-unstable-v1.xml',
'wlr-layer-shell-unstable-v1.xml', 'wlr-foreign-toplevel-management-unstable-v1': 'wlr-foreign-toplevel-management-unstable-v1.xml',
'wlr-output-management-unstable-v1.xml', 'wlr-gamma-control-unstable-v1': 'wlr-gamma-control-unstable-v1.xml',
'wlr-screencopy-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 = [ foreach name, path : protocols
[wl_protocol_dir, 'stable/presentation-time/presentation-time.xml'], code = custom_target(
[wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'], name.underscorify() + '_c',
[wl_protocol_dir, 'unstable/idle-inhibit/idle-inhibit-unstable-v1.xml'], input: path,
[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,
output: '@BASENAME@-protocol.c', output: '@BASENAME@-protocol.c',
command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'], command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'],
) )
wl_protos_headers += custom_target( wlr_files += code
xml.underscorify() + '_server_h',
input: xml, wlr_files += custom_target(
name.underscorify() + '_server_h',
input: path,
output: '@BASENAME@-protocol.h', output: '@BASENAME@-protocol.h',
command: [wayland_scanner, 'server-header', '@INPUT@', '@OUTPUT@'], command: [wayland_scanner, 'server-header', '@INPUT@', '@OUTPUT@'],
) )
endforeach
foreach p : client_protocols header = custom_target(
xml = join_paths(p) name.underscorify() + '_client_h',
wl_protos_headers += custom_target( input: path,
xml.underscorify() + '_client_h',
input: xml,
output: '@BASENAME@-client-protocol.h', output: '@BASENAME@-client-protocol.h',
command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'], 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( set_variable(name.underscorify() + '_c', code)
link_with: lib_wl_protos, set_variable(name.underscorify() + '_h', header)
sources: wl_protos_headers, endforeach
)

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

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

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

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

@ -5,13 +5,24 @@ xwayland_required = [
'xcb-render', 'xcb-render',
'xcb-xfixes', 'xcb-xfixes',
] ]
xwayland_optional = [ xwayland_optional = {
'xcb-errors', 'xcb-errors': 'Required for printing X11 errors.',
'xcb-icccm', '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 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() if not dep.found()
subdir_done() subdir_done()
endif endif
@ -19,17 +30,26 @@ foreach lib : xwayland_required
xwayland_libs += dep xwayland_libs += dep
endforeach endforeach
foreach lib : xwayland_optional foreach lib, desc : xwayland_optional
dep = dependency(lib, required: get_option(lib)) 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() if dep.found()
xwayland_libs += dep xwayland_libs += dep
conf_data.set10('WLR_HAS_' + lib.underscorify().to_upper(), true) conf_data.set10('WLR_HAS_' + lib.underscorify().to_upper(), true)
endif endif
endforeach endforeach
lib_wlr_xwayland = static_library( wlr_files += files(
'wlr_xwayland',
files(
'selection/dnd.c', 'selection/dnd.c',
'selection/incoming.c', 'selection/incoming.c',
'selection/outgoing.c', 'selection/outgoing.c',
@ -37,15 +57,6 @@ lib_wlr_xwayland = static_library(
'sockets.c', 'sockets.c',
'xwayland.c', 'xwayland.c',
'xwm.c', 'xwm.c',
),
include_directories: wlr_inc,
dependencies: [
wayland_server,
xwayland_libs,
xkbcommon,
pixman,
],
) )
wlr_deps += xwayland_libs
wlr_parts += lib_wlr_xwayland
conf_data.set10('WLR_HAS_XWAYLAND', true) conf_data.set10('WLR_HAS_XWAYLAND', true)

Loading…
Cancel
Save