builtin: fix for Windows pipelines

This commit is contained in:
Massimiliano Culpo 2024-11-27 11:33:57 +01:00
parent cf9a148708
commit 533973671b
No known key found for this signature in database
GPG Key ID: 3E52BB992233066C
2 changed files with 65 additions and 1 deletions

View File

@ -88,7 +88,7 @@ def setup_build_environment(self, env):
# devenv is needed to convert ancient MSbuild project to modern
# msbuild project so MSBuild versions older than 2010 can build this
# project
devenv_path = os.path.join(self.pkg.compiler.vs_root, "Common7", "IDE")
devenv_path = os.path.join(self.spec["msvc"].package.vs_root, "Common7", "IDE")
env.prepend_path("PATH", devenv_path)
@property

View File

@ -143,6 +143,70 @@ def _standard_flag(self, *, language: str, standard: str) -> str:
}
return flags[language][standard]
@property
def short_msvc_version(self):
"""This is the shorthand VCToolset version of form
MSVC<short-ver>
"""
return "MSVC" + self.vc_toolset_ver
@property
def vc_toolset_ver(self):
"""
The toolset version is the version of the combined set of cl and link
This typically relates directly to VS version i.e. VS 2022 is v143
VS 19 is v142, etc.
This value is defined by the first three digits of the major + minor
version of the VS toolset (143 for 14.3x.bbbbb). Traditionally the
minor version has remained a static two digit number for a VS release
series, however, as of VS22, this is no longer true, both
14.4x.bbbbb and 14.3x.bbbbb are considered valid VS22 VC toolset
versions due to a change in toolset minor version sentiment.
This is *NOT* the full version, for that see
Msvc.msvc_version or MSVC.platform_toolset_ver for the
raw platform toolset version
"""
ver = self.msvc_version[:2].joined.string[:3]
return ver
@property
def msvc_version(self):
"""This is the VCToolset version *NOT* the actual version of the cl compiler"""
return spack.version.Version(re.search(Msvc.compiler_version_regex, self.cc).group(1))
@property
def vs_root(self):
# The MSVC install root is located at a fix level above the compiler
# and is referenceable idiomatically via the pattern below
# this should be consistent accross versions
return os.path.abspath(os.path.join(self.cc, "../../../../../../../.."))
@property
def platform_toolset_ver(self):
"""
This is the platform toolset version of current MSVC compiler
i.e. 142. The platform toolset is the targeted MSVC library/compiler
versions by compilation (this is different from the VC Toolset)
This is different from the VC toolset version as established
by `short_msvc_version`, but typically are represented by the same
three digit value
"""
# Typically VS toolset version and platform toolset versions match
# VS22 introduces the first divergence of VS toolset version
# (144 for "recent" releases) and platform toolset version (143)
# so it needs additional handling until MS releases v144
# (assuming v144 is also for VS22)
# or adds better support for detection
# TODO: (johnwparent) Update this logic for the next platform toolset
# or VC toolset version update
toolset_ver = self.vc_toolset_ver
vs22_toolset = spack.version.Version(toolset_ver) > Version("142")
return toolset_ver if not vs22_toolset else "143"
class CmdCall:
"""Compose a call to `cmd` for an ordered series of cmd commands/scripts"""