From c8beb69f81dc6eb362ec4cad7e2bba0df525f1e7 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 24 Dec 2022 14:24:05 +0200 Subject: [PATCH 21/21] 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 354281c688..51cb05266a 100644 --- a/doc/INSTALL.meson +++ b/doc/INSTALL.meson @@ -162,6 +162,10 @@ freeciv-web (boolean): qtver ('qt5'/'qt6'): Whether to build Qt5 or Qt6 versions of the binaries. +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 + run.sh ------ diff --git a/meson.build b/meson.build index 53442a705b..6b68bbcfec 100644 --- a/meson.build +++ b/meson.build @@ -118,7 +118,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')) @@ -129,6 +133,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 5f106201f1..565a4590c6 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -75,3 +75,8 @@ option('qtver', choices: ['qt5', 'qt6'], value: 'qt6', description: 'Whether to build Qt5 or Qt6 versions of the binaries') + +option('min-win-ver', + type: 'string', + value: '', + description: 'Minimum Windows version to support') -- 2.35.1