0d2340b322ceb33988fb67b37b1994ee57de2eb3
[platform/upstream/gst-plugins-good.git] / ext / vpx / meson.build
1 vpx_sources = [
2   'gstvp8dec.c',
3   'gstvp8enc.c',
4   'gstvp8utils.c',
5   'gstvp9dec.c',
6   'gstvp9enc.c',
7   'gstvpxdec.c',
8   'gstvpxenc.c',
9   'plugin.c',
10 ]
11
12 vpx_features = [
13   [ 'vpx/vp8cx.h', 'vpx_codec_vp8_cx_algo', '-DHAVE_VP8_ENCODER', 'VP8 encoder' ],
14   [ 'vpx/vp8dx.h', 'vpx_codec_vp8_dx_algo', '-DHAVE_VP8_DECODER', 'VP8 decoder' ],
15   [ 'vpx/vp8cx.h', 'vpx_codec_vp9_cx_algo', '-DHAVE_VP9_ENCODER', 'VP9 encoder' ],
16   [ 'vpx/vp8dx.h', 'vpx_codec_vp9_dx_algo', '-DHAVE_VP9_DECODER', 'VP9 decoder' ],
17 ]
18
19 vpx_dep = dependency('vpx', version : '>=1.3.0', required : get_option('vpx'))
20
21 if vpx_dep.found()
22   vpx_args = []
23   foreach f : vpx_features
24     header = f.get(0)
25     codec_iface = f.get(1)
26     extra_define = f.get(2)
27     link_code = '''#include <@0@>
28                    int main (int a, char ** g) {
29                      const vpx_codec_iface_t *c = &@1@;
30                      return c != 0;
31                    }'''.format(header,codec_iface)
32     if cc.links(link_code, dependencies : vpx_dep)
33       vpx_args += extra_define
34       message('libvpx provides @0@ interface (@1@)'.format(f.get(3),f.get(1)))
35       have_vpx_feature = true
36     else
37       message('libvpx does not provide @0@ interface (@1@)'.format(f.get(3),f.get(1)))
38       have_vpx_feature = false
39     endif
40     set_variable('have_' + f.get(3).to_lower().underscorify(), have_vpx_feature)
41   endforeach
42
43   if vpx_args.length() == 0
44     message('WARNING: libvpx was built without any encoder or decoder features!')
45   endif
46
47   if dependency('vpx', version : '>=1.4.0', required : false).found()
48     vpx_args += '-DHAVE_VPX_1_4'
49   endif
50
51   if dependency('vpx', version : '>=1.8.0', required : false).found()
52     vpx_args += '-DHAVE_VPX_1_8'
53   endif
54
55   gstvpx = library('gstvpx',
56     vpx_sources,
57     c_args : gst_plugins_good_args + vpx_args,
58     include_directories : [configinc],
59     dependencies : [gstbase_dep, gsttag_dep, gstvideo_dep, vpx_dep],
60     install : true,
61     install_dir : plugins_install_dir,
62   )
63   pkgconfig.generate(gstvpx, install_dir : plugins_pkgconfig_install_dir)
64
65   install_data(sources: ['GstVP8Enc.prs'], install_dir: presetdir)
66 endif