[libsoup/wip/meson: 91/93] Check for presence of g-ir-scanner and vala if they're enabled



commit 05d543fe0ca867faf79cb8819481abdc7bc72105
Author: Tomas Popela <tpopela redhat com>
Date:   Thu Feb 15 15:00:58 2018 +0100

    Check for presence of g-ir-scanner and vala if they're enabled
    
    Took inspiration from libgit2-glib project.

 libsoup/meson.build |    4 ++--
 meson.build         |   17 +++++++++++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/libsoup/meson.build b/libsoup/meson.build
index f23d338..279fead 100644
--- a/libsoup/meson.build
+++ b/libsoup/meson.build
@@ -251,7 +251,7 @@ if enable_gnome
     variables: 'exec_prefix=${prefix}')
 endif
 
-if get_option('introspection') or get_option('vapi')
+if enable_introspection or enable_vapi
   gir_args = libsoup_c_args + ['-DLIBSOUP_USE_UNSTABLE_REQUEST_API']
 
   soup_ns = 'Soup'
@@ -274,7 +274,7 @@ if get_option('introspection') or get_option('vapi')
     dependencies : deps,
     sources : soup_gir_gen_sources)
 
-  if get_option('vapi')
+  if enable_vapi
     gnome.generate_vapi(libsoup_api_name,
       sources : soup_gir_gen_sources[0],
       packages : 'gio-2.0',
diff --git a/meson.build b/meson.build
index 0f3a22e..687e727 100644
--- a/meson.build
+++ b/meson.build
@@ -213,6 +213,23 @@ if host_machine.system() == 'windows'
   enable_gnome = false
 endif
 
+#########################
+# GObject introspection #
+#########################
+enable_introspection = get_option('introspection')
+if enable_introspection
+  enable_introspection = find_program('g-ir-scanner', required: false).found() and not meson.is_cross_build()
+endif
+
+############
+# Vala API #
+############
+enable_vapi = get_option('vapi')
+if enable_vapi
+  assert(enable_gir, 'vapi support was requested, but introspection support is mandatory.')
+  assert(add_languages('vala', required: false), 'vapi support was requested, but vala not found.')
+endif
+
 configinc = include_directories('.')
 
 prefix = get_option('prefix')


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