b5dd2aef48bed09a90c08455d1a8ab7ff298b9d7
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-bad / sys / d3d11 / meson.build
1 d3d11_sources = [
2   'gstd3d11basefilter.cpp',
3   'gstd3d11convert.cpp',
4   'gstd3d11converter.cpp',
5   'gstd3d11compositor.cpp',
6   'gstd3d11compositorbin.cpp',
7   'gstd3d11download.cpp',
8   'gstd3d11overlaycompositor.cpp',
9   'gstd3d11pluginutils.cpp',
10   'gstd3d11shader.cpp',
11   'gstd3d11upload.cpp',
12   'gstd3d11videoprocessor.cpp',
13   'gstd3d11videosink.cpp',
14   'gstd3d11window.cpp',
15   'gstd3d11window_dummy.cpp',
16   'plugin.cpp',
17 ]
18
19 d3d11_dec_sources = [
20   'gstd3d11av1dec.cpp',
21   'gstd3d11decoder.cpp',
22   'gstd3d11h264dec.cpp',
23   'gstd3d11vp9dec.cpp',
24   'gstd3d11h265dec.cpp',
25   'gstd3d11mpeg2dec.cpp',
26   'gstd3d11vp8dec.cpp',
27 ]
28
29 extra_c_args = ['-DCOBJMACROS']
30 extra_args = ['-DGST_USE_UNSTABLE_API']
31 extra_dep = []
32
33 d3d11_option = get_option('d3d11')
34 if host_system != 'windows' or d3d11_option.disabled()
35   subdir_done()
36 endif
37
38 if not gstd3d11_dep.found()
39   if d3d11_option.enabled()
40     error('The d3d11 was enabled explicitly, but required dependencies were not found.')
41   endif
42   subdir_done()
43 endif
44
45 d3dcompiler_lib = cc.find_library('d3dcompiler', required: d3d11_option)
46 runtimeobject_lib = cc.find_library('runtimeobject', required : false)
47 winmm_lib = cc.find_library('winmm', required: false)
48 has_decoder = false
49
50 have_d3d11 = cc.has_header('d3dcompiler.h')
51 if not have_d3d11
52   if d3d11_option.enabled()
53     error('The d3d11 plugin was enabled explicitly, but required dependencies were not found.')
54   endif
55   subdir_done()
56 endif
57
58 # d3d11 video api uses dxva structure for decoding, and dxva.h needs d3d9 types
59 if cc.has_header('dxva.h') and cc.has_header('d3d9.h')
60   d3d11_sources += d3d11_dec_sources
61   extra_args += ['-DHAVE_DXVA_H']
62   extra_dep += [gstcodecs_dep]
63   has_decoder = true
64 endif
65
66 if d3d11_winapi_only_app and (not d3dcompiler_lib.found() or not runtimeobject_lib.found())
67   if d3d11_option.enabled()
68     error('The d3d11 plugin was enabled explicitly, but required dependencies were not found.')
69   endif
70   subdir_done()
71 endif
72
73 # if build target is Windows 10 and WINAPI_PARTITION_APP is allowed,
74 # we can build UWP only modules as well
75 if d3d11_winapi_app
76   d3d11_sources += ['gstd3d11window_corewindow.cpp',
77                     'gstd3d11window_swapchainpanel.cpp']
78   extra_dep += [runtimeobject_lib, d3dcompiler_lib]
79 endif
80
81 if d3d11_winapi_desktop
82   d3d11_sources += ['gstd3d11window_win32.cpp']
83   if d3d11_conf.get('GST_D3D11_DXGI_HEADER_VERSION') >= 6
84     # Desktop Duplication API is unavailable for UWP
85     # and MinGW is not supported due to some missing headers
86     extra_args += ['-DHAVE_DXGI_DESKTOP_DUP']
87     d3d11_sources += ['gstd3d11screencapture.cpp',
88                       'gstd3d11screencapturedevice.cpp',
89                       'gstd3d11screencapturesrc.cpp']
90     message('Enable D3D11 Desktop Duplication API')
91   endif
92   # multimedia clock is desktop only API
93   if has_decoder and winmm_lib.found() and cc.has_header('timeapi.h')
94     extra_args += ['-DHAVE_WINMM']
95     extra_dep += [winmm_lib]
96   endif
97 endif
98
99 # need dxgi1_5.h for HDR10 processing and d3d11_4.h for ID3D11VideoContext2 interface
100 if d3d11_conf.get('GST_D3D11_DXGI_HEADER_VERSION') >= 5 and d3d11_conf.get('GST_D3D11_HEADER_VERSION') >= 4
101   d3d11_sources += ['gstd3d11deinterlace.cpp']
102   extra_args += ['-DHAVE_D3D11_VIDEO_PROC']
103 endif
104
105 # MinGW 32bits compiler seems to be complaining about redundant-decls
106 # when ComPtr is in use. Let's just disable the warning
107 if cc.get_id() != 'msvc'
108   extra_mingw_args = cc.get_supported_arguments([
109     '-Wno-redundant-decls',
110   ])
111
112   extra_args += extra_mingw_args
113 endif
114
115 gstd3d11 = library('gstd3d11',
116   d3d11_sources,
117   c_args : gst_plugins_bad_args + extra_c_args + extra_args,
118   cpp_args: gst_plugins_bad_args + extra_args,
119   include_directories : [configinc],
120   dependencies : [gstbase_dep, gstvideo_dep, gmodule_dep, gstcontroller_dep, gstd3d11_dep] + extra_dep,
121   install : true,
122   install_dir : plugins_install_dir,
123 )
124 pkgconfig.generate(gstd3d11, install_dir : plugins_pkgconfig_install_dir)
125 plugins += [gstd3d11]