meson: Undefine any WINVER and _WIN32_WINNT entries before redefining them

Fixes Cerbero build with MinGW GCC 14, where specifying -DWINVER=0x0601 -DWINVER=0x0A00 is a hard -Werror.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7658>
This commit is contained in:
L. E. Segovia 2024-10-12 19:10:46 -03:00
parent 572f2d10f5
commit 4dcc4b6235
7 changed files with 11 additions and 5 deletions

View file

@ -67,7 +67,7 @@ building_for_win10 = cxx.compiles('''#include <windows.h>
if not building_for_win10
message('Bumping target Windows version to Windows 10 for building gstwinrt library')
extra_comm_args += ['-DWINVER=0x0A00', '-D_WIN32_WINNT=0x0A00', '-DNTDDI_VERSION=WDK_NTDDI_VERSION']
extra_comm_args += ['-U_WIN32_WINNT', '-UWINVER', '-DWINVER=0x0A00', '-D_WIN32_WINNT=0x0A00', '-DNTDDI_VERSION=WDK_NTDDI_VERSION']
endif
gstwinrt = library('gstwinrt-' + api_version,

View file

@ -438,6 +438,8 @@ if host_machine.system() == 'windows'
if not building_for_win7
add_project_arguments([
'-U_WIN32_WINNT',
'-UWINVER',
'-D_WIN32_WINNT=_WIN32_WINNT_WIN7',
'-DWINVER=_WIN32_WINNT_WIN7',
], language: ['c', 'cpp'])

View file

@ -49,7 +49,9 @@ endif
if cc.has_header('d2d1_3.h') and cc.has_header('dwrite_3.h')
# DWRITE_GLYPH_IMAGE_FORMATS enum requires NTDDI_WIN10_RS1
extra_args += ['-DWINVER=0x0A00',
extra_args += ['-U_WIN32_WINNT',
'-UWINVER',
'-DWINVER=0x0A00',
'-D_WIN32_WINNT=0x0A00',
'-DNTDDI_VERSION=0x0A000002',
'-DHAVE_DWRITE_COLOR_FONT']

View file

@ -123,7 +123,7 @@ building_for_win10 = cxx.compiles('''#include <windows.h>
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']
extra_args += ['-U_WIN32_WINNT', '-UWINVER', '-DWINVER=0x0A00', '-D_WIN32_WINNT=0x0A00', '-DNTDDI_VERSION=WDK_NTDDI_VERSION']
endif
if not gstwinrt_dep.found()

View file

@ -68,7 +68,7 @@ building_for_win10 = cxx.compiles('''#include <windows.h>
if not building_for_win10
message('Bumping target Windows version to Windows 10 for building webview2 plugin')
extra_args += ['-DWINVER=0x0A00', '-D_WIN32_WINNT=0x0A00', '-DNTDDI_VERSION=WDK_NTDDI_VERSION']
extra_args += ['-U_WIN32_WINNT', '-UWINVER', '-DWINVER=0x0A00', '-D_WIN32_WINNT=0x0A00', '-DNTDDI_VERSION=WDK_NTDDI_VERSION']
endif
dwmapi_lib = cc.find_library('dwmapi', required : webview2_option)

View file

@ -63,7 +63,7 @@ building_for_win10 = cxx.compiles('''#include <windows.h>
if not building_for_win10
message('Bumping target Windows version to Windows 10 for building wic plugin')
extra_args += ['-DWINVER=0x0A00', '-D_WIN32_WINNT=0x0A00', '-DNTDDI_VERSION=WDK_NTDDI_VERSION']
extra_args += ['-U_WIN32_WINNT', '-UWINVER', '-DWINVER=0x0A00', '-D_WIN32_WINNT=0x0A00', '-DNTDDI_VERSION=WDK_NTDDI_VERSION']
endif
gstwic = library('gstwic',

View file

@ -439,6 +439,8 @@ if host_system == 'windows'
if not building_for_win7
add_project_arguments([
'-U_WIN32_WINNT',
'-UWINVER',
'-D_WIN32_WINNT=_WIN32_WINNT_WIN7',
'-DWINVER=_WIN32_WINNT_WIN7',
], language: ['c', 'cpp'])