meson: d3d12: Use configuration file

Move defines to config header

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7208>
This commit is contained in:
Seungha Yang 2024-07-18 23:51:23 +09:00
parent 84cb1ef895
commit 8c2bbd8760
3 changed files with 13 additions and 8 deletions

View file

@ -34,6 +34,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include "gstd3d12plugin-config.h"
#include "gstd3d12screencapturesrc.h" #include "gstd3d12screencapturesrc.h"
#include "gstd3d12dxgicapture.h" #include "gstd3d12dxgicapture.h"
#ifdef HAVE_WGC #ifdef HAVE_WGC

View file

@ -38,6 +38,8 @@ extra_args = [
'-DGST_D3D12_USE_DIRECTX_HEADERS', '-DGST_D3D12_USE_DIRECTX_HEADERS',
] ]
d3d12_cdata = configuration_data()
# Disable this warning error. Otherwise d3dx12.h will break build # Disable this warning error. Otherwise d3dx12.h will break build
if cc.get_argument_syntax() == 'msvc' if cc.get_argument_syntax() == 'msvc'
extra_args += cc.get_supported_arguments([ extra_args += cc.get_supported_arguments([
@ -145,20 +147,14 @@ if not have_d3d12_headers
subdir_done() subdir_done()
endif endif
# https://learn.microsoft.com/en-us/windows/win32/dxmath/pg-xnamath-internals#windows-sse-versus-sse2
# x86 with Windows 7 or older may not support SSE2
if host_machine.cpu_family() != 'x86'
extra_args += ['-DHAVE_DIRECTX_MATH_SIMD']
endif
if have_wgc and dwmapi_lib.found() if have_wgc and dwmapi_lib.found()
d3d12_cdata.set('HAVE_WGC', true)
d3d12_sources += ['gstd3d12graphicscapture.cpp'] d3d12_sources += ['gstd3d12graphicscapture.cpp']
extra_args += ['-DHAVE_WGC']
extra_deps += [dwmapi_lib] extra_deps += [dwmapi_lib]
endif endif
if gstd3d11_dep.found() if gstd3d11_dep.found()
extra_args += ['-DHAVE_GST_D3D11'] d3d12_cdata.set('HAVE_GST_D3D11', true)
extra_deps += [gstd3d11_dep] extra_deps += [gstd3d11_dep]
d3d12_sources += [ d3d12_sources += [
'gstd3d12memorycopy.cpp', 'gstd3d12memorycopy.cpp',
@ -170,6 +166,11 @@ else
] ]
endif endif
configure_file(
output: 'gstd3d12plugin-config.h',
configuration: d3d12_cdata,
)
gstd3d12 = library('gstd3d12', gstd3d12 = library('gstd3d12',
d3d12_sources, d3d12_sources,
c_args : gst_plugins_bad_args + extra_args, c_args : gst_plugins_bad_args + extra_args,

View file

@ -27,6 +27,8 @@
#include <config.h> #include <config.h>
#endif #endif
#include "gstd3d12plugin-config.h"
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/d3d12/gstd3d12.h> #include <gst/d3d12/gstd3d12.h>
#include "gstd3d12pluginutils.h" #include "gstd3d12pluginutils.h"