Skip to content

Commit

Permalink
windows_cc_configure.bzl: Check default VC installation directories
Browse files Browse the repository at this point in the history
See bazelbuild#5254 (comment)

RELNOTES: None
PiperOrigin-RevId: 203273587
  • Loading branch information
meteorcloudy authored and George Gensure committed Aug 2, 2018
1 parent f3c8227 commit 61bd9ce
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tools/cpp/windows_cc_configure.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,20 @@ def find_vc_path(repository_ctx):
if line.startswith(version) and line.find("REG_SZ") != -1:
vc_dir = line[line.find("REG_SZ") + len("REG_SZ"):].strip() + suffix

# 4. Check default directories for VC installation
auto_configure_warning("Looking for default Visual C++ installation directory")
program_files_dir = get_env_var(repository_ctx, "PROGRAMFILES(X86)", default = "C:\\Program Files (x86)", enable_warning = True)
for path in [
"Microsoft Visual Studio\\2017\\BuildTools\\VC",
"Microsoft Visual Studio\\2017\\Community\\VC",
"Microsoft Visual Studio\\2017\\Enterprise\\VC",
"Microsoft Visual Studio 14.0\\VC",
]:
path = program_files_dir + "\\" + path
if repository_ctx.path(path).exists:
vc_dir = path
break

if not vc_dir:
return None
auto_configure_warning("Visual C++ build tools found at %s" % vc_dir)
Expand Down

0 comments on commit 61bd9ce

Please sign in to comment.