[babl] build: add dependency checks for gir/vala



commit 47a62dceed2efbf5a4bc4f3fd3cf7e286b182cfd
Author: John Marshall <jtm home gmail com>
Date:   Thu Jun 25 07:07:48 2020 +0100

    build: add dependency checks for gir/vala

 babl/meson.build |  2 +-
 meson.build      | 42 ++++++++++++++++++++++++++++++------------
 2 files changed, 31 insertions(+), 13 deletions(-)
---
diff --git a/babl/meson.build b/babl/meson.build
index 146790128..fed8fe91b 100644
--- a/babl/meson.build
+++ b/babl/meson.build
@@ -168,7 +168,7 @@ if build_gir
     install: true,
   )
 
-  if get_option('enable-vapi')
+  if build_vapi
     gnome.generate_vapi(lib_name,
       sources: babl_gir[0],
       install: true,
diff --git a/meson.build b/meson.build
index c53bd4d92..cc2b21638 100644
--- a/meson.build
+++ b/meson.build
@@ -319,17 +319,6 @@ endif
 ################################################################################
 # Dependencies
 
-# LCMS
-if get_option('with-lcms')
-  lcms = dependency('lcms2', required: true, native: false)
-  if lcms.found()
-    conf.set('HAVE_LCMS', 1, description:
-      'Define to 1 if liblcms2 is available')
-  endif
-else
-  lcms = declare_dependency()
-endif
-
 math = cc.find_library('m',   required: false)
 thread = dependency('threads',  required: false)
 if platform_android
@@ -344,6 +333,25 @@ else
 endif
 
 
+# gobject introspection
+g_ir = dependency('gobject-introspection-1.0', version: '>=1.32.0',
+  required: false)
+
+# lcms
+if get_option('with-lcms')
+  lcms = dependency('lcms2', version: '>=2.8', required: true)
+  if lcms.found()
+    conf.set('HAVE_LCMS', 1, description:
+      'Define to 1 if liblcms2 is available')
+  endif
+else
+  lcms = declare_dependency()
+endif
+
+# vapigen
+vapigen   = dependency('vapigen', version:'>=0.20.0', required: false)
+
+
 ################################################################################
 # Build utilities
 
@@ -383,6 +391,16 @@ if get_option('enable-gir') == 'auto'
 else
   build_gir = get_option('enable-gir') == 'true' ? true : false
 endif
+if not g_ir.found()
+  build_gir = false
+endif
+
+# Vapi - only build if building introspection
+if build_gir and get_option('enable-vapi') and vapigen.found()
+  build_vapi = true
+else
+  build_vapi = false
+endif
 
 ################################################################################
 # Configuration files
@@ -450,7 +468,7 @@ summary(
   {
     'BABL docs'      : build_docs,
     'Introspection'  : build_gir,
-    'VALA support'   : build_gir and get_option('enable-vapi'),
+    'VALA support'   : build_vapi,
   }, section: 'Optional features'
 )
 summary(


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