I found a solution that is not pretty but not that ugly either: I use a
custom_target() with a depends list including the dynamically loaded
modules to generate an empty source file that then I add to the
gnome.generate_gir() sources list.
It looks something like this (simplified and abbreviated):
libtracker_sparql_modules = []
libtracker_remote_soup3 = shared_module('tracker-remote-soup3', ...)
libtracker_sparql_modules += libtracker_remote_soup3
# This custom target has the only purpose to inject a dependency from
# the libtracker_sparql_modules into the tarcker_sparql_gir target to
# force meson to build the loadable shared modules before attempting
# to run g-ir-scanner.
libtracker_sparql_modules_stamp = custom_target(
'libtracker-sparql-modules-stamp',
output: 'tracker-sparql-modules-stamp.c',
command: ['touch', '@OUTPUT@'],
depends: libtracker_sparql_modules,
)
tracker_sparql_gir = gnome.generate_gir(libtracker_sparql,
sources: [libtracker_sparql_modules_stamp, ...],
...
)
It seems a pattern that can be reused.
Cheers,
Dan