meson: allow building with the older of two installed versions of VS

meson always queries for the -latest -prerelease version of Visual
Studio using vswhere, ignoring the selection done in configure. This
then clashes when trying to build with an older version of the compiler.

That's an obvious hack that only works with the provided version of
meson and a better fix would be to make that a meson commandline option
or allow passing it via the ENV/have it guess from CC/CXX or similar.

Change-Id: I9bcbe26d9b1518b5effbf0be99329b8d2d4a0262
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197943
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
This commit is contained in:
Christian Lohmaier
2026-01-23 15:38:57 +01:00
parent 5b9e6ccfa8
commit bbb3c95c6d
+17
View File
@@ -11,4 +11,21 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,meson))
$(eval $(call gb_UnpackedTarball_set_tarball,meson,$(MESON_TARBALL)))
ifeq ($(OS),WNT)
# hack to make meson use a specific VS version and not always the latest
# (argument is '-latest' so inner quotes to separate the arguments
# it also always specifies -prerelease, but that is left alone here)
ifneq ($(filter 17.%,$(VCVER)),)
meson_vsversion=-version', '[17,18)
else ifneq ($(filter 18.%,$(VCVER)),)
meson_vsversion=-version', '[18,19)
else
$(warning Warning: Unhandled VCVER '$(VCVER)'; defaulting meson to use latest VS version)
meson_vsversion=-latest
endif
$(eval $(call gb_UnpackedTarball_set_post_action,meson,\
sed -i -e "s/-latest/$(meson_vsversion)/" mesonbuild/utils/vsenv.py \
))
endif
# vim: set noet sw=4 ts=4: