vpx: Error out if enabled and no features found
[platform/upstream/gst-plugins-good.git] / ext / vpx / meson.build
index 685aeb7..27acdf4 100644 (file)
@@ -16,7 +16,8 @@ vpx_features = [
   [ 'vpx/vp8dx.h', 'vpx_codec_vp9_dx_algo', '-DHAVE_VP9_DECODER', 'VP9 decoder' ],
 ]
 
-vpx_dep = dependency('vpx', version : '>=1.3.0', required : false)
+vpx_option = get_option('vpx')
+vpx_dep = dependency('vpx', version : '>=1.3.0', required : vpx_option)
 
 if vpx_dep.found()
   vpx_args = []
@@ -29,8 +30,7 @@ if vpx_dep.found()
                      const vpx_codec_iface_t *c = &@1@;
                      return c != 0;
                    }'''.format(header,codec_iface)
-    # FIXME: should take dependencies : vpx_dep argument
-    if cc.links(link_code, args : ['-lvpx'])
+    if cc.links(link_code, dependencies : vpx_dep)
       vpx_args += extra_define
       message('libvpx provides @0@ interface (@1@)'.format(f.get(3),f.get(1)))
       have_vpx_feature = true
@@ -42,13 +42,23 @@ if vpx_dep.found()
   endforeach
 
   if vpx_args.length() == 0
-    message('WARNING: libvpx was built without any encoder or decoder features!')
+    msg = 'libvpx was built without any encoder or decoder features!'
+    # Error out if explicitly enabled, but continue with a warning if the
+    # plugin is in auto-detect mode to reduce build-time friction.
+    if vpx_option.enabled()
+      error(msg)
+    endif
+    warning(msg)
   endif
 
   if dependency('vpx', version : '>=1.4.0', required : false).found()
     vpx_args += '-DHAVE_VPX_1_4'
   endif
 
+  if dependency('vpx', version : '>=1.8.0', required : false).found()
+    vpx_args += '-DHAVE_VPX_1_8'
+  endif
+
   gstvpx = library('gstvpx',
     vpx_sources,
     c_args : gst_plugins_good_args + vpx_args,
@@ -57,6 +67,7 @@ if vpx_dep.found()
     install : true,
     install_dir : plugins_install_dir,
   )
+  pkgconfig.generate(gstvpx, install_dir : plugins_pkgconfig_install_dir)
 
   install_data(sources: ['GstVP8Enc.prs'], install_dir: presetdir)
 endif