Commit d4885a61 authored by hans@chromium.org's avatar hans@chromium.org

Win-Clang update.py: implement more principled search for CMake

BUG=82385
NOTRY=true

Review URL: https://codereview.chromium.org/440163002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287576 0039d316-1c4b-4281-b951-d872f2087c98
parent 09bedd48
...@@ -99,6 +99,26 @@ def Checkout(name, url, dir): ...@@ -99,6 +99,26 @@ def Checkout(name, url, dir):
url + '@' + LLVM_WIN_REVISION, dir], tries=2) 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 vs_version = None
def GetVSVersion(): def GetVSVersion():
global vs_version global vs_version
...@@ -118,6 +138,7 @@ def UpdateClang(): ...@@ -118,6 +138,7 @@ def UpdateClang():
print 'Already up to date.' print 'Already up to date.'
return 0 return 0
AddCMakeToPath()
ClobberChromiumBuildFiles() ClobberChromiumBuildFiles()
# Reset the stamp file in case the build is unsuccessful. # Reset the stamp file in case the build is unsuccessful.
...@@ -131,10 +152,6 @@ def UpdateClang(): ...@@ -131,10 +152,6 @@ def UpdateClang():
os.makedirs(LLVM_BUILD_DIR) os.makedirs(LLVM_BUILD_DIR)
os.chdir(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') + RunCommand(GetVSVersion().SetupScript('x64') +
['&&', 'cmake', '-GNinja', '-DCMAKE_BUILD_TYPE=Release', ['&&', 'cmake', '-GNinja', '-DCMAKE_BUILD_TYPE=Release',
'-DLLVM_ENABLE_ASSERTIONS=ON', LLVM_DIR]) '-DLLVM_ENABLE_ASSERTIONS=ON', LLVM_DIR])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment