summaryrefslogtreecommitdiffstats
path: root/SCons
diff options
context:
space:
mode:
authorJoseph Brill <48932340+jcbrill@users.noreply.github.com>2022-06-29 19:20:44 (GMT)
committerJoseph Brill <48932340+jcbrill@users.noreply.github.com>2022-06-29 19:20:44 (GMT)
commita63c1cfdeffbcf7e9214702df4f93e5f015ead10 (patch)
treee87812464720a4c25dcd6dbc9c9f4dd6353bfee8 /SCons
parent8dd2c436317301067f2637829572c36499e24318 (diff)
downloadSCons-a63c1cfdeffbcf7e9214702df4f93e5f015ead10.zip
SCons-a63c1cfdeffbcf7e9214702df4f93e5f015ead10.tar.gz
SCons-a63c1cfdeffbcf7e9214702df4f93e5f015ead10.tar.bz2
Add 14.0 toolset registry check as done in msvc vsvars140.bat.
Diffstat (limited to 'SCons')
-rw-r--r--SCons/Tool/MSCommon/MSVC/Registry.py3
-rw-r--r--SCons/Tool/MSCommon/MSVC/ScriptArguments.py19
-rw-r--r--SCons/Tool/MSCommon/vc.py1
3 files changed, 21 insertions, 2 deletions
diff --git a/SCons/Tool/MSCommon/MSVC/Registry.py b/SCons/Tool/MSCommon/MSVC/Registry.py
index 492f3d0..9ffa01e 100644
--- a/SCons/Tool/MSCommon/MSVC/Registry.py
+++ b/SCons/Tool/MSCommon/MSVC/Registry.py
@@ -107,3 +107,6 @@ def windows_kit_query_paths(version):
q = windows_kits(version)
return microsoft_query_paths(q)
+def vstudio_sxs_vc7(version):
+ return '\\'.join([r'VisualStudio\SxS\VC7', version])
+
diff --git a/SCons/Tool/MSCommon/MSVC/ScriptArguments.py b/SCons/Tool/MSCommon/MSVC/ScriptArguments.py
index 56a4676..4db478a 100644
--- a/SCons/Tool/MSCommon/MSVC/ScriptArguments.py
+++ b/SCons/Tool/MSCommon/MSVC/ScriptArguments.py
@@ -40,6 +40,7 @@ from ..common import (
from . import Util
from . import Config
+from . import Registry
from . import WinSDK
from .Exceptions import (
@@ -491,13 +492,16 @@ def _msvc_read_toolset_default(msvc, vc_dir):
_toolset_version_cache = {}
_toolset_default_cache = {}
+_toolset_have140_cache = None
def _reset_toolset_cache():
global _toolset_version_cache
global _toolset_default_cache
+ global _toolset_have140_cache
debug('reset: toolset cache')
_toolset_version_cache = {}
_toolset_default_cache = {}
+ _toolset_have140_cache = None
def _msvc_version_toolsets(msvc, vc_dir):
@@ -519,10 +523,23 @@ def _msvc_default_toolset(msvc, vc_dir):
return toolset_default
+def _msvc_have140_toolset():
+ global _toolset_have140_cache
+
+ if _toolset_have140_cache is None:
+ suffix = Registry.vstudio_sxs_vc7('14.0')
+ vcinstalldirs = [record[0] for record in Registry.microsoft_query_paths(suffix)]
+ debug('vc140 toolset: paths=%s', repr(vcinstalldirs))
+ _toolset_have140_cache = True if vcinstalldirs else False
+
+ return _toolset_have140_cache
+
def _msvc_version_toolset_vcvars(msvc, vc_dir, toolset_version):
if toolset_version == '14.0':
- return toolset_version
+ if _msvc_have140_toolset():
+ return toolset_version
+ return None
toolsets_sxs, toolsets_full = _msvc_version_toolsets(msvc, vc_dir)
diff --git a/SCons/Tool/MSCommon/vc.py b/SCons/Tool/MSCommon/vc.py
index 7c65879..502a71f 100644
--- a/SCons/Tool/MSCommon/vc.py
+++ b/SCons/Tool/MSCommon/vc.py
@@ -1300,7 +1300,6 @@ def msvc_setup_env_user(env=None):
# Intent is to use msvc tools:
# MSVC_VERSION: defined and evaluates True
# MSVS_VERSION: defined and evaluates True
- # MSVC_TOOLSET_VERSION: defined and evaluates True
# MSVC_USE_SCRIPT: defined and (is string or evaluates False)
# MSVC_USE_SETTINGS: defined and is not None