plugin: use auto-generated defines for enabled plugins

This commit is contained in:
Daniel Eklöf 2022-12-14 10:16:54 +01:00
parent 9ef6d73663
commit 690bd630a2
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 63 additions and 86 deletions

View file

@ -131,29 +131,6 @@ yambar = executable(
version, version,
dependencies: [bar, libepoll, libinotify, pixman, yaml, threads, dl, tllist, fcft] + dependencies: [bar, libepoll, libinotify, pixman, yaml, threads, dl, tllist, fcft] +
decorations + particles + modules, decorations + particles + modules,
c_args: [
plugin_alsa_enabled ? '-DPLUGIN_ENABLED_ALSA' : [],
plugin_backlight_enabled ? '-DPLUGIN_ENABLED_BACKLIGHT' : [],
plugin_battery_enabled ? '-DPLUGIN_ENABLED_BATTERY' : [],
plugin_clock_enabled ? '-DPLUGIN_ENABLED_CLOCK' : [],
plugin_cpu_enabled ? '-DPLUGIN_ENABLED_CPU' : [],
plugin_disk_io_enabled ? '-DPLUGIN_ENABLED_DISK_IO' : [],
plugin_dwl_enabled ? '-DPLUGIN_ENABLED_DWL' : [],
plugin_foreign_toplevel_enabled ? '-DPLUGIN_ENABLED_FOREIGN_TOPLEVEL' : [],
plugin_mem_enabled ? '-DPLUGIN_ENABLED_MEM' : [],
plugin_mpd_enabled ? '-DPLUGIN_ENABLED_MPD' : [],
plugin_i3_enabled ? '-DPLUGIN_ENABLED_I3' : [],
plugin_label_enabled ? '-DPLUGIN_ENABLED_LABEL' : [],
plugin_network_enabled ? '-DPLUGIN_ENABLED_NETWORK' : [],
plugin_pipewire_enabled ? '-DPLUGIN_ENABLED_PIPEWIRE' : [],
plugin_pulse_enabled ? '-DPLUGIN_ENABLED_PULSE' : [],
plugin_removables_enabled ? '-DPLUGIN_ENABLED_REMOVABLES' : [],
plugin_river_enabled ? '-DPLUGIN_ENABLED_RIVER' : [],
plugin_script_enabled ? '-DPLUGIN_ENABLED_SCRIPT' : [],
plugin_sway_xkb_enabled ? '-DPLUGIN_ENABLED_SWAY_XKB' : [],
plugin_xkb_enabled ? '-DPLUGIN_ENABLED_XKB' : [],
plugin_xwindow_enabled ? '-DPLUGIN_ENABLED_XWINDOW' : [],
],
build_rpath: '$ORIGIN/modules:$ORIGIN/decorations:$ORIGIN/particles', build_rpath: '$ORIGIN/modules:$ORIGIN/decorations:$ORIGIN/particles',
export_dynamic: true, export_dynamic: true,
install: true, install: true,

View file

@ -32,67 +32,67 @@
keychain_t *chain, const struct yml_node *node); \ keychain_t *chain, const struct yml_node *node); \
extern struct deco *plug_name##_from_conf(const struct yml_node *node); extern struct deco *plug_name##_from_conf(const struct yml_node *node);
#if defined(PLUGIN_ENABLED_ALSA) #if defined(HAVE_PLUGIN_alsa)
EXTERN_MODULE(alsa); EXTERN_MODULE(alsa);
#endif #endif
#if defined(PLUGIN_ENABLED_BACKLIGHT) #if defined(HAVE_PLUGIN_backlight)
EXTERN_MODULE(backlight); EXTERN_MODULE(backlight);
#endif #endif
#if defined(PLUGIN_ENABLED_BATTERY) #if defined(HAVE_PLUGIN_battery)
EXTERN_MODULE(battery); EXTERN_MODULE(battery);
#endif #endif
#if defined(PLUGIN_ENABLED_CLOCK) #if defined(HAVE_PLUGIN_clock)
EXTERN_MODULE(clock); EXTERN_MODULE(clock);
#endif #endif
#if defined(PLUGIN_ENABLED_CPU) #if defined(HAVE_PLUGIN_cpu)
EXTERN_MODULE(cpu); EXTERN_MODULE(cpu);
#endif #endif
#if defined(PLUGIN_ENABLED_DISK_IO) #if defined(HAVE_PLUGIN_disk_io)
EXTERN_MODULE(disk_io); EXTERN_MODULE(disk_io);
#endif #endif
#if defined(PLUGIN_ENABLED_DWL) #if defined(HAVE_PLUGIN_dwl)
EXTERN_MODULE(dwl); EXTERN_MODULE(dwl);
#endif #endif
#if defined(PLUGIN_ENABLED_FOREIGN_TOPLEVEL) #if defined(HAVE_PLUGIN_foreign_toplevel)
EXTERN_MODULE(foreign_toplevel); EXTERN_MODULE(foreign_toplevel);
#endif #endif
#if defined(PLUGIN_ENABLED_MEM) #if defined(HAVE_PLUGIN_mem)
EXTERN_MODULE(mem); EXTERN_MODULE(mem);
#endif #endif
#if defined(PLUGIN_ENABLED_MPD) #if defined(HAVE_PLUGIN_mpd)
EXTERN_MODULE(mpd); EXTERN_MODULE(mpd);
#endif #endif
#if defined(PLUGIN_ENABLED_I3) #if defined(HAVE_PLUGIN_i3)
EXTERN_MODULE(i3); EXTERN_MODULE(i3);
#endif #endif
#if defined(PLUGIN_ENABLED_LABEL) #if defined(HAVE_PLUGIN_label)
EXTERN_MODULE(label); EXTERN_MODULE(label);
#endif #endif
#if defined(PLUGIN_ENABLED_NETWORK) #if defined(HAVE_PLUGIN_network)
EXTERN_MODULE(network); EXTERN_MODULE(network);
#endif #endif
#if defined(PLUGIN_ENABLED_PIPEWIRE) #if defined(HAVE_PLUGIN_pipewire)
EXTERN_MODULE(pipewire); EXTERN_MODULE(pipewire);
#endif #endif
#if defined(PLUGIN_ENABLED_PULSE) #if defined(HAVE_PLUGIN_pulse)
EXTERN_MODULE(pulse); EXTERN_MODULE(pulse);
#endif #endif
#if defined(PLUGIN_ENABLED_REMOVABLES) #if defined(HAVE_PLUGIN_removables)
EXTERN_MODULE(removables); EXTERN_MODULE(removables);
#endif #endif
#if defined(PLUGIN_ENABLED_RIVER) #if defined(HAVE_PLUGIN_river)
EXTERN_MODULE(river); EXTERN_MODULE(river);
#endif #endif
#if defined(PLUGIN_ENABLED_SCRIPT) #if defined(HAVE_PLUGIN_script)
EXTERN_MODULE(script); EXTERN_MODULE(script);
#endif #endif
#if defined(PLUGIN_ENABLED_SWAY_XKB) #if defined(HAVE_PLUGIN_sway_xkb)
EXTERN_MODULE(sway_xkb); EXTERN_MODULE(sway_xkb);
#endif #endif
#if defined(PLUGIN_ENABLED_XKB) #if defined(HAVE_PLUGIN_xkb)
EXTERN_MODULE(xkb); EXTERN_MODULE(xkb);
#endif #endif
#if defined(PLUGIN_ENABLED_XWINDOW) #if defined(HAVE_PLUGIN_xwindow)
EXTERN_MODULE(xwindow); EXTERN_MODULE(xwindow);
#endif #endif
@ -158,67 +158,67 @@ init(void)
tll_back(plugins).decoration = &deco_##func_prefix##_iface; \ tll_back(plugins).decoration = &deco_##func_prefix##_iface; \
} while (0) } while (0)
#if defined(PLUGIN_ENABLED_ALSA) #if defined(HAVE_PLUGIN_alsa)
REGISTER_CORE_MODULE(alsa, alsa); REGISTER_CORE_MODULE(alsa, alsa);
#endif #endif
#if defined(PLUGIN_ENABLED_BACKLIGHT) #if defined(HAVE_PLUGIN_backlight)
REGISTER_CORE_MODULE(backlight, backlight); REGISTER_CORE_MODULE(backlight, backlight);
#endif #endif
#if defined(PLUGIN_ENABLED_BATTERY) #if defined(HAVE_PLUGIN_battery)
REGISTER_CORE_MODULE(battery, battery); REGISTER_CORE_MODULE(battery, battery);
#endif #endif
#if defined(PLUGIN_ENABLED_CLOCK) #if defined(HAVE_PLUGIN_clock)
REGISTER_CORE_MODULE(clock, clock); REGISTER_CORE_MODULE(clock, clock);
#endif #endif
#if defined(PLUGIN_ENABLED_CPU) #if defined(HAVE_PLUGIN_cpu)
REGISTER_CORE_MODULE(cpu, cpu); REGISTER_CORE_MODULE(cpu, cpu);
#endif #endif
#if defined(PLUGIN_ENABLED_DISK_IO) #if defined(HAVE_PLUGIN_disk_io)
REGISTER_CORE_MODULE(disk-io, disk_io); REGISTER_CORE_MODULE(disk-io, disk_io);
#endif #endif
#if defined(PLUGIN_ENABLED_DWL) #if defined(HAVE_PLUGIN_dwl)
REGISTER_CORE_MODULE(dwl, dwl); REGISTER_CORE_MODULE(dwl, dwl);
#endif #endif
#if defined(PLUGIN_ENABLED_FOREIGN_TOPLEVEL) #if defined(HAVE_PLUGIN_foreign_toplevel)
REGISTER_CORE_MODULE(foreign-toplevel, foreign_toplevel); REGISTER_CORE_MODULE(foreign-toplevel, foreign_toplevel);
#endif #endif
#if defined(PLUGIN_ENABLED_MEM) #if defined(HAVE_PLUGIN_mem)
REGISTER_CORE_MODULE(mem, mem); REGISTER_CORE_MODULE(mem, mem);
#endif #endif
#if defined(PLUGIN_ENABLED_MPD) #if defined(HAVE_PLUGIN_mpd)
REGISTER_CORE_MODULE(mpd, mpd); REGISTER_CORE_MODULE(mpd, mpd);
#endif #endif
#if defined(PLUGIN_ENABLED_I3) #if defined(HAVE_PLUGIN_i3)
REGISTER_CORE_MODULE(i3, i3); REGISTER_CORE_MODULE(i3, i3);
#endif #endif
#if defined(PLUGIN_ENABLED_LABEL) #if defined(HAVE_PLUGIN_label)
REGISTER_CORE_MODULE(label, label); REGISTER_CORE_MODULE(label, label);
#endif #endif
#if defined(PLUGIN_ENABLED_NETWORK) #if defined(HAVE_PLUGIN_network)
REGISTER_CORE_MODULE(network, network); REGISTER_CORE_MODULE(network, network);
#endif #endif
#if defined(PLUGIN_ENABLED_PIPEWIRE) #if defined(HAVE_PLUGIN_pipewire)
REGISTER_CORE_MODULE(pipewire, pipewire); REGISTER_CORE_MODULE(pipewire, pipewire);
#endif #endif
#if defined(PLUGIN_ENABLED_PULSE) #if defined(HAVE_PLUGIN_pulse)
REGISTER_CORE_MODULE(pulse, pulse); REGISTER_CORE_MODULE(pulse, pulse);
#endif #endif
#if defined(PLUGIN_ENABLED_REMOVABLES) #if defined(HAVE_PLUGIN_removables)
REGISTER_CORE_MODULE(removables, removables); REGISTER_CORE_MODULE(removables, removables);
#endif #endif
#if defined(PLUGIN_ENABLED_RIVER) #if defined(HAVE_PLUGIN_river)
REGISTER_CORE_MODULE(river, river); REGISTER_CORE_MODULE(river, river);
#endif #endif
#if defined(PLUGIN_ENABLED_SCRIPT) #if defined(HAVE_PLUGIN_script)
REGISTER_CORE_MODULE(script, script); REGISTER_CORE_MODULE(script, script);
#endif #endif
#if defined(PLUGIN_ENABLED_SWAY_XKB) #if defined(HAVE_PLUGIN_sway_xkb)
REGISTER_CORE_MODULE(sway-xkb, sway_xkb); REGISTER_CORE_MODULE(sway-xkb, sway_xkb);
#endif #endif
#if defined(PLUGIN_ENABLED_XKB) #if defined(HAVE_PLUGIN_xkb)
REGISTER_CORE_MODULE(xkb, xkb); REGISTER_CORE_MODULE(xkb, xkb);
#endif #endif
#if defined(PLUGIN_ENABLED_XWINDOW) #if defined(HAVE_PLUGIN_xwindow)
REGISTER_CORE_MODULE(xwindow, xwindow); REGISTER_CORE_MODULE(xwindow, xwindow);
#endif #endif