wasapi2: Always build if Windows 10 SDK is available

Add support for building wasapi2 plugin if Windows 10 SDK is
available on system

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1951>
This commit is contained in:
Seungha Yang 2021-01-13 00:27:40 +09:00
parent 5d4e45fe36
commit 6da109cdb0

View file

@ -27,7 +27,7 @@ ksuser_dep = cc.find_library('ksuser', required : get_option('wasapi2'))
runtimeobject_dep = cc.find_library('runtimeobject', required : get_option('wasapi2'))
mmdeviceapi_dep = cc.find_library('mmdevapi', required : get_option('wasapi2'))
wasapi2_dep = [ole32_dep, ksuser_dep, runtimeobject_dep, mmdeviceapi_dep]
have_symbols = false
extra_args = []
foreach dep: wasapi2_dep
if not dep.found()
@ -71,7 +71,7 @@ winapi_app = cxx.compiles('''#include <winapifamily.h>
return 0;
} ''',
dependencies: wasapi2_dep,
name: 'checking if building winapi-partiion-app')
name: 'building for WINAPI_PARTITION_APP')
if not winapi_app
if wasapi2_option.enabled()
@ -81,10 +81,43 @@ if not winapi_app
endif
endif
win10_sdk = cxx.compiles('''#include <windows.h>
#ifndef WDK_NTDDI_VERSION
#error "unknown Windows SDK version"
#endif
#if (WDK_NTDDI_VERSION < 0x0A000000)
#error "Not a Windows 10 SDK"
#endif
''',
name: 'building with Windows 10 SDK')
if not win10_sdk
if wasapi2_option.enabled()
error('wasapi2 plugin was enabled explicitly, but Windows 10 SDK is unavailable')
else
subdir_done()
endif
endif
building_for_win10 = cxx.compiles('''#include <windows.h>
#ifndef WINVER
#error "unknown minimum supported OS version"
#endif
#if (WINVER < 0x0A00)
#error "Windows 10 API is not guaranteed"
#endif
''',
name: 'building for Windows 10')
if not building_for_win10
message('Bumping target Windows version to Windows 10 for building wasapi2 plugin')
extra_args += ['-DWINVER=0x0A00', '-D_WIN32_WINNT=0x0A00', '-DNTDDI_VERSION=WDK_NTDDI_VERSION']
endif
gstwasapi2 = library('gstwasapi2',
wasapi2_sources,
c_args : gst_plugins_bad_args + ['-DCOBJMACROS'],
cpp_args : gst_plugins_bad_args,
c_args : gst_plugins_bad_args + ['-DCOBJMACROS'] + extra_args,
cpp_args : gst_plugins_bad_args + extra_args,
include_directories : [configinc],
dependencies : [gstaudio_dep] + wasapi2_dep,
install : true,