From 10396a35916f6f0c8647e8fbced0e813fe5d5031 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 24 Dec 2022 14:21:00 +0200 Subject: [PATCH 30/30] Meson: Add support for min-win-ver option See osdn #46347 Signed-off-by: Marko Lindqvist --- doc/INSTALL.meson | 4 ++++ meson.build | 10 +++++++++- meson_options.txt | 5 +++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/doc/INSTALL.meson b/doc/INSTALL.meson index 3b30a5d76b..c163717598 100644 --- a/doc/INSTALL.meson +++ b/doc/INSTALL.meson @@ -162,6 +162,10 @@ project-definition (string): Filename of the project definition to use. See below for contents of such a file +min-win-ver (string): + Minimum Windows version the build should support. Versions listed on + https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt?view=msvc-170 + Project definition file ----------------------- diff --git a/meson.build b/meson.build index dd78cbcdca..b728951731 100644 --- a/meson.build +++ b/meson.build @@ -157,7 +157,11 @@ if host_system == 'windows' pub_conf_data.set('FREECIV_SOCKET_ZERO_NOT_STDIN', 1) priv_conf_data.set('ALWAYS_ROOT', 1) - if get_option('qtver') == 'qt6' and \ + min_win_ver = get_option('min-win-ver') + + if min_win_ver != '' + add_global_arguments('-D_WIN32_WINNT=' + min_win_ver, language: ['c', 'cpp']) + elif get_option('qtver') == 'qt6' and \ ( get_option('ruledit') or \ get_option('clients').contains('qt') or \ get_option('fcmp').contains('qt')) @@ -168,6 +172,10 @@ if host_system == 'windows' net_dep = c_compiler.find_library('ws2_32') else + if get_option('min-win-ver') != '' + error('Option min-win-ver supported on Windows only!') + endif + # Assume that vsnprintf() is a working one, if it's found # (that's checked separately) priv_conf_data.set('HAVE_WORKING_VSNPRINTF', 1) diff --git a/meson_options.txt b/meson_options.txt index 04e98d0259..db171b8f38 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -80,3 +80,8 @@ option('project-definition', type: 'string', value: '', description: 'File with project defition') + +option('min-win-ver', + type: 'string', + value: '', + description: 'Minimum Windows version to support') -- 2.35.1