meson: Rework d3d11 checks, add new d3d11-math option

This allows us to ensure that directxmath SIMD is enabled.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5690>
This commit is contained in:
Nirbheek Chauhan 2023-11-20 08:12:48 +00:00 committed by GStreamer Marge Bot
parent b42b45af46
commit f65d074354
2 changed files with 21 additions and 16 deletions

View file

@ -26,8 +26,9 @@ d3d11_headers = [
gstd3d11_dep = dependency('', required : false)
directxmath_dep = dependency('', required : false)
d3d11_opt = get_option('d3d11')
if host_system != 'windows'
if host_system != 'windows' or d3d11_opt.disabled()
subdir_done()
endif
@ -45,10 +46,10 @@ have_dxgidebug_h = false
d3d11_winapi_app = false
d3d11_conf = configuration_data()
d3d11_lib = cc.find_library('d3d11', required : false)
dxgi_lib = cc.find_library('dxgi', required : false)
d3d11_lib = cc.find_library('d3d11', required: d3d11_opt)
dxgi_lib = cc.find_library('dxgi', required: d3d11_opt)
d3dcompiler_lib = cc.find_library('d3dcompiler', required: false)
runtimeobject_lib = cc.find_library('runtimeobject', required : false)
runtimeobject_lib = cc.find_library('runtimeobject', required: false)
if not d3d11_lib.found() or not dxgi_lib.found()
subdir_done()
@ -61,8 +62,8 @@ sdk_headers = [
]
foreach h : sdk_headers
if not cc.has_header (h)
subdir_done ()
if not cc.has_header(h, required: d3d11_opt)
subdir_done()
endif
endforeach
@ -91,6 +92,9 @@ if runtimeobject_lib.found() and d3dcompiler_lib.found()
endif
if not d3d11_winapi_desktop and not d3d11_winapi_app
if d3d11_opt.enabled()
error('Not building for win32 or winRT?')
endif
subdir_done()
endif
@ -189,16 +193,12 @@ have_dx_math = cxx.compiles('''
return 0;
}
''',
name: 'DirectXMath suupport in Windows SDK')
name: 'DirectXMath support in Windows SDK')
if not have_dx_math
directxmath_dep = dependency('directxmath',
fallback: ['directxmath', 'directxmath_dep'],
required: false)
if not directxmath_dep.found()
subdir_done ()
endif
allow_fallback: true,
required: get_option('d3d11-math'))
extra_deps += [directxmath_dep]
endif
@ -215,10 +215,12 @@ if host_machine.cpu_family() != 'x86'
return 0;
}
''',
name: 'DirectXMath SIMD suupport',
name: 'DirectXMath SIMD support',
dependencies: directxmath_dep)
if have_dx_math_simd
extra_comm_args += ['-DHAVE_DIRECTX_MATH_SIMD']
elif get_option('d3d11-math').enabled()
error('Usable DirectXMath not found')
endif
endif

View file

@ -103,8 +103,6 @@ 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('d3d11-hlsl-precompile', type : 'feature', value : 'auto', description : 'Enable buildtime HLSL compile for d3d11 library/plugin')
option('d3d12', type : 'feature', value : 'auto', description : 'Direct3D12 plugin')
option('dash', type : 'feature', value : 'auto', description : 'DASH demuxer plugin')
option('dc1394', type : 'feature', value : 'auto', description : 'libdc1394 IIDC camera source plugin')
@ -211,6 +209,11 @@ option('isac', type : 'feature', value : 'auto', description : 'iSAC plugin')
option('aja-sdk-dir', type : 'string', value : '',
description : 'Directory with AJA SDK, e.g. ntv2sdklinux_16.0.0.4')
# D3D11 plugin options
option('d3d11-math', type : 'feature', value : 'auto', description : 'Enable DirectX SIMD Math support')
option('d3d11-hlsl-precompile', type : 'feature', value : 'auto', description : 'Enable buildtime HLSL compile for d3d11 library/plugin')
option('d3d11-wgc', type : 'feature', value : 'auto', description : 'Windows Graphics Capture API support in d3d11 plugin')
# HLS plugin options
option('hls', type : 'feature', value : 'auto', description : 'HTTP Live Streaming plugin')
option('hls-crypto', type : 'combo', value : 'auto', choices : ['auto', 'nettle', 'libgcrypt', 'openssl'],