[gegl] build: improve gir build - change build option to auto/true/false combo behaves like feature



commit 630becf2efe60d641eafbb53172072f756bd3512
Author: John Marshall <jtm home gmail com>
Date:   Sun Jul 12 07:07:15 2020 +0100

    build: improve gir build
    - change build option to auto/true/false combo behaves like feature

 gegl/meson.build         | 12 +++++-------
 meson.build              | 36 ++++++++++++++++++++++--------------
 meson_options.txt        | 27 +++++++++++++++++++++++----
 tests/python/meson.build |  2 +-
 4 files changed, 51 insertions(+), 26 deletions(-)
---
diff --git a/gegl/meson.build b/gegl/meson.build
index 42d29d65c..9d8f26e5a 100644
--- a/gegl/meson.build
+++ b/gegl/meson.build
@@ -106,13 +106,11 @@ gegl_lib = library(api_name,
 )
 
 
-introspection_sources = gegl_introspectable_headers + files(
-  'gegl-introspection-support.h',
-  'opencl' / 'gegl-cl-introspection-support.h',
-)
-
-
-if get_option('introspection')
+if g_ir.found()
+  introspection_sources = gegl_introspectable_headers + files(
+    'gegl-introspection-support.h',
+    'opencl' / 'gegl-cl-introspection-support.h',
+  )
 
   gegl_gir = gnome.generate_gir(gegl_lib,
     sources: introspection_sources,
diff --git a/meson.build b/meson.build
index 72c06b545..bfa1c6562 100644
--- a/meson.build
+++ b/meson.build
@@ -183,6 +183,14 @@ libnsgif = dependency('libnsgif',
 ################################################################################
 # Optionnal Dependencies
 
+# gobject introspection
+if get_option('introspection') != 'false'
+  g_ir = dependency('gobject-introspection-1.0', version: '>=1.32.0',
+    required: get_option('introspection') == 'true' ? true : false,
+  )
+else
+  g_ir = disabler()
+endif
 gdk_pixbuf= dependency('gdk-pixbuf-2.0', version:'>=2.32.0',
   required: get_option('gdk-pixbuf')
 )
@@ -257,26 +265,26 @@ sdl1      = dependency('sdl',         version: '>=1.2.0',
 sdl2      = dependency('sdl2',        version: '>=2.0.5',
   required: get_option('sdl2')
 )
-
-vapigen   = dependency('vapigen',     version:'>=0.20.0',
-  required: get_option('vapigen')
-)
+if g_ir.found()
+  vapigen = dependency('vapigen',     version:'>=0.20.0',
+    required: get_option('vapigen')
+  )
+else
+  vapigen = disabler()
+endif
 libwebp   = dependency('libwebp',     version:'>=0.5.0',
   required: get_option('webp')
 )
-
 poppler = dependency('poppler-glib', version: '>=0.71.0',
   required: get_option('poppler')
 )
-
-pygobject3  = dependency('pygobject-3.0', version: '>=3.2.0',
-  required: get_option('pygobject')
-)
-gobj_introsp = dependency('gobject-introspection-1.0', version: '>=1.32.0',
-  required: get_option('pygobject')
-)
-pygobject_found = pygobject3.found() and gobj_introsp.found()
-
+if g_ir.found()
+  pygobject3 = dependency('pygobject-3.0', version: '>=3.2.0',
+    required: get_option('pygobject')
+  )
+else
+  pygobject3 = disabler()
+endif
 libavcodec  = dependency('libavcodec',   version: '>=55.69.100',
   required: get_option('libav')
 )
diff --git a/meson_options.txt b/meson_options.txt
index dd93235ce..0b25c1fd9 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,7 +1,27 @@
-option('docs',          type: 'boolean', value: 'false')
-option('workshop',      type: 'boolean', value: 'false')
-option('introspection', type: 'boolean', value: 'true')
+# Optional features
+option('docs',
+  type: 'boolean',
+  value: 'false',
+  description: 'build documentation'
+)
+option('workshop',
+  type: 'boolean',
+  value: 'false',
+  description: 'build experimental operations'
+)
+option('introspection',
+  type: 'combo',
+  choices: ['auto', 'true', 'false'],
+  value: 'auto',
+  description: 'gobject introspection .gir generation'
+)
+option('vapigen',
+  type: 'feature',
+  value: 'auto',
+  description: 'Vala .vapi generation - depends on introspection'
+)
 
+# optional dependencies
 option('exiv2',         type: 'feature', value: 'auto')
 option('gdk-pixbuf',    type: 'feature', value: 'auto')
 option('gexiv2',        type: 'feature', value: 'auto')
@@ -30,5 +50,4 @@ option('pygobject',     type: 'feature', value: 'auto')
 option('sdl1',          type: 'feature', value: 'disabled')
 option('sdl2',          type: 'feature', value: 'auto')
 option('umfpack',       type: 'feature', value: 'auto')
-option('vapigen',       type: 'feature', value: 'auto')
 option('webp',          type: 'feature', value: 'auto')
diff --git a/tests/python/meson.build b/tests/python/meson.build
index 1bb69ead3..736183c6a 100644
--- a/tests/python/meson.build
+++ b/tests/python/meson.build
@@ -14,7 +14,7 @@ gi_typelib_path = run_command(python, '-c',
   '''import os; print(os.environ['GI_TYPELIB_PATH'])'''
 ).stdout().strip()
 
-if python.found() and pygobject_found
+if python.found() and pygobject3.found()
   foreach testname : testnames
     testfile = 'test-' + testname + '.py'
     test(testname,


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