mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-25 05:15:41 +02:00
meson: modules: make it data-driven
This commit is contained in:
parent
88a415cbbd
commit
3995464d49
1 changed files with 47 additions and 110 deletions
|
@ -3,122 +3,59 @@ module_sdk = declare_dependency(dependencies: [cairo, cairo_ft, threads])
|
|||
modules = []
|
||||
|
||||
alsa = dependency('alsa')
|
||||
if get_option('core-plugins-as-shared-libraries')
|
||||
shared_module(
|
||||
'alsa', 'alsa.c', dependencies: [module_sdk, alsa], name_prefix: 'module_')
|
||||
else
|
||||
alsa_mod = static_library(
|
||||
'module_alsa', 'alsa.c', dependencies: [module_sdk, alsa])
|
||||
modules += [declare_dependency(
|
||||
link_with: alsa_mod, compile_args: '-DHAVE_PLUGIN_alsa')]
|
||||
endif
|
||||
|
||||
udev = dependency('libudev')
|
||||
if get_option('core-plugins-as-shared-libraries')
|
||||
shared_module(
|
||||
'backlight', 'backlight.c', dependencies: [module_sdk, udev], name_prefix: 'module_')
|
||||
else
|
||||
backlight_mod = static_library(
|
||||
'module_backlight', 'backlight.c', dependencies: [module_sdk, udev])
|
||||
modules += [declare_dependency(
|
||||
link_with: backlight_mod, compile_args: '-DHAVE_PLUGIN_backlight')]
|
||||
endif
|
||||
|
||||
if get_option('core-plugins-as-shared-libraries')
|
||||
shared_module(
|
||||
'battery', 'battery.c', dependencies: [module_sdk, udev], name_prefix: 'module_')
|
||||
else
|
||||
battery_mod = static_library(
|
||||
'module_battery', 'battery.c', dependencies: [module_sdk, udev])
|
||||
modules += [declare_dependency(
|
||||
link_with: battery_mod, compile_args: '-DHAVE_PLUGIN_battery')]
|
||||
endif
|
||||
|
||||
if get_option('core-plugins-as-shared-libraries')
|
||||
shared_module(
|
||||
'clock', 'clock.c', dependencies: [module_sdk], name_prefix: 'module_')
|
||||
else
|
||||
clock_mod = static_library(
|
||||
'module_clock', 'clock.c', dependencies: [module_sdk])
|
||||
modules += [declare_dependency(
|
||||
link_with: clock_mod, compile_args: '-DHAVE_PLUGIN_clock')]
|
||||
endif
|
||||
|
||||
json = dependency('json-c')
|
||||
if get_option('core-plugins-as-shared-libraries')
|
||||
shared_module('module_i3', 'i3.c', 'i3-common.c', 'i3-common.h',
|
||||
dependencies: [module_sdk, json, dynlist],
|
||||
name_prefix: '')
|
||||
else
|
||||
i3_mod = static_library(
|
||||
'module_i3', 'i3.c', 'i3-common.c', 'i3-common.h',
|
||||
dependencies: [module_sdk, json, dynlist])
|
||||
modules += [declare_dependency(
|
||||
link_with: i3_mod, compile_args: '-DHAVE_PLUGIN_i3')]
|
||||
endif
|
||||
|
||||
if get_option('core-plugins-as-shared-libraries')
|
||||
shared_module(
|
||||
'label', 'label.c', dependencies: [module_sdk], name_prefix: 'module_')
|
||||
else
|
||||
label_mod = static_library(
|
||||
'module_label', 'label.c', dependencies: [module_sdk])
|
||||
modules += [declare_dependency(
|
||||
link_with: label_mod, compile_args: '-DHAVE_PLUGIN_label')]
|
||||
endif
|
||||
|
||||
mpd = dependency('libmpdclient')
|
||||
if get_option('core-plugins-as-shared-libraries')
|
||||
shared_module(
|
||||
'mpd', 'mpd.c', dependencies: [module_sdk, mpd], name_prefix: 'module_')
|
||||
else
|
||||
mpd_mod = static_library(
|
||||
'module_mpd', 'mpd.c', dependencies: [module_sdk, mpd])
|
||||
modules += [declare_dependency(
|
||||
link_with: mpd_mod, compile_args: '-DHAVE_PLUGIN_mpd')]
|
||||
endif
|
||||
xcb_xkb = dependency('xcb-xkb', required: get_option('backend-x11'))
|
||||
|
||||
if get_option('core-plugins-as-shared-libraries')
|
||||
shared_module(
|
||||
'network', 'network.c', dependencies: [module_sdk], name_prefix: 'module_')
|
||||
else
|
||||
network_mod = static_library(
|
||||
'module_network', 'network.c', dependencies: [module_sdk])
|
||||
modules += [declare_dependency(
|
||||
link_with: network_mod, compile_args: '-DHAVE_PLUGIN_network')]
|
||||
endif
|
||||
# Module name -> (source-list, dep-list)
|
||||
deps = {
|
||||
'alsa': [[], [alsa]],
|
||||
'backlight': [[], [udev]],
|
||||
'battery': [[], [udev]],
|
||||
'clock': [[], []],
|
||||
'i3': [['i3-common.c', 'i3-common.h'], [dynlist, json]],
|
||||
'label': [[], []],
|
||||
'mpd': [[], [mpd]],
|
||||
'network': [[], []],
|
||||
'removables': [[], [dynlist, udev]],
|
||||
}
|
||||
|
||||
if get_option('core-plugins-as-shared-libraries')
|
||||
shared_module(
|
||||
'removables', 'removables.c', dependencies: [module_sdk, udev, dynlist],
|
||||
deps_x11_only = {
|
||||
'xkb': [[], [xcb_stuff, xcb_xkb]],
|
||||
'xwindow': [[], [xcb_stuff]],
|
||||
}
|
||||
|
||||
foreach mod, data : deps
|
||||
sources = data[0]
|
||||
dep = data[1]
|
||||
|
||||
if get_option('core-plugins-as-shared-libraries')
|
||||
shared_module(mod, '@0@.c'.format(mod), sources,
|
||||
dependencies: [module_sdk] + dep,
|
||||
name_prefix: 'module_')
|
||||
else
|
||||
removables_mod = static_library(
|
||||
'module_removables', 'removables.c', dependencies: [module_sdk, udev, dynlist])
|
||||
else
|
||||
modules += [declare_dependency(
|
||||
link_with: removables_mod, compile_args: '-DHAVE_PLUGIN_removables')]
|
||||
endif
|
||||
sources: ['@0@.c'.format(mod)] + sources,
|
||||
dependencies: [module_sdk] + dep,
|
||||
compile_args: '-DHAVE_PLUGIN_@0@'.format(mod))]
|
||||
endif
|
||||
endforeach
|
||||
|
||||
if enable_x11
|
||||
xcb_xkb = dependency('xcb-xkb')
|
||||
if get_option('core-plugins-as-shared-libraries')
|
||||
shared_module(
|
||||
'xkb', 'xkb.c', dependencies: [module_sdk, xcb_stuff, xcb_xkb], name_prefix: 'module_')
|
||||
else
|
||||
xkb_mod = static_library(
|
||||
'module_xkb', 'xkb.c', dependencies: [module_sdk, xcb_stuff, xcb_xkb])
|
||||
modules += [declare_dependency(
|
||||
link_with: xkb_mod, compile_args: '-DHAVE_PLUGIN_xkb')]
|
||||
endif
|
||||
foreach mod, data : deps_x11_only
|
||||
sources = data[0]
|
||||
dep = data[1]
|
||||
|
||||
if get_option('core-plugins-as-shared-libraries')
|
||||
shared_module(
|
||||
'xwindow', 'xwindow.c', dependencies: [module_sdk, xcb_stuff],
|
||||
shared_module(mod, '@0@.c'.format(mod), sources,
|
||||
dependencies: [module_sdk] + dep,
|
||||
name_prefix: 'module_')
|
||||
else
|
||||
xwindow_mod = static_library(
|
||||
'module_xwindow', 'xwindow.c', dependencies: [module_sdk, xcb_stuff])
|
||||
modules += [declare_dependency(
|
||||
link_with: xwindow_mod, compile_args: '-DHAVE_MODULE_xwindow')]
|
||||
sources: ['@0@.c'.format(mod)] + sources,
|
||||
dependencies: [module_sdk] + dep,
|
||||
compile_args: '-DHAVE_PLUGIN_@0@'.format(mod))]
|
||||
endif
|
||||
endforeach
|
||||
endif
|
||||
|
|
Loading…
Add table
Reference in a new issue