[gssdp/wip/meson: 11/17] meson: Make introspection and vapi optional



commit bce6b300a9a5672ec105e11dc44cfd148d27927c
Author: Jens Georg <mail jensge org>
Date:   Fri Oct 26 16:43:45 2018 +0200

    meson: Make introspection and vapi optional

 libgssdp/meson.build | 21 +++++++++++----------
 meson.build          | 11 ++++++++++-
 meson_options.txt    |  3 ++-
 3 files changed, 23 insertions(+), 12 deletions(-)
---
diff --git a/libgssdp/meson.build b/libgssdp/meson.build
index 599ccb3..fd085fb 100644
--- a/libgssdp/meson.build
+++ b/libgssdp/meson.build
@@ -65,13 +65,14 @@ pkg.generate(libraries: [ libgssdp ],
              description: 'GObject-based SSDP library',
              requires_private: ['gobject-2.0', 'gio-2.0'])
 
-gir = gnome.generate_gir(libgssdp,
-                   sources : introspection_sources,
-                   namespace : 'GSSDP',
-                   nsversion : '1.2',
-                   symbol_prefix : 'gssdp',
-                   identifier_prefix : 'GSSDP',
-                   export_packages : 'gssdp-1.2',
-                   includes : ['GObject-2.0', 'Gio-2.0', 'Soup-2.4'],
-                   install: true
-                   )
+if introspection_available
+    gir = gnome.generate_gir(libgssdp,
+            sources : introspection_sources,
+            namespace : 'GSSDP',
+            nsversion : '1.2',
+            symbol_prefix : 'gssdp',
+            identifier_prefix : 'GSSDP',
+            export_packages : 'gssdp-1.2',
+            includes : ['GObject-2.0', 'Gio-2.0', 'Soup-2.4'],
+            install: true)
+endif
diff --git a/meson.build b/meson.build
index 5a286e0..b8112ad 100644
--- a/meson.build
+++ b/meson.build
@@ -85,12 +85,21 @@ if not get_option('without-gtk')
   gtk = dependency('gtk+-3.0', version : '>= 3.12', required: false)
 endif
 
+gir = find_program('g-ir-scanner', required: false)
+vapigen = find_program('vapigen', required: false)
+
+introspection_available = gir.found() and not get_option('disable-introspection')
+vapi_available = introspection_available and vapigen.found() and not get_option('disable-vala')
+
 subdir('libgssdp')
 subdir('tests')
 if not get_option('without-gtk') and gtk.found()
   subdir('tools')
 endif
-subdir('vala')
+
+if vapi_available
+  subdir('vala')
+endif
 
 if get_option('enable-gtk-doc')
   subdir('doc')
diff --git a/meson_options.txt b/meson_options.txt
index 4fe3945..2dc4b33 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,3 +1,4 @@
 option('enable-gtk-doc', type: 'boolean', value: false, description: 'Enable generating the API reference 
(depends on GTK-Doc)')
 option('without-gtk', type: 'boolean', value: false, description: 'Compile without GTK+ support')
-option('enable-introspection', type: 'boolean', value : true, description: 'Enable GObject Introspection')
+option('disable-introspection', type: 'boolean', value : false, description: 'Disable GObject Introspection')
+option('disable-vala', type: 'boolean', value: false, description: 'Disable generation of vala vapi file')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]