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 = []
|
modules = []
|
||||||
|
|
||||||
alsa = dependency('alsa')
|
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')
|
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')
|
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')
|
mpd = dependency('libmpdclient')
|
||||||
if get_option('core-plugins-as-shared-libraries')
|
xcb_xkb = dependency('xcb-xkb', required: get_option('backend-x11'))
|
||||||
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
|
|
||||||
|
|
||||||
if get_option('core-plugins-as-shared-libraries')
|
# Module name -> (source-list, dep-list)
|
||||||
shared_module(
|
deps = {
|
||||||
'network', 'network.c', dependencies: [module_sdk], name_prefix: 'module_')
|
'alsa': [[], [alsa]],
|
||||||
else
|
'backlight': [[], [udev]],
|
||||||
network_mod = static_library(
|
'battery': [[], [udev]],
|
||||||
'module_network', 'network.c', dependencies: [module_sdk])
|
'clock': [[], []],
|
||||||
modules += [declare_dependency(
|
'i3': [['i3-common.c', 'i3-common.h'], [dynlist, json]],
|
||||||
link_with: network_mod, compile_args: '-DHAVE_PLUGIN_network')]
|
'label': [[], []],
|
||||||
endif
|
'mpd': [[], [mpd]],
|
||||||
|
'network': [[], []],
|
||||||
|
'removables': [[], [dynlist, udev]],
|
||||||
|
}
|
||||||
|
|
||||||
if get_option('core-plugins-as-shared-libraries')
|
deps_x11_only = {
|
||||||
shared_module(
|
'xkb': [[], [xcb_stuff, xcb_xkb]],
|
||||||
'removables', 'removables.c', dependencies: [module_sdk, udev, dynlist],
|
'xwindow': [[], [xcb_stuff]],
|
||||||
name_prefix: 'module_')
|
}
|
||||||
else
|
|
||||||
removables_mod = static_library(
|
foreach mod, data : deps
|
||||||
'module_removables', 'removables.c', dependencies: [module_sdk, udev, dynlist])
|
sources = data[0]
|
||||||
modules += [declare_dependency(
|
dep = data[1]
|
||||||
link_with: removables_mod, compile_args: '-DHAVE_PLUGIN_removables')]
|
|
||||||
endif
|
if get_option('core-plugins-as-shared-libraries')
|
||||||
|
shared_module(mod, '@0@.c'.format(mod), sources,
|
||||||
|
dependencies: [module_sdk] + dep,
|
||||||
|
name_prefix: 'module_')
|
||||||
|
else
|
||||||
|
modules += [declare_dependency(
|
||||||
|
sources: ['@0@.c'.format(mod)] + sources,
|
||||||
|
dependencies: [module_sdk] + dep,
|
||||||
|
compile_args: '-DHAVE_PLUGIN_@0@'.format(mod))]
|
||||||
|
endif
|
||||||
|
endforeach
|
||||||
|
|
||||||
if enable_x11
|
if enable_x11
|
||||||
xcb_xkb = dependency('xcb-xkb')
|
foreach mod, data : deps_x11_only
|
||||||
if get_option('core-plugins-as-shared-libraries')
|
sources = data[0]
|
||||||
shared_module(
|
dep = data[1]
|
||||||
'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
|
|
||||||
|
|
||||||
if get_option('core-plugins-as-shared-libraries')
|
if get_option('core-plugins-as-shared-libraries')
|
||||||
shared_module(
|
shared_module(mod, '@0@.c'.format(mod), sources,
|
||||||
'xwindow', 'xwindow.c', dependencies: [module_sdk, xcb_stuff],
|
dependencies: [module_sdk] + dep,
|
||||||
name_prefix: 'module_')
|
name_prefix: 'module_')
|
||||||
else
|
else
|
||||||
xwindow_mod = static_library(
|
modules += [declare_dependency(
|
||||||
'module_xwindow', 'xwindow.c', dependencies: [module_sdk, xcb_stuff])
|
sources: ['@0@.c'.format(mod)] + sources,
|
||||||
modules += [declare_dependency(
|
dependencies: [module_sdk] + dep,
|
||||||
link_with: xwindow_mod, compile_args: '-DHAVE_MODULE_xwindow')]
|
compile_args: '-DHAVE_PLUGIN_@0@'.format(mod))]
|
||||||
endif
|
endif
|
||||||
|
endforeach
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue