summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2019-12-24 01:43:32 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2019-12-24 01:43:32 (GMT)
commitc4e058dc877e9330110ab7a732b82de1224dc815 (patch)
tree1dc63bc255d6c51000ab5906a03054515a0fe0c2
parent4d53fb2838087c2284cf5756a3be69adc2c67245 (diff)
downloadSCons-c4e058dc877e9330110ab7a732b82de1224dc815.zip
SCons-c4e058dc877e9330110ab7a732b82de1224dc815.tar.gz
SCons-c4e058dc877e9330110ab7a732b82de1224dc815.tar.bz2
Add propagating VCINSTALLDIR and VCToolsInstallDir which are used by CLang to find MSVC files including header files aka stdio.h,etc
-rw-r--r--src/engine/SCons/Tool/MSCommon/common.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/engine/SCons/Tool/MSCommon/common.py b/src/engine/SCons/Tool/MSCommon/common.py
index bbccf61..386f445 100644
--- a/src/engine/SCons/Tool/MSCommon/common.py
+++ b/src/engine/SCons/Tool/MSCommon/common.py
@@ -50,7 +50,7 @@ elif LOGFILE:
level=logging.DEBUG)
debug = logging.getLogger(name=__name__).debug
else:
- debug = lambda x: None
+ def debug(x): return None
# SCONS_CACHE_MSVC_CONFIG is public, and is documented.
@@ -58,6 +58,7 @@ CONFIG_CACHE = os.environ.get('SCONS_CACHE_MSVC_CONFIG')
if CONFIG_CACHE in ('1', 'true', 'True'):
CONFIG_CACHE = os.path.join(os.path.expanduser('~'), '.scons_msvc_cache')
+
def read_script_env_cache():
""" fetch cached msvc env vars if requested, else return empty dict """
envcache = {}
@@ -65,7 +66,7 @@ def read_script_env_cache():
try:
with open(CONFIG_CACHE, 'r') as f:
envcache = json.load(f)
- #TODO can use more specific FileNotFoundError when py2 dropped
+ # TODO can use more specific FileNotFoundError when py2 dropped
except IOError:
# don't fail if no cache file, just proceed without it
pass
@@ -88,6 +89,7 @@ def write_script_env_cache(cache):
_is_win64 = None
+
def is_win64():
"""Return true if running on windows 64 bits.
@@ -122,6 +124,7 @@ def is_win64():
def read_reg(value, hkroot=SCons.Util.HKEY_LOCAL_MACHINE):
return SCons.Util.RegGetValue(hkroot, value)[0]
+
def has_reg(value):
"""Return True if the given key exists in HKEY_LOCAL_MACHINE, False
otherwise."""
@@ -134,6 +137,7 @@ def has_reg(value):
# Functions for fetching environment variable settings from batch files.
+
def normalize_env(env, keys, force=False):
"""Given a dictionary representing a shell environment, add the variables
from os.environ needed for the processing of .bat files; the keys are
@@ -172,11 +176,12 @@ def normalize_env(env, keys, force=False):
if sys32_wbem_dir not in normenv['PATH']:
normenv['PATH'] = normenv['PATH'] + os.pathsep + sys32_wbem_dir
- debug("PATH: %s"%normenv['PATH'])
+ debug("PATH: %s" % normenv['PATH'])
return normenv
-def get_output(vcbat, args = None, env = None):
+
+def get_output(vcbat, args=None, env=None):
"""Parse the output of given bat file, with given args."""
if env is None:
@@ -242,7 +247,13 @@ def get_output(vcbat, args = None, env = None):
output = stdout.decode("mbcs")
return output
-KEEPLIST = ("INCLUDE", "LIB", "LIBPATH", "PATH", 'VSCMD_ARG_app_plat')
+
+KEEPLIST = ("INCLUDE", "LIB", "LIBPATH", "PATH", 'VSCMD_ARG_app_plat',
+ 'VCINSTALLDIR', # needed by clang -VS 2017 and newer
+ 'VCToolsInstallDir', # needed by clang - VS 2015 and older
+ )
+
+
def parse_output(output, keep=KEEPLIST):
"""
Parse output from running visual c++/studios vcvarsall.bat and running set