| 1 |
project('gobject-introspection', 'c', meson_version: '>= 1.9.0') |
| 2 |
|
| 3 |
copyfile = find_program('copyfile.py') |
| 4 |
copyfile_gen = generator(copyfile, |
| 5 |
output: '@[email protected]', |
| 6 |
arguments : ['@INPUT@', '@OUTPUT@']) |
| 7 |
|
| 8 |
glib = dependency('glib-2.0', required: false) |
| 9 |
if not glib.found() |
| 10 |
error('MESON_SKIP_TEST glib not found.') |
| 11 |
endif |
| 12 |
|
| 13 |
gir = dependency('gobject-introspection-1.0', required: false) |
| 14 |
if not gir.found() |
| 15 |
error('MESON_SKIP_TEST gobject-introspection not found.') |
| 16 |
endif |
| 17 |
|
| 18 |
python3 = import('python') |
| 19 |
py3 = python3.find_installation() |
| 20 |
if run_command(py3, '-c', 'import gi;', check: false).returncode() != 0 |
| 21 |
error('MESON_SKIP_TEST python3-gi not found') |
| 22 |
endif |
| 23 |
|
| 24 |
cc = meson.get_compiler('c') |
| 25 |
|
| 26 |
add_global_arguments('-DMESON_TEST_1', language : 'c') |
| 27 |
if cc.get_id() == 'intel' |
| 28 |
# Ignore invalid GCC pragma warnings from glib |
| 29 |
# https://bugzilla.gnome.org/show_bug.cgi?id=776562 |
| 30 |
add_global_arguments('-wd2282', language : 'c') |
| 31 |
endif |
| 32 |
|
| 33 |
pycode = '''import os, sys |
| 34 |
if "MESON_UNIT_TEST_PRETEND_GLIB_OLD" in os.environ: |
| 35 |
sys.exit(0) |
| 36 |
sys.exit(1) |
| 37 |
''' |
| 38 |
|
| 39 |
pretend_glib_old = false |
| 40 |
res = run_command(py3, '-c', pycode, check: false) |
| 41 |
if res.returncode() == 0 |
| 42 |
pretend_glib_old = true |
| 43 |
endif |
| 44 |
|
| 45 |
gnome = import('gnome') |
| 46 |
gio = dependency('gio-2.0') |
| 47 |
giounix = dependency('gio-unix-2.0') |
| 48 |
glib = dependency('glib-2.0') |
| 49 |
gobj = dependency('gobject-2.0') |
| 50 |
gir = dependency('gobject-introspection-1.0') |
| 51 |
gmod = dependency('gmodule-2.0') |
| 52 |
|
| 53 |
# GLib >= 2.76 removed slice allocator which causes a leak in g-i to now be |
| 54 |
# visible to asan. The leak should be fixed in g-i >= 1.76.2: |
| 55 |
# https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/411 |
| 56 |
if get_option('b_sanitize') != 'none' and \ |
| 57 |
gir.version().version_compare('<=1.76.1') and \ |
| 58 |
glib.version().version_compare('>=2.76') |
| 59 |
error('MESON_SKIP_TEST gobject-introspection >=1.76.2 is required with address sanitizer.') |
| 60 |
endif |
| 61 |
|
| 62 |
# Test that static deps don't error out when static libraries aren't found |
| 63 |
glib_static = dependency('glib-2.0', static : true) |
| 64 |
|
| 65 |
subdir('resources-data') |
| 66 |
subdir('resources') |
| 67 |
subdir('gir') |
| 68 |
subdir('schemas') |
| 69 |
subdir('gdbus') |
| 70 |
subdir('mkenums') |
| 71 |
subdir('genmarshal') |