modules/mpris: fix dependency search

Move dependency discovery to be with other module dependency searches.
Also only define the `sdbus` dependency if the module is enabled.

For some reason, `mpris.c` was attempted to be compiled even with the
option off otherwise. It is also just more consistent.
This commit is contained in:
Ben Boeckel 2025-03-09 21:43:47 +01:00
parent e68ed8d843
commit 82c564f5ee
2 changed files with 5 additions and 7 deletions

View file

@ -77,10 +77,6 @@ backend_wayland = wayland_client.found() and wayland_cursor.found()
tllist = dependency('tllist', version: '>=1.0.1', fallback: 'tllist') tllist = dependency('tllist', version: '>=1.0.1', fallback: 'tllist')
fcft = dependency('fcft', version: ['>=3.0.0', '<4.0.0'], fallback: 'fcft') fcft = dependency('fcft', version: ['>=3.0.0', '<4.0.0'], fallback: 'fcft')
# DBus dependency. Used by 'modules/mpris'
sdbus_library = dependency('libsystemd', 'libelogind', 'basu', required: get_option('plugin-mpris'))
sdbus = declare_dependency(compile_args: ['-DHAVE_' + sdbus_library.name().to_upper()], dependencies:[sdbus_library])
add_project_arguments( add_project_arguments(
cc_flags + cc_flags +
['-D_GNU_SOURCE'] + ['-D_GNU_SOURCE'] +

View file

@ -22,8 +22,9 @@ plugin_mem_enabled = get_option('plugin-mem').allowed()
mpd = dependency('libmpdclient', required: get_option('plugin-mpd')) mpd = dependency('libmpdclient', required: get_option('plugin-mpd'))
plugin_mpd_enabled = mpd.found() plugin_mpd_enabled = mpd.found()
mpris = sdbus # DBus dependency. Used by 'mpris'
plugin_mpris_enabled = sdbus.found() sdbus_library = dependency('libsystemd', 'libelogind', 'basu', required: get_option('plugin-mpris'))
plugin_mpris_enabled = sdbus_library.found()
json_i3 = dependency('json-c', required: get_option('plugin-i3')) json_i3 = dependency('json-c', required: get_option('plugin-i3'))
plugin_i3_enabled = json_i3.found() plugin_i3_enabled = json_i3.found()
@ -99,7 +100,8 @@ if plugin_mpd_enabled
endif endif
if plugin_mpris_enabled if plugin_mpris_enabled
mod_data += {'mpris': [[], [mpris]]} sdbus = declare_dependency(compile_args: ['-DHAVE_' + sdbus_library.name().to_upper()], dependencies:[sdbus_library])
mod_data += {'mpris': [[], [sdbus]]}
endif endif
if plugin_i3_enabled if plugin_i3_enabled