| 1 |
project('gir link order 2', 'c') |
| 2 |
|
| 3 |
if not dependency('gobject-2.0', required : false).found() or not find_program('g-ir-scanner', required: false).found() |
| 4 |
error('MESON_SKIP_TEST gobject not found.') |
| 5 |
endif |
| 6 |
|
| 7 |
gnome = import('gnome') |
| 8 |
gobject = dependency('gobject-2.0') |
| 9 |
|
| 10 |
# This builds a dummy libsample under samelibname that's not really used |
| 11 |
subdir('samelibname') |
| 12 |
|
| 13 |
# This builds the real libsample |
| 14 |
meson_sample_sources = ['meson-sample.c', 'meson-sample.h'] |
| 15 |
meson_sample_lib = shared_library( |
| 16 |
'sample', |
| 17 |
sources : meson_sample_sources, |
| 18 |
dependencies : [gobject], |
| 19 |
link_with: [samelibname], |
| 20 |
install : false, |
| 21 |
) |
| 22 |
|
| 23 |
# g-ir-scanner should get the linker paths in the right order so it links first |
| 24 |
# against the target libsample and not the dummy one that's just a dependency |
| 25 |
# https://github.com/mesonbuild/meson/pull/5423 |
| 26 |
gnome.generate_gir( |
| 27 |
meson_sample_lib, |
| 28 |
sources : meson_sample_sources, |
| 29 |
nsversion : '1.0', |
| 30 |
namespace : 'Meson', |
| 31 |
symbol_prefix : 'meson', |
| 32 |
identifier_prefix : 'Meson', |
| 33 |
install : false, |
| 34 |
build_by_default: true, |
| 35 |
) |