| 1 |
project('gir link order', 'c') |
| 2 |
|
| 3 |
if not dependency('glib-2.0', required : false).found() or not find_program('g-ir-scanner', required: false).found() |
| 4 |
error('MESON_SKIP_TEST glib not found.') |
| 5 |
endif |
| 6 |
|
| 7 |
gnome = import('gnome') |
| 8 |
glib = dependency('glib-2.0') |
| 9 |
gobject = dependency('gobject-2.0') |
| 10 |
|
| 11 |
# get-prgname is a shared library which uses a function from glib-2.0. It is |
| 12 |
# used to introduce external -L flags which may cause -L order problems. |
| 13 |
subdir('get-prgname') |
| 14 |
|
| 15 |
# fake-gthread is a shared library which has the same name as gthread-2.0 from |
| 16 |
# GLib. This is used to simulate the case where an older or unrelated version |
| 17 |
# of a library is already installed on the system. Our meson sample library |
| 18 |
# defined below uses a function from fake-gthread. If meson messes up -L order, |
| 19 |
# the linker will find libgthread-2.0.so installed on the system and fail to |
| 20 |
# find the symbol our meson sample library uses. |
| 21 |
subdir('fake-gthread') |
| 22 |
|
| 23 |
meson_sample_sources = ['meson-sample.c', 'meson-sample.h'] |
| 24 |
meson_sample_lib = shared_library( |
| 25 |
'sample', |
| 26 |
sources : meson_sample_sources, |
| 27 |
dependencies : [gobject, get_prgname, fake_gthread], |
| 28 |
install : false, |
| 29 |
) |
| 30 |
|
| 31 |
gnome.generate_gir( |
| 32 |
meson_sample_lib, |
| 33 |
sources : meson_sample_sources, |
| 34 |
nsversion : '1.0', |
| 35 |
namespace : 'Meson', |
| 36 |
symbol_prefix : 'meson', |
| 37 |
identifier_prefix : 'Meson', |
| 38 |
includes : ['GObject-2.0'], |
| 39 |
install : false, |
| 40 |
build_by_default: true, |
| 41 |
) |