qsv: Enable MinGW toolchain support
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-bad / sys / qsv / meson.build
1 qsv_sources = [
2   'gstqsvallocator.cpp',
3   'gstqsvav1enc.cpp',
4   'gstqsvdecoder.cpp',
5   'gstqsvencoder.cpp',
6   'gstqsvh264dec.cpp',
7   'gstqsvh264enc.cpp',
8   'gstqsvh265dec.cpp',
9   'gstqsvh265enc.cpp',
10   'gstqsvjpegenc.cpp',
11   'gstqsvutils.cpp',
12   'gstqsvvp9enc.cpp',
13   'plugin.cpp',
14 ]
15
16 qsv_d3d11_sources = [
17   'gstqsvallocator_d3d11.cpp',
18 ]
19
20 qsv_va_sources = [
21   'gstqsvallocator_va.cpp',
22 ]
23
24 extra_args = [
25   '-DGST_USE_UNSTABLE_API',
26 ]
27
28 qsv_option = get_option('qsv')
29 if qsv_option.disabled()
30   subdir_done()
31 endif
32
33 qsv_platform_deps = []
34 if host_system == 'windows'
35   if not gstd3d11_dep.found()
36     if qsv_option.enabled()
37       error('The qsv was enabled explicitly, but required d3d11 was not found')
38     else
39       subdir_done()
40     endif
41   endif
42
43   code = '''
44   #include <windows.h>
45   #if !(WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
46   #error "Not building for UWP"
47   #endif'''
48   if cc.compiles(code, name : 'building for UWP')
49     if qsv_option.enabled()
50       error('qsv plugin does not support UWP')
51     else
52       subdir_done()
53     endif
54   endif
55
56   qsv_sources += qsv_d3d11_sources
57   qsv_platform_deps += [gstd3d11_dep]
58 elif host_system == 'linux' and host_machine.cpu_family() == 'x86_64'
59   if not gstva_dep.found()
60     if qsv_option.enabled()
61       error('The qsv was enabled explicitly, but required va was not found')
62     else
63       subdir_done()
64     endif
65   endif
66   qsv_sources += qsv_va_sources
67   qsv_platform_deps += [gstva_dep]
68 else
69   if qsv_option.enabled()
70     error('QSV plugin supports only Windows or Linux')
71   else
72     subdir_done()
73   endif
74 endif
75
76 # suppress deprecated use of MFXInitEx. We don't use the method,
77 # but used in "mfxvideo++.h"
78 # and MinGW 32bits compiler seems to be complaining about redundant-decls
79 if cc.get_id() != 'msvc'
80   extra_args += cc.get_supported_arguments([
81     '-Wno-redundant-decls',
82     '-Wno-deprecated-declarations',
83   ])
84 endif
85
86 subdir('libmfx')
87
88 gstqsv = library('gstqsv',
89   qsv_sources,
90   c_args : gst_plugins_bad_args + extra_args,
91   cpp_args : gst_plugins_bad_args + extra_args,
92   include_directories : [configinc],
93   dependencies : [gstbase_dep, gstvideo_dep, gstcodecparsers_dep, libmfx_internal_dep] + qsv_platform_deps,
94   install : true,
95   install_dir : plugins_install_dir,
96 )
97
98 plugins += [gstqsv]