summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2023-10-13 12:57:57 +0100
committerPhilip Withnall <philip@tecnocode.co.uk>2023-10-23 11:26:53 +0100
commitfe32c3f5c5155eab5cd4838867b0c95beefa2239 (patch)
tree7e97cea71047bad0fa7dccbaea0b8a51fefc9b66 /meson.build
parent6e771f0e8497a39840d63ed59dc19ea5f2f79c00 (diff)
Generate introspection data
Currently, the introspection data for GLib and its sub-libraries is generated by gobject-introspection, to avoid the cyclic dependency between the two projects. Since gobject-introspection is generally available on installed systems, we can check for its presence, and generate the introspection data directly from GLib. This does introduce a cyclic dependency, which is why it's possible to build GLib without introspection, then build gobject-introspection, and finally rebuild GLib. By having introspection data available during the GLib build, we can do things like generating documentation; validating newly added API; and close the loop between adding new API and it becoming available to non-C consumers of the C ABI (i.e. language bindings).
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build15
1 files changed, 15 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index 6084471f8..d788cdfe1 100644
--- a/meson.build
+++ b/meson.build
@@ -2456,8 +2456,22 @@ if want_systemtap and enable_dtrace
enable_systemtap = true
endif
+# introspection
+gir_scanner = find_program('g-ir-scanner', required: get_option('introspection'))
+enable_gir = get_option('introspection').allowed() and gir_scanner.found() and meson.can_run_host_binaries()
+
+if get_option('introspection').enabled() and not meson.can_run_host_binaries()
+ error('Running binaries on the build host needs to be supported to build with -Dintrospection=enabled')
+endif
+
+gir_args = [
+ '--quiet',
+]
+
pkg = import('pkgconfig')
windows = import('windows')
+gnome = import('gnome')
+
subdir('tools')
subdir('glib')
subdir('gobject')
@@ -2579,4 +2593,5 @@ summary({
'glib_checks' : get_option('glib_checks'),
'libelf' : get_option('libelf'),
'multiarch' : get_option('multiarch'),
+ 'introspection' : enable_gir,
}, section: 'Options')