summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2018-10-29 16:13:32 -0600
committerMats Wichmann <mats@linux.com>2018-11-18 14:35:06 -0700
commit04b49967dbcd9930087471a1771939b93bfb4e38 (patch)
tree2bec71cb6aa72ca5dadedf0b7ae0ec79e24c4aaf
parente8d4f018e5cb5dd0dd420f356b10b1d4788313e9 (diff)
downloadscons-git-04b49967dbcd9930087471a1771939b93bfb4e38.tar.gz
For PR#3222: improve ms build finding
Broaden the search to also include Build Tools (the compiler without the whole Visual Studio works). Also in the initial search to see if a suite is valid or not, don't just look for a couple of locations within a given path, do a search. Signed-off-by: Mats Wichmann <mats@linux.com>
-rw-r--r--src/CHANGES.txt3
-rw-r--r--src/engine/SCons/Tool/MSCommon/vc.py23
2 files changed, 22 insertions, 4 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 97c3455e0..a85f37c8a 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -176,6 +176,9 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE
- Update (pep8) configure-cache script, add a --show option.
- Fix for a couple of "what if tool not found" exceptions in framework.
- Add Textfile/Substfile to default environment. (issue #3147)
+ - Improve finding of Microsoft compiler: add a 'products' wildcard
+ in case Build Tools only is installed; search for cl.exe in located
+ path instead of just looking for a couple of built-in locations.
From Bernhard M. Wiedemann:
- Update SCons' internal scons build logic to allow overriding build date
diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py
index 32ee96f39..c4b977307 100644
--- a/src/engine/SCons/Tool/MSCommon/vc.py
+++ b/src/engine/SCons/Tool/MSCommon/vc.py
@@ -241,7 +241,7 @@ def find_vc_pdir_vswhere(msvc_version):
'Installer',
'vswhere.exe'
)
- vswhere_cmd = [vswhere_path, '-version', msvc_version, '-property', 'installationPath']
+ vswhere_cmd = [vswhere_path, '-products', '*', '-version', msvc_version, '-property', 'installationPath']
if os.path.exists(vswhere_path):
sp = subprocess.Popen(vswhere_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -355,15 +355,30 @@ def cached_get_installed_vcs():
def get_installed_vcs():
installed_versions = []
+
+ def clfind(name, path):
+ '''Search for a filename in a given path.
+
+ Look for a filename (normally cl.exe) underneath a path. No need
+ to return the path found, someplace else will dig deeper, this is
+ just used to confirm a given suite contains that file. Note it
+ does not promise the cl.exe is the combination of host/target we
+ actually need, that is also done elsewhere.
+ '''
+ for root, _, files in os.walk(path):
+ if name in files:
+ debug('get_installed_vcs cl.exe found %s' % os.path.join(root, name))
+ return True
+ return False
+
for ver in _VCVER:
debug('trying to find VC %s' % ver)
try:
VC_DIR = find_vc_pdir(ver)
if VC_DIR:
debug('found VC %s' % ver)
- # check to see if the x86 or 64 bit compiler is in the bin dir
- if (os.path.exists(os.path.join(VC_DIR, r'bin\cl.exe'))
- or os.path.exists(os.path.join(VC_DIR, r'bin\amd64\cl.exe'))):
+ # now make sure there's a cl.exe in that path
+ if clfind('cl.exe', VC_DIR):
installed_versions.append(ver)
else:
debug('find_vc_pdir no cl.exe found %s' % ver)