Fix cross build with mingw32

At least on Ubuntu 20.04 the x86_64-w64-mingw32-gcc toolchain defaults
to WinXP. We require at least Vista for FILE_STANDARD_INFO.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2022>
This commit is contained in:
Xavier Claessens 2022-03-24 14:15:00 -04:00 committed by GStreamer Marge Bot
parent d522b17d9c
commit f270f9e974
3 changed files with 34 additions and 1 deletions

View file

@ -77,7 +77,6 @@ elif system == 'windows'
if compiler.get_id() == 'gcc'
compile_args += [compiler.get_supported_arguments([
'-Wno-format',
'-D_WIN32_WINNT=0x601', # Enables inet_ntop and friends
])]
endif
else

View file

@ -408,6 +408,23 @@ endif
if host_machine.system() == 'windows'
winsock2 = [cc.find_library('ws2_32')]
building_for_win7 = cc.compiles('''#include <windows.h>
#ifndef WINVER
#error "unknown minimum supported OS version"
#endif
#if (WINVER < _WIN32_WINNT_WIN7)
#error "Windows 7 API is not guaranteed"
#endif
''',
name: 'building for Windows 7')
if not building_for_win7
add_project_arguments([
'-D_WIN32_WINNT=_WIN32_WINNT_WIN7',
'-DWINVER=_WIN32_WINNT_WIN7',
], language: ['c', 'cpp'])
endif
else
winsock2 = []
endif

View file

@ -404,6 +404,23 @@ if host_system == 'windows'
if cc.compiles(code, name : 'building for UWP')
building_for_uwp = true
endif
building_for_win7 = cc.compiles('''#include <windows.h>
#ifndef WINVER
#error "unknown minimum supported OS version"
#endif
#if (WINVER < _WIN32_WINNT_WIN7)
#error "Windows 7 API is not guaranteed"
#endif
''',
name: 'building for Windows 7')
if not building_for_win7
add_project_arguments([
'-D_WIN32_WINNT=_WIN32_WINNT_WIN7',
'-DWINVER=_WIN32_WINNT_WIN7',
], language: ['c', 'cpp'])
endif
endif
backtrace_deps = []