[gtk-vnc] build: change with-vala and introspection options into features



commit 80b73802cf966f7604200a1901ca33be3e9dbd11
Author: Daniel P. Berrangé <dan berrange com>
Date:   Fri Jan 8 15:13:13 2021 +0000

    build: change with-vala and introspection options into features
    
    Using "feature" type lets us automatically disable them when appropriate
    
    Signed-off-by: Daniel P. Berrangé <berrange redhat com>

 meson.build       | 18 ++++++++++++++----
 meson_options.txt |  4 ++--
 2 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/meson.build b/meson.build
index aa0d92e..887d890 100644
--- a/meson.build
+++ b/meson.build
@@ -300,10 +300,20 @@ configure_file(
 top_incdir = include_directories('.')
 src_incdir = include_directories('src')
 
-with_gir = get_option('introspection')
-with_vala = get_option('with-vala')
-if with_vala and not with_gir
-  error('Vala API requires GObject introspection (-Dintrospection=true)')
+gir = find_program('g-ir-scanner', required: get_option('introspection'))
+with_gir = gir.found()
+
+vala_opt = get_option('with-vala')
+if not vala_opt.disabled()
+  if not with_gir
+    if vala_opt.enabled()
+      error('Vala API requires GObject introspection (-Dintrospection=true)')
+    else
+      with_vala = false
+    endif
+  else
+    with_vala = add_languages('vala', required: vala_opt)
+  endif
 endif
 
 subdir('src')
diff --git a/meson_options.txt b/meson_options.txt
index f180eab..6dd4c45 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,6 +1,6 @@
-option('introspection', type: 'boolean', value: true, description: 'Enable introspection for this build')
+option('introspection', type: 'feature', value: 'auto', description: 'Enable introspection for this build')
 option('pulseaudio', type: 'feature', value: 'auto', description: 'Build the pulseaudio bridge for VNC 
client connections')
 option('sasl', type: 'feature', value: 'auto', description: 'Build with SASL support')
 option('with-coroutine', type: 'string', value: 'auto', description: 'Build with coroutine backend: [auto, 
ucontext, gthread]')
 option('with-tls-priority', type: 'string', value: 'NORMAL', description: 'Set default TLS priority string')
-option('with-vala', type: 'boolean', value: true, description: 'Enable Vala bindings')
+option('with-vala', type: 'feature', value: 'auto', description: 'Enable Vala bindings')


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