From f270f9e974b5e0e78eba0537e8da882f33d73f21 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Thu, 24 Mar 2022 14:15:00 -0400 Subject: [PATCH] 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: --- .../ext/sctp/usrsctp/meson.build | 1 - subprojects/gst-plugins-bad/meson.build | 17 +++++++++++++++++ subprojects/gstreamer/meson.build | 17 +++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/subprojects/gst-plugins-bad/ext/sctp/usrsctp/meson.build b/subprojects/gst-plugins-bad/ext/sctp/usrsctp/meson.build index 8d474970bb..0869dd59fd 100644 --- a/subprojects/gst-plugins-bad/ext/sctp/usrsctp/meson.build +++ b/subprojects/gst-plugins-bad/ext/sctp/usrsctp/meson.build @@ -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 diff --git a/subprojects/gst-plugins-bad/meson.build b/subprojects/gst-plugins-bad/meson.build index ce1918eeee..0d5b66c466 100644 --- a/subprojects/gst-plugins-bad/meson.build +++ b/subprojects/gst-plugins-bad/meson.build @@ -408,6 +408,23 @@ endif if host_machine.system() == 'windows' winsock2 = [cc.find_library('ws2_32')] + + building_for_win7 = cc.compiles('''#include + #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 diff --git a/subprojects/gstreamer/meson.build b/subprojects/gstreamer/meson.build index ae2ca58b41..46551c7978 100644 --- a/subprojects/gstreamer/meson.build +++ b/subprojects/gstreamer/meson.build @@ -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 + #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 = []