build: add dependency checks for gir/vala
authorJohn Marshall <jtm.home@gmail.com>
Thu, 25 Jun 2020 06:07:48 +0000 (07:07 +0100)
committerJohn Marshall <jtm.home@gmail.com>
Thu, 25 Jun 2020 07:07:34 +0000 (08:07 +0100)
babl/meson.build
meson.build

index 1467901285a148cc3808de5e7993cb0f6e5f9590..fed8fe91b984a383f0ed46867903c28f46e81bc0 100644 (file)
@@ -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,
index c53bd4d924e9a848f9bdb543eafe6ea64060c777..cc2b216389e9377840a233fd557ef12c5fe2d372 100644 (file)
@@ -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(