meson: make ‘xkb’ plugin compile time optional

This commit is contained in:
Daniel Eklöf 2022-12-14 09:58:45 +01:00
parent b6450446a8
commit a14d38b0cb
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
4 changed files with 17 additions and 7 deletions

View file

@ -149,6 +149,7 @@ yambar = executable(
plugin_removables_enabled ? '-DPLUGIN_ENABLED_REMOVABLES' : [], plugin_removables_enabled ? '-DPLUGIN_ENABLED_REMOVABLES' : [],
plugin_script_enabled ? '-DPLUGIN_ENABLED_SCRIPT' : [], plugin_script_enabled ? '-DPLUGIN_ENABLED_SCRIPT' : [],
plugin_sway_xkb_enabled ? '-DPLUGIN_ENABLED_SWAY_XKB' : [], plugin_sway_xkb_enabled ? '-DPLUGIN_ENABLED_SWAY_XKB' : [],
plugin_xkb_enabled ? '-DPLUGIN_ENABLED_XKB' : [],
], ],
build_rpath: '$ORIGIN/modules:$ORIGIN/decorations:$ORIGIN/particles', build_rpath: '$ORIGIN/modules:$ORIGIN/decorations:$ORIGIN/particles',
export_dynamic: true, export_dynamic: true,
@ -204,6 +205,7 @@ summary(
'Removables monitoring': plugin_removables_enabled, 'Removables monitoring': plugin_removables_enabled,
'Script': plugin_script_enabled, 'Script': plugin_script_enabled,
'Sway XKB keyboard': plugin_sway_xkb_enabled, 'Sway XKB keyboard': plugin_sway_xkb_enabled,
'XKB keyboard (for X11)': plugin_xkb_enabled,
}, },
section: 'Optional modules', section: 'Optional modules',
bool_yn: true bool_yn: true

View file

@ -40,3 +40,5 @@ option('plugin-script', type: 'feature', value: 'auto',
description: 'Script support') description: 'Script support')
option('plugin-sway-xkb', type: 'feature', value: 'auto', option('plugin-sway-xkb', type: 'feature', value: 'auto',
description: 'keyboard support for Sway') description: 'keyboard support for Sway')
option('plugin-xkb', type: 'feature', value: 'auto',
description: 'keyboard support for X11')

View file

@ -2,8 +2,6 @@ module_sdk = declare_dependency(dependencies: [pixman, threads, tllist, fcft])
modules = [] modules = []
xcb_xkb = dependency('xcb-xkb', required: get_option('backend-x11'))
# Optional deps # Optional deps
alsa = dependency('alsa', required: get_option('plugin-alsa')) alsa = dependency('alsa', required: get_option('plugin-alsa'))
plugin_alsa_enabled = alsa.found() plugin_alsa_enabled = alsa.found()
@ -44,6 +42,9 @@ plugin_script_enabled = get_option('plugin-script').allowed()
json_sway_xkb = dependency('json-c', required: get_option('plugin-sway-xkb')) json_sway_xkb = dependency('json-c', required: get_option('plugin-sway-xkb'))
plugin_sway_xkb_enabled = json_sway_xkb.found() plugin_sway_xkb_enabled = json_sway_xkb.found()
xcb_xkb = dependency('xcb-xkb', required: get_option('plugin-xkb'))
plugin_xkb_enabled = backend_x11 and xcb_xkb.found()
# Module name -> (source-list, dep-list) # Module name -> (source-list, dep-list)
mod_data = {} mod_data = {}
@ -115,9 +116,12 @@ if plugin_sway_xkb_enabled
mod_data += {'sway-xkb': [['i3-common.c', 'i3-common.h'], [dynlist, json_sway_xkb]]} mod_data += {'sway-xkb': [['i3-common.c', 'i3-common.h'], [dynlist, json_sway_xkb]]}
endif endif
if plugin_xkb_enabled
mod_data += {'xkb': [[], [xcb_stuff, xcb_xkb]]}
endif
if backend_x11 if backend_x11
mod_data += { mod_data += {
'xkb': [[], [xcb_stuff, xcb_xkb]],
'xwindow': [[], [xcb_stuff]], 'xwindow': [[], [xcb_stuff]],
} }
endif endif

View file

@ -84,8 +84,10 @@ EXTERN_MODULE(script);
#if defined(PLUGIN_ENABLED_SWAY_XKB) #if defined(PLUGIN_ENABLED_SWAY_XKB)
EXTERN_MODULE(sway_xkb); EXTERN_MODULE(sway_xkb);
#endif #endif
EXTERN_MODULE(river); #if defined(PLUGIN_ENABLED_XKB)
EXTERN_MODULE(xkb); EXTERN_MODULE(xkb);
#endif
EXTERN_MODULE(river);
EXTERN_MODULE(xwindow); EXTERN_MODULE(xwindow);
EXTERN_PARTICLE(empty); EXTERN_PARTICLE(empty);
@ -204,12 +206,12 @@ init(void)
#if defined(PLUGIN_ENABLED_SWAY_XKB) #if defined(PLUGIN_ENABLED_SWAY_XKB)
REGISTER_CORE_MODULE(sway-xkb, sway_xkb); REGISTER_CORE_MODULE(sway-xkb, sway_xkb);
#endif #endif
#if defined(PLUGIN_ENABLED_XKB)
REGISTER_CORE_MODULE(xkb, xkb);
#endif
#if defined(HAVE_PLUGIN_river) #if defined(HAVE_PLUGIN_river)
REGISTER_CORE_MODULE(river, river); REGISTER_CORE_MODULE(river, river);
#endif #endif
#if defined(HAVE_PLUGIN_xkb)
REGISTER_CORE_MODULE(xkb, xkb);
#endif
#if defined(HAVE_PLUGIN_xwindow) #if defined(HAVE_PLUGIN_xwindow)
REGISTER_CORE_MODULE(xwindow, xwindow); REGISTER_CORE_MODULE(xwindow, xwindow);
#endif #endif