summaryrefslogtreecommitdiffhomepage
path: root/packages/ext-keybindings/meson.build
blob: d56af400c57d3eb5f1c550e1d1f6c6dab09fa2eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# ext-keybindings — config-driven compositor keybindings as a CORE extension.
# Public headers (the contract): include/unbox/ext-keybindings/
#   ext_keybindings.hpp — the extension factory (the WHOLE cross-extension
#   surface; this is a LEAF consumer — it exports no hooks/services).
#
# Decision cores live in src/ and are wlroots/GL-free: the combo parser
# (xkbcommon only), the toml loader (toml++), the matcher + tap state machine,
# and the focus ring. The glue (src/extension.cpp) is the thin effectful edge
# that binds the kernel key_filter, the ext-xdg-shell toplevel events, fork/exec,
# and wl_display_terminate.

ext_keybindings_inc = include_directories('include')

# toml++: an APPROVED dep (notes/plan.md §2), a Meson wrap kept private to THIS
# unit (subprojects/tomlplusplus.wrap). Force default_library=static: the wrapped
# subproject's own meson.build hardcodes default_library=shared, which would make
# the installed `unbox` binary NEED libtomlplusplus.so.3 at runtime (only found in
# the dev build via LD_LIBRARY_PATH; absent from a system install). Linking it
# statically bakes it into the binary — correct for both dev and the package.
tomlplusplus_dep = dependency('tomlplusplus',
                              default_options: ['default_library=static'])

# Glue library. Needs the kernel ABI, ext-xdg-shell's public contract (the glue
# includes its header to consume the Service + Toplevel), ext-stage-dock's public
# contract (the dock Service for dock-toggle-visible), xkbcommon (the combo
# parser resolves keysym names), and toml++ (the config loader).
ext_keybindings_lib = static_library(
  'unbox-ext-keybindings',
  'src/extension.cpp',
  'src/config.cpp',
  include_directories: ext_keybindings_inc,
  dependencies: [kernel_dep, ext_xdg_shell_dep, ext_stage_dock_dep,
                 xkbcommon_dep, tomlplusplus_dep],
)

# What host-bin links against: the factory. kernel_dep rides through for the
# Extension ABI the factory returns. ext_stage_dock_dep rides so consumers
# (including host-bin and the glue test) can resolve the dock Service type.
ext_keybindings_dep = declare_dependency(
  link_with: ext_keybindings_lib,
  include_directories: ext_keybindings_inc,
  dependencies: [kernel_dep, ext_stage_dock_dep],
)

# Tests, asymmetric: the pure decision cores doctest-hard (combo parser, toml
# loader, matcher + tap SM, focus ring) with NO kernel/wlroots running, plus a
# lenient headless glue smoke (install + activate + dispatch + clean shutdown).
# The pure-core TU compiles the core sources directly and needs `src` on the
# include path (a unit may read its own src/) plus xkbcommon + toml++.
ext_keybindings_policy_test = executable(
  'ext-keybindings-policy-tests',
  'tests/test_policy.cpp',
  'src/config.cpp',
  include_directories: [ext_keybindings_inc, include_directories('src')],
  dependencies: [doctest_dep, xkbcommon_dep, tomlplusplus_dep],
)
test(
  'ext-keybindings-policy',
  ext_keybindings_policy_test,
  suite: 'ext-keybindings',
)

# Glue test: install + activate + dispatch + shutdown on the wlr headless
# backend, with ext-xdg-shell present (keybindings depends on it). Lenient.
ext_keybindings_glue_test = executable(
  'ext-keybindings-glue-tests',
  'tests/test_glue.cpp',
  dependencies: [ext_keybindings_dep, ext_xdg_shell_dep, doctest_dep],
)
test(
  'ext-keybindings-glue',
  ext_keybindings_glue_test,
  suite: 'ext-keybindings',
)

# Aggregate alias the brief builds: `ninja -C build ext-keybindings-tests`.
alias_target('ext-keybindings-tests',
  ext_keybindings_policy_test,
  ext_keybindings_glue_test,
)