summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/backend/backends.py3
-rw-r--r--mesonbuild/backend/vs2010backend.py4
-rw-r--r--mesonbuild/backend/vs2026backend.py55
-rw-r--r--mesonbuild/options.py4
4 files changed, 64 insertions, 2 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index de41ea171..7ddf4558b 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -246,6 +246,9 @@ def get_backend_from_name(backend: str, build: T.Optional[build.Build] = None) -
elif backend == 'vs2022':
from . import vs2022backend
return vs2022backend.Vs2022Backend(build)
+ elif backend == 'vs2026':
+ from . import vs2026backend
+ return vs2026backend.Vs2026Backend(build)
elif backend == 'xcode':
from . import xcodebackend
return xcodebackend.XCodeBackend(build)
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py
index 2ee3eaa60..9b2b606d4 100644
--- a/mesonbuild/backend/vs2010backend.py
+++ b/mesonbuild/backend/vs2010backend.py
@@ -60,6 +60,10 @@ def autodetect_vs_version(build: T.Optional[build.Build]) -> backends.Backend:
'Visual Studio\\2022' in vs_install_dir:
from mesonbuild.backend.vs2022backend import Vs2022Backend
return Vs2022Backend(build)
+ if vs_version == '18.0' or 'Visual Studio 26' in vs_install_dir or \
+ 'Visual Studio\\2026' in vs_install_dir:
+ from mesonbuild.backend.vs2026backend import Vs2026Backend
+ return Vs2026Backend(build)
if 'Visual Studio 10.0' in vs_install_dir:
return Vs2010Backend(build)
raise MesonException('Could not detect Visual Studio using VisualStudioVersion: {!r} or VSINSTALLDIR: {!r}!\n'
diff --git a/mesonbuild/backend/vs2026backend.py b/mesonbuild/backend/vs2026backend.py
new file mode 100644
index 000000000..d83aec930
--- /dev/null
+++ b/mesonbuild/backend/vs2026backend.py
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: Apache-2.0
+# Copyright 2025 The Meson development team
+
+from __future__ import annotations
+
+import os
+import typing as T
+import xml.etree.ElementTree as ET
+
+from .vs2010backend import Vs2010Backend
+
+if T.TYPE_CHECKING:
+ from ..build import Build
+
+
+class Vs2026Backend(Vs2010Backend):
+
+ name = 'vs2026'
+
+ def __init__(self, build: T.Optional[Build], gen_lite: bool = False):
+ super().__init__(build, gen_lite=gen_lite)
+ self.sln_file_version = '12.00'
+ self.sln_version_comment = 'Version 17'
+
+ def detect_toolset(self) -> None:
+ if self.environment is not None:
+ comps = self.environment.coredata.compilers.host
+ if comps and all(c.id == 'clang-cl' for c in comps.values()):
+ self.platform_toolset = 'ClangCL'
+ elif comps and all(c.id == 'intel-cl' for c in comps.values()):
+ c = list(comps.values())[0]
+ if c.version.startswith('19'):
+ self.platform_toolset = 'Intel C++ Compiler 19.0'
+ # We don't have support for versions older than 2022 right now.
+ if not self.platform_toolset:
+ self.platform_toolset = 'v145'
+ self.vs_version = '2026'
+ # WindowsSDKVersion should be set by command prompt.
+ sdk_version = os.environ.get('WindowsSDKVersion', None)
+ if sdk_version:
+ self.windows_target_platform_version = sdk_version.rstrip('\\')
+
+ def generate_debug_information(self, link):
+ # valid values for vs2026 is 'false', 'true', 'DebugFastLink', 'DebugFull'
+ ET.SubElement(link, 'GenerateDebugInformation').text = 'DebugFull'
+
+ def generate_lang_standard_info(self, file_args, clconf):
+ if 'cpp' in file_args:
+ optargs = [x for x in file_args['cpp'] if x.startswith('/std:c++')]
+ if optargs:
+ ET.SubElement(clconf, 'LanguageStandard').text = optargs[0].replace("/std:c++", "stdcpp")
+ if 'c' in file_args:
+ optargs = [x for x in file_args['c'] if x.startswith('/std:c')]
+ if optargs:
+ ET.SubElement(clconf, 'LanguageStandard_C').text = optargs[0].replace("/std:c", "stdc")
diff --git a/mesonbuild/options.py b/mesonbuild/options.py
index 1ae07fdbc..a31c0737d 100644
--- a/mesonbuild/options.py
+++ b/mesonbuild/options.py
@@ -60,8 +60,8 @@ DEFAULT_YIELDING = False
# Can't bind this near the class method it seems, sadly.
_T = T.TypeVar('_T')
-backendlist = ['ninja', 'vs', 'vs2010', 'vs2012', 'vs2013', 'vs2015', 'vs2017', 'vs2019', 'vs2022', 'xcode', 'none']
-genvslitelist = ['vs2022']
+backendlist = ['ninja', 'vs', 'vs2010', 'vs2012', 'vs2013', 'vs2015', 'vs2017', 'vs2019', 'vs2022', 'vs2026', 'xcode', 'none']
+genvslitelist = ['vs2022', 'vs2026']
buildtypelist = ['plain', 'debug', 'debugoptimized', 'release', 'minsize', 'custom']
# This is copied from coredata. There is no way to share this, because this