gstreamer/subprojects/gst-plugins-bad/sys/amfcodec/meson.build
Seungha Yang ad9c435647 amfcodec: Fix for MinGW build
timeapi.h header might not be missing depending on toolchain.
Also do hard meson error if winmm dep is not available but
amfcodec is explicitly enabled.
And fixing various GCC build warning errors.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2155>
2022-04-11 18:44:40 +00:00

82 lines
2.1 KiB
Meson

amf_sources = [
'gstamfencoder.cpp',
'gstamfh264enc.cpp',
'gstamfh265enc.cpp',
'gstamfutils.cpp',
'plugin.cpp',
]
amf_option = get_option('amfcodec')
if amf_option.disabled()
subdir_done()
endif
platform_deps = []
extra_args = ['-DGST_USE_UNSTABLE_API']
extra_cpp_args = []
if host_system == 'windows'
if not gstd3d11_dep.found()
if amf_option.enabled()
error('The amf was enabled explicitly, but required d3d11 was not found')
else
subdir_done()
endif
endif
code = '''
#include <windows.h>
#if !(WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
#error "Not building for UWP"
#endif'''
if cc.compiles(code, name : 'building for UWP')
if amf_option.enabled()
error('amf plugin does not support UWP')
else
subdir_done()
endif
endif
# Encoder needs to do sleep() by API design
winmm_lib = cc.find_library('winmm', required: amf_option)
if not winmm_lib.found() or not cc.has_header('mmsystem.h')
if amf_option.enabled()
error('Required winmm dependency is not available')
else
subdir_done()
endif
endif
platform_deps += [gstd3d11_dep, winmm_lib]
else
if amf_option.enabled()
error('amf plugin supports only Windows')
else
subdir_done()
endif
endif
if cxx.get_id() != 'msvc'
extra_cpp_args = cxx.get_supported_arguments([
# and MinGW 32bits compiler seems to be complaining about redundant-decls
'-Wno-redundant-decls',
# Various SDK header issue
'-Wno-class-memaccess',
'-Wno-attributes',
'-Wno-format',
'-Wno-format-nonliteral',
'-Wno-format-security',
])
endif
gstamfcodec = library('gstamfcodec',
amf_sources,
c_args : gst_plugins_bad_args + extra_args,
cpp_args : gst_plugins_bad_args + extra_args + extra_cpp_args,
include_directories : [configinc, include_directories('include')],
dependencies : [gstbase_dep, gstvideo_dep, gstpbutils_dep, gstcodecparsers_dep, gmodule_dep] + platform_deps,
install : true,
install_dir : plugins_install_dir,
)
pkgconfig.generate(gstamfcodec, install_dir : plugins_pkgconfig_install_dir)
plugins += [gstamfcodec]