From 6429f0469276cac0e93c0ee8fee8d5ea8e328ca6 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Wed, 28 Jun 2023 03:41:26 +0900 Subject: [PATCH] meson: d3d11: Add d3d11-wgc option for Windows Graphics Capture feature Make the feature requirement explicitly controllable via build option Part-of: --- subprojects/gst-plugins-bad/meson_options.txt | 1 + .../gst-plugins-bad/sys/d3d11/meson.build | 48 +++++++++++-------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/subprojects/gst-plugins-bad/meson_options.txt b/subprojects/gst-plugins-bad/meson_options.txt index a1d9fd2f4f..62ee2c6097 100644 --- a/subprojects/gst-plugins-bad/meson_options.txt +++ b/subprojects/gst-plugins-bad/meson_options.txt @@ -99,6 +99,7 @@ option('curl', type : 'feature', value : 'auto', description : 'cURL network sou option('curl-ssh2', type : 'feature', value : 'auto', description : 'cURL network source and sink plugin libssh2 support') option('d3dvideosink', type : 'feature', value : 'auto', description : 'Direct3D video sink plugin') option('d3d11', type : 'feature', value : 'auto', description : 'Direct3D11 plugin') +option('d3d11-wgc', type : 'feature', value : 'auto', description : 'Windows Graphics Capture API support in d3d11 plugin') option('dash', type : 'feature', value : 'auto', description : 'DASH demuxer plugin') option('dc1394', type : 'feature', value : 'auto', description : 'libdc1394 IIDC camera source plugin') option('decklink', type : 'feature', value : 'auto', description : 'DeckLink audio/video source/sink plugin') diff --git a/subprojects/gst-plugins-bad/sys/d3d11/meson.build b/subprojects/gst-plugins-bad/sys/d3d11/meson.build index bfea59c8ad..b6cb4876c3 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/meson.build +++ b/subprojects/gst-plugins-bad/sys/d3d11/meson.build @@ -32,6 +32,7 @@ extra_args = ['-DGST_USE_UNSTABLE_API'] extra_dep = [] d3d11_option = get_option('d3d11') +d3d11_wgc_option = get_option('d3d11-wgc') if host_system != 'windows' or d3d11_option.disabled() subdir_done() endif @@ -55,26 +56,34 @@ endif d2d_dep = cc.find_library('d2d1', required: d3d11_option) have_d2d_h = cc.has_header('d2d1.h', required: d3d11_option) +dwmapi_lib = cc.find_library('dwmapi', required: d3d11_wgc_option) +have_wgc = false -have_wgc = cxx.compiles(''' - #include - #include - #include - #include, - #include - #include - #include - #include - using namespace Microsoft::WRL; - using namespace ABI::Windows::Graphics::Capture; - ComPtr pool_statics; - ComPtr pool_statics2; - ComPtr pool; - ComPtr session; - ComPtr session2; - ComPtr session3; - ''', - name: 'Windows Graphics Capture support in Windows SDK') +if not d3d11_wgc_option.disabled() + have_wgc = cxx.compiles(''' + #include + #include + #include + #include, + #include + #include + #include + #include + using namespace Microsoft::WRL; + using namespace ABI::Windows::Graphics::Capture; + ComPtr pool_statics; + ComPtr pool_statics2; + ComPtr pool; + ComPtr session; + ComPtr session2; + ComPtr session3; + ''', + name: 'Windows Graphics Capture support in Windows SDK') + + if d3d11_wgc_option.enabled() and not have_wgc + error('The Windows Graphics Capture feature is enabled but not supported by Windows SDK') + endif +endif # if build target is Windows 10 and WINAPI_PARTITION_APP is allowed, # we can build UWP only modules as well @@ -97,7 +106,6 @@ if d3d11_winapi_desktop extra_dep += [winmm_lib] endif - dwmapi_lib = cc.find_library('dwmapi', required: false) if have_wgc and dwmapi_lib.found() d3d11_sources += ['gstd3d11winrtcapture.cpp'] extra_args += ['-DHAVE_WINRT_CAPTURE']