2026-08-09 12:46:14 +10:00
|
|
|
project('tabbed-wlroots', 'c',
|
|
|
|
|
version: '0.1.0',
|
|
|
|
|
meson_version: '>=1.0',
|
|
|
|
|
default_options: ['c_std=c11', 'warning_level=2'])
|
|
|
|
|
|
|
|
|
|
wlroots_ver = '>=0.19,<0.20'
|
|
|
|
|
|
|
|
|
|
# wlroots' pkg-config name varies between distributions (wlroots-0.19 on
|
|
|
|
|
# Debian/Ubuntu, plain wlroots on Arch/Fedora). Prefer the system copy, and
|
|
|
|
|
# fall back to a pinned source build from subprojects/wlroots.wrap when no
|
|
|
|
|
# matching system library is found.
|
|
|
|
|
wlroots = dependency('wlroots-0.19', version: wlroots_ver, required: false)
|
|
|
|
|
if not wlroots.found()
|
|
|
|
|
wlroots = dependency('wlroots', version: wlroots_ver, required: false)
|
|
|
|
|
endif
|
|
|
|
|
if not wlroots.found()
|
2026-08-10 09:25:52 +10:00
|
|
|
wlroots_subproj = subproject('wlroots',
|
|
|
|
|
default_options: ['examples=false', 'werror=false'])
|
2026-08-09 12:46:14 +10:00
|
|
|
wlroots = wlroots_subproj.get_variable('wlroots')
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
deps = [
|
|
|
|
|
wlroots,
|
|
|
|
|
dependency('wayland-server'),
|
|
|
|
|
dependency('wayland-client'),
|
|
|
|
|
dependency('wayland-egl'),
|
|
|
|
|
dependency('xkbcommon'),
|
|
|
|
|
dependency('egl'),
|
|
|
|
|
dependency('glesv2'),
|
2026-08-14 12:39:51 +10:00
|
|
|
dependency('freetype2'),
|
2026-08-14 12:55:42 +10:00
|
|
|
dependency('libpng'),
|
|
|
|
|
dependency('librsvg-2.0'),
|
2026-08-09 12:46:14 +10:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
cc = meson.get_compiler('c')
|
|
|
|
|
libm = cc.find_library('m', required: false)
|
|
|
|
|
if libm.found()
|
|
|
|
|
deps += libm
|
|
|
|
|
endif
|
|
|
|
|
|
2026-08-19 09:54:11 +10:00
|
|
|
# --- Wayland protocol stubs -------------------------------------------
|
|
|
|
|
# The protocol implementation and headers are generated at build time by
|
|
|
|
|
# wayland-scanner instead of being committed, so they always match the
|
|
|
|
|
# installed wayland-protocols (the previously committed copies were produced
|
|
|
|
|
# by wayland-scanner 1.24/1.26 and drifted apart). Outputs land in the build
|
|
|
|
|
# directory, which Meson adds to every target's include path automatically;
|
|
|
|
|
# that also satisfies the bundled wlroots subproject's wlr_xdg_shell.h and its
|
|
|
|
|
# quoted #include "xdg-shell-protocol.h".
|
|
|
|
|
|
|
|
|
|
wayland_protocols = dependency('wayland-protocols', version: '>=1.17',
|
|
|
|
|
fallback: 'wayland-protocols', default_options: ['tests=false'])
|
|
|
|
|
wl_protocols_dir = wayland_protocols.get_variable('pkgdatadir')
|
|
|
|
|
|
|
|
|
|
wayland_scanner_dep = dependency('wayland-scanner', native: true)
|
|
|
|
|
wayland_scanner = find_program(
|
|
|
|
|
wayland_scanner_dep.get_variable('wayland_scanner'))
|
|
|
|
|
|
|
|
|
|
# (input xml, output base name). The output base names keep the committed
|
|
|
|
|
# suffixes: xdg-decoration is the unstable-v1 protocol but is still named
|
|
|
|
|
# plain "xdg-decoration" because the sources #include those exact names.
|
|
|
|
|
protocols = {
|
|
|
|
|
'xdg-shell': [
|
|
|
|
|
wl_protocols_dir / 'stable/xdg-shell/xdg-shell.xml',
|
|
|
|
|
'xdg-shell',
|
|
|
|
|
],
|
|
|
|
|
'xdg-decoration': [
|
|
|
|
|
wl_protocols_dir / 'unstable/xdg-decoration/xdg-decoration-unstable-v1.xml',
|
|
|
|
|
'xdg-decoration',
|
|
|
|
|
],
|
|
|
|
|
'wlr-data-control-unstable-v1': [
|
|
|
|
|
'wlr-protocols/wlr-data-control-unstable-v1.xml',
|
|
|
|
|
'wlr-data-control',
|
|
|
|
|
],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protocol_sources = []
|
|
|
|
|
protocol_headers = []
|
|
|
|
|
foreach protocol, p : protocols
|
|
|
|
|
xml = p[0]
|
|
|
|
|
base = p[1]
|
|
|
|
|
protocol_sources += custom_target(protocol + ' protocol code',
|
|
|
|
|
input: xml,
|
|
|
|
|
output: base + '-protocol.c',
|
|
|
|
|
command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'])
|
|
|
|
|
protocol_headers += custom_target(protocol + ' client header',
|
|
|
|
|
input: xml,
|
|
|
|
|
output: base + '-client.h',
|
|
|
|
|
command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'])
|
|
|
|
|
if protocol == 'xdg-shell'
|
|
|
|
|
protocol_headers += custom_target(protocol + ' server header',
|
|
|
|
|
input: xml,
|
|
|
|
|
output: base + '-protocol.h',
|
|
|
|
|
command: [wayland_scanner, 'server-header', '@INPUT@', '@OUTPUT@'])
|
|
|
|
|
endif
|
|
|
|
|
endforeach
|
|
|
|
|
|
2026-08-09 12:46:14 +10:00
|
|
|
executable('tabbed-wlroots',
|
|
|
|
|
'tabbed-wlroots.c',
|
2026-08-19 09:54:11 +10:00
|
|
|
protocol_sources,
|
|
|
|
|
protocol_headers,
|
2026-08-09 12:46:14 +10:00
|
|
|
dependencies: deps,
|
|
|
|
|
c_args: ['-DWLR_USE_UNSTABLE'])
|
2026-08-10 07:29:10 +10:00
|
|
|
|
2026-08-19 09:54:11 +10:00
|
|
|
# wltest needs only the xdg-shell stub (protocol_sources/headers[0]).
|
2026-08-10 07:29:10 +10:00
|
|
|
executable('wltest',
|
|
|
|
|
'tests/wltest.c',
|
2026-08-19 09:54:11 +10:00
|
|
|
protocol_sources[0],
|
|
|
|
|
protocol_headers[0],
|
|
|
|
|
dependencies: dependency('wayland-client'))
|