meson: make ‘sway-xkb’ plugin compile time optional

This commit is contained in:
Daniel Eklöf 2022-12-14 09:53:24 +01:00
parent 0cf0d64970
commit b6450446a8
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
4 changed files with 22 additions and 10 deletions

View file

@ -148,6 +148,7 @@ yambar = executable(
plugin_pulse_enabled ? '-DPLUGIN_ENABLED_PULSE' : [], plugin_pulse_enabled ? '-DPLUGIN_ENABLED_PULSE' : [],
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' : [],
], ],
build_rpath: '$ORIGIN/modules:$ORIGIN/decorations:$ORIGIN/particles', build_rpath: '$ORIGIN/modules:$ORIGIN/decorations:$ORIGIN/particles',
export_dynamic: true, export_dynamic: true,
@ -202,6 +203,7 @@ summary(
'PulseAudio': plugin_pulse_enabled, 'PulseAudio': plugin_pulse_enabled,
'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,
}, },
section: 'Optional modules', section: 'Optional modules',
bool_yn: true bool_yn: true

View file

@ -30,11 +30,13 @@ option('plugin-label', type: 'feature', value: 'auto',
description: 'Label support') description: 'Label support')
option('plugin-network', type: 'feature', value: 'auto', option('plugin-network', type: 'feature', value: 'auto',
description: 'Network monitoring support') description: 'Network monitoring support')
option('plugin-removables', type: 'feature', value: 'auto',
description: 'Removables (USB sticks, CD-ROM etc) monitoring support')
option('plugin-script', type: 'feature', value: 'auto',
description: 'Script support')
option('plugin-pipewire', type: 'feature', value: 'auto', option('plugin-pipewire', type: 'feature', value: 'auto',
description: 'Pipewire support') description: 'Pipewire support')
option('plugin-pulse', type: 'feature', value: 'auto', option('plugin-pulse', type: 'feature', value: 'auto',
description: 'PulseAudio support') description: 'PulseAudio support')
option('plugin-removables', type: 'feature', value: 'auto',
description: 'Removables (USB sticks, CD-ROM etc) monitoring support')
option('plugin-script', type: 'feature', value: 'auto',
description: 'Script support')
option('plugin-sway-xkb', type: 'feature', value: 'auto',
description: 'keyboard support for Sway')

View file

@ -2,7 +2,6 @@ module_sdk = declare_dependency(dependencies: [pixman, threads, tllist, fcft])
modules = [] modules = []
json = dependency('json-c')
xcb_xkb = dependency('xcb-xkb', required: get_option('backend-x11')) xcb_xkb = dependency('xcb-xkb', required: get_option('backend-x11'))
# Optional deps # Optional deps
@ -42,10 +41,11 @@ plugin_removables_enabled = udev_removables.found()
plugin_script_enabled = get_option('plugin-script').allowed() plugin_script_enabled = get_option('plugin-script').allowed()
json_sway_xkb = dependency('json-c', required: get_option('plugin-sway-xkb'))
plugin_sway_xkb_enabled = json_sway_xkb.found()
# Module name -> (source-list, dep-list) # Module name -> (source-list, dep-list)
mod_data = { mod_data = {}
'sway-xkb': [['i3-common.c', 'i3-common.h'], [dynlist, json]],
}
if plugin_alsa_enabled if plugin_alsa_enabled
mod_data += {'alsa': [[], [m, alsa]]} mod_data += {'alsa': [[], [m, alsa]]}
@ -111,6 +111,10 @@ if plugin_script_enabled
mod_data += {'script': [[], []]} mod_data += {'script': [[], []]}
endif endif
if plugin_sway_xkb_enabled
mod_data += {'sway-xkb': [['i3-common.c', 'i3-common.h'], [dynlist, json_sway_xkb]]}
endif
if backend_x11 if backend_x11
mod_data += { mod_data += {
'xkb': [[], [xcb_stuff, xcb_xkb]], 'xkb': [[], [xcb_stuff, xcb_xkb]],

View file

@ -81,8 +81,10 @@ EXTERN_MODULE(removables);
#if defined(PLUGIN_ENABLED_SCRIPT) #if defined(PLUGIN_ENABLED_SCRIPT)
EXTERN_MODULE(script); EXTERN_MODULE(script);
#endif #endif
EXTERN_MODULE(river); #if defined(PLUGIN_ENABLED_SWAY_XKB)
EXTERN_MODULE(sway_xkb); EXTERN_MODULE(sway_xkb);
#endif
EXTERN_MODULE(river);
EXTERN_MODULE(xkb); EXTERN_MODULE(xkb);
EXTERN_MODULE(xwindow); EXTERN_MODULE(xwindow);
@ -199,10 +201,12 @@ init(void)
#if defined(PLUGIN_ENABLED_SCRIPT) #if defined(PLUGIN_ENABLED_SCRIPT)
REGISTER_CORE_MODULE(script, script); REGISTER_CORE_MODULE(script, script);
#endif #endif
#if defined(PLUGIN_ENABLED_SWAY_XKB)
REGISTER_CORE_MODULE(sway-xkb, sway_xkb);
#endif
#if defined(HAVE_PLUGIN_river) #if defined(HAVE_PLUGIN_river)
REGISTER_CORE_MODULE(river, river); REGISTER_CORE_MODULE(river, river);
#endif #endif
REGISTER_CORE_MODULE(sway-xkb, sway_xkb);
#if defined(HAVE_PLUGIN_xkb) #if defined(HAVE_PLUGIN_xkb)
REGISTER_CORE_MODULE(xkb, xkb); REGISTER_CORE_MODULE(xkb, xkb);
#endif #endif