| 1 |
project('gir both libraries', 'c') |
| 2 |
|
| 3 |
gir = dependency('gobject-introspection-1.0', required: false) |
| 4 |
if not gir.found() |
| 5 |
error('MESON_SKIP_TEST gobject-introspection not found.') |
| 6 |
endif |
| 7 |
|
| 8 |
if host_machine.system() == 'cygwin' |
| 9 |
# FIXME: g-ir-scanner seems broken on cygwin: |
| 10 |
# ERROR: can't resolve libraries to shared libraries: foo++ |
| 11 |
error('MESON_SKIP_TEST g-ir-scanner is broken on cygwin.') |
| 12 |
endif |
| 13 |
|
| 14 |
gnome = import('gnome') |
| 15 |
|
| 16 |
# Regression test simulating how GStreamer generate its GIRs. |
| 17 |
# Generated gobject-introspection binaries for every GStreamer libraries must |
| 18 |
# first call gst_init() defined in the main libgstreamer, which means they need |
| 19 |
# to link on that lib. |
| 20 |
# A regression caused by https://github.com/mesonbuild/meson/pull/12632 made |
| 21 |
# Meson not link the binary generated for bar with libfoo in the case it uses |
| 22 |
# both_libraries(). |
| 23 |
|
| 24 |
libfoo = both_libraries('foo', 'foo.c') |
| 25 |
foo_gir = gnome.generate_gir(libfoo, |
| 26 |
namespace: 'foo', |
| 27 |
nsversion: '1.0', |
| 28 |
sources: ['foo.c', 'foo.h'], |
| 29 |
) |
| 30 |
foo_dep = declare_dependency( |
| 31 |
link_with: libfoo, |
| 32 |
sources: foo_gir, |
| 33 |
) |
| 34 |
|
| 35 |
libbar = both_libraries('bar', 'bar.c', dependencies: foo_dep) |
| 36 |
gnome.generate_gir(libbar, |
| 37 |
namespace: 'bar', |
| 38 |
nsversion: '1.0', |
| 39 |
sources: ['bar.c', 'bar.h'], |
| 40 |
extra_args: '--add-init-section=extern void foo_func(void);foo_func();', |
| 41 |
dependencies: foo_dep, |
| 42 |
) |