Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: tools/clang/scripts/update.py

Issue 440163002: Win-Clang update.py: implement more principled search for CMake (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address thakis's comments Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/clang/scripts/update.py
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py
index e4ae1cee1368269d592b4cf3568a4ae39ae4231e..fa9812264a81fdbd057d578b8fb9453e350abca8 100755
--- a/tools/clang/scripts/update.py
+++ b/tools/clang/scripts/update.py
@@ -99,6 +99,26 @@ def Checkout(name, url, dir):
url + '@' + LLVM_WIN_REVISION, dir], tries=2)
+def AddCMakeToPath():
+ """Look for CMake and add it to PATH if it's not there already."""
+ try:
+ # First check if cmake is already on PATH.
+ subprocess.call(['cmake', '--version'])
+ return
+ except OSError as e:
+ if e.errno != os.errno.ENOENT:
+ raise
+
+ cmake_locations = ['C:\\Program Files (x86)\\CMake\\bin',
+ 'C:\\Program Files (x86)\\CMake 2.8\\bin']
+ for d in cmake_locations:
+ if os.path.isdir(d):
+ os.environ['PATH'] = os.environ.get('PATH', '') + os.pathsep + d
+ return
+ print 'Failed to find CMake!'
+ sys.exit(1)
+
+
vs_version = None
def GetVSVersion():
global vs_version
@@ -118,6 +138,7 @@ def UpdateClang():
print 'Already up to date.'
return 0
+ AddCMakeToPath()
ClobberChromiumBuildFiles()
# Reset the stamp file in case the build is unsuccessful.
@@ -131,10 +152,6 @@ def UpdateClang():
os.makedirs(LLVM_BUILD_DIR)
os.chdir(LLVM_BUILD_DIR)
- if not re.search(r'cmake', os.environ['PATH'], flags=re.IGNORECASE):
- # If CMake is not on the path, try looking in a standard location.
- os.environ['PATH'] += os.pathsep + 'C:\\Program Files (x86)\\CMake 2.8\\bin'
-
RunCommand(GetVSVersion().SetupScript('x64') +
['&&', 'cmake', '-GNinja', '-DCMAKE_BUILD_TYPE=Release',
'-DLLVM_ENABLE_ASSERTIONS=ON', LLVM_DIR])
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698