tests: Enable hls m3u8 unit test with meson build
[platform/upstream/gstreamer.git] / ext / hls / meson.build
1 hls_sources = [
2   'gsthlsdemux.c',
3   'gsthlsdemux-util.c',
4   'gsthlsplugin.c',
5   'gsthlssink.c',
6   'gsthlssink2.c',
7   'gstm3u8playlist.c',
8   'm3u8.c',
9 ]
10
11 hls_cargs = ['-DGST_USE_UNSTABLE_API']
12
13 hls_crypto = get_option('hls-crypto')
14 hls_option = get_option('hls')
15 # used for unit test
16 hls_dep = dependency('', required : false)
17
18 have_hls_crypto = false
19 if not hls_option.disabled()
20   if ['auto', 'nettle'].contains(hls_crypto)
21     hls_crypto_dep = dependency('nettle', required : false)
22     if hls_crypto_dep.found()
23       have_hls_crypto = true
24       hls_cargs += ['-DHAVE_NETTLE']
25     endif
26   endif
27
28   if not have_hls_crypto and ['auto', 'libgcrypt'].contains(hls_crypto)
29     hls_crypto_dep = cc.find_library('gcrypt', required : false)
30     if hls_crypto_dep.found()
31       have_hls_crypto = true
32       hls_cargs += ['-DHAVE_LIBGCRYPT']
33     endif
34   endif
35
36   if not have_hls_crypto and ['auto', 'openssl'].contains(hls_crypto)
37     hls_crypto_dep = dependency('openssl', required : false)
38     if hls_crypto_dep.found()
39       have_hls_crypto = true
40       hls_cargs += ['-DHAVE_OPENSSL']
41     endif
42   endif
43
44   if not have_hls_crypto and hls_option.enabled()
45     if hls_crypto == 'auto'
46       error('HLS plugin enabled, but found none of nettle, libgcrypt, or openssl')
47     else
48       error('HLS plugin enabled, but crypto library "@0@" not found'.format(hls_crypto))
49     endif
50   endif
51 endif
52
53 if have_hls_crypto
54   gsthls = library('gsthls',
55     hls_sources,
56     c_args : gst_plugins_bad_args + hls_cargs,
57     link_args : noseh_link_args,
58     include_directories : [configinc],
59     dependencies : [gstpbutils_dep, gsttag_dep, gstvideo_dep,
60                     gstadaptivedemux_dep, gsturidownloader_dep,
61                     hls_crypto_dep, libm],
62     install : true,
63     install_dir : plugins_install_dir,
64   )
65   pkgconfig.generate(gsthls, install_dir : plugins_pkgconfig_install_dir)
66   plugins += [gsthls]
67   hls_dep = declare_dependency(include_directories : include_directories('.'))
68 endif