[gnome-contacts] Meson: allow 'auto' value for `with-cheese`.



commit eb627bf5a92aa8491ac6d9f99049b2215c0ffbb5
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Mon Sep 11 20:49:34 2017 +0200

    Meson: allow 'auto' value for `with-cheese`.
    
    This brings the options up par with the autotools build.

 man/meson.build   |    2 +-
 meson.build       |   15 ++++++++++-----
 meson_options.txt |    2 +-
 src/meson.build   |    2 +-
 4 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/man/meson.build b/man/meson.build
index 2912cca..ec4c022 100644
--- a/man/meson.build
+++ b/man/meson.build
@@ -1,4 +1,4 @@
-if get_option('with-manpage')
+if manpage_enabled
   xsltproc = find_program('xsltproc')
   custom_target('manfile-gnome-contacts',
     input: 'gnome-contacts.xml',
diff --git a/meson.build b/meson.build
index 3e87eef..d996aaa 100644
--- a/meson.build
+++ b/meson.build
@@ -43,14 +43,19 @@ libedataserver = dependency('libedataserver-1.2', version: '>=' + min_eds_versio
 libedataserverui = dependency('libedataserverui-1.2', version: '>=' + min_eds_version)
 telepathy_glib = dependency('telepathy-glib', version: '>= 0.22.0')
 
-if get_option('with-cheese')
-  cheese = dependency('cheese')
-  cheese_gtk = dependency('cheese-gtk', version: '>= 3.3.91')
-endif
-
 # Libraries
 math = meson.get_compiler('c').find_library('m')
 
+# Options
+cheese_enabled = (get_option('with-cheese') != 'no')
+if cheese_enabled
+  cheese = dependency('cheese', required: cheese_enabled)
+  cheese_gtk = dependency('cheese-gtk', version: '>= 3.3.91', required: cheese_enabled)
+  cheese_enabled = cheese.found() and cheese_gtk.found()
+endif
+
+manpage_enabled = get_option('with-manpage')
+
 # Configuration
 conf = configuration_data()
 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
diff --git a/meson_options.txt b/meson_options.txt
index d8d3bf2..040299d 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,2 +1,2 @@
-option('with-cheese', type: 'boolean', value: true, description: 'enable cheese webcam support')
+option('with-cheese', type: 'combo', choices: ['yes', 'no', 'auto'], value: 'auto', description: 'enable 
cheese webcam support')
 option('with-manpage', type: 'boolean', value: true, description: 'enable building man pages')
diff --git a/src/meson.build b/src/meson.build
index e7f9c77..0bb6638 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -72,7 +72,7 @@ contacts_deps = [
 ]
 
 # Add extra stuff if cheese is enabled
-if get_option('with-cheese')
+if cheese_enabled
   contacts_deps += [ cheese, cheese_gtk ]
   contacts_vala_args += [ '-D', 'HAVE_CHEESE' ]
   contacts_c_sources += 'cheese-flash.c'


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