[zorg] r231716 - Add 'vs' parameter to Clang CMake builder to indicate Windows
Reid Kleckner
reid at kleckner.net
Mon Mar 9 15:30:25 PDT 2015
Author: rnk
Date: Mon Mar 9 17:30:25 2015
New Revision: 231716
URL: http://llvm.org/viewvc/llvm-project?rev=231716&view=rev
Log:
Add 'vs' parameter to Clang CMake builder to indicate Windows
Port the builder steps to Windows, and enable windows-gcebot1. This code
has been tested locally and should work.
Reviewers: gkistanova
Differential Revision: http://reviews.llvm.org/D8130
Modified:
zorg/trunk/buildbot/osuosl/master/config/builders.py
zorg/trunk/zorg/buildbot/builders/ClangBuilder.py
Modified: zorg/trunk/buildbot/osuosl/master/config/builders.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/osuosl/master/config/builders.py?rev=231716&r1=231715&r2=231716&view=diff
==============================================================================
--- zorg/trunk/buildbot/osuosl/master/config/builders.py (original)
+++ zorg/trunk/buildbot/osuosl/master/config/builders.py Mon Mar 9 17:30:25 2015
@@ -316,18 +316,21 @@ def _get_clang_builders():
stage1_config='Release+Asserts',
stage2_config='Release+Asserts')},
-# # This will ultimately be a self-host bot, even though the config does
-# # not reflect that today.
-# {'name': 'clang-x86-win2008-selfhost',
-# 'slavenames': ['windows-gcebot1'],
-# 'builddir': 'clang-x86-win2008-selfhost',
-# 'factory' : ClangBuilder.getClangCMakeBuildFactory(
-# triple='i686-pc-windows-msvc',
-# clean=False,
-# checkout_compiler_rt=False,
-# testStage1=True,
-# stage1_config='Release',
-# extra_cmake_args=["-DLLVM_ENABLE_ASSERTIONS=ON"])},
+ # This will ultimately be a self-host bot, even though the config does
+ # not reflect that today.
+ {'name': 'clang-x86-win2008-selfhost',
+ 'slavenames': ['windows-gcebot1'],
+ 'builddir': 'clang-x86-win2008-selfhost',
+ 'factory' : ClangBuilder.getClangCMakeBuildFactory(
+ clean=False,
+ vs='%VS120COMNTOOLS%',
+ vs_target_arch='x86',
+ checkout_compiler_rt=False,
+ testStage1=False,
+ useTwoStage=True,
+ stage1_config='Release',
+ stage2_config='Release',
+ extra_cmake_args=["-DLLVM_ENABLE_ASSERTIONS=ON"])},
{'name' : "clang-ppc64-elf-linux",
'slavenames' :["chinook-clangslave1"],
Modified: zorg/trunk/zorg/buildbot/builders/ClangBuilder.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/ClangBuilder.py?rev=231716&r1=231715&r2=231716&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/builders/ClangBuilder.py (original)
+++ zorg/trunk/zorg/buildbot/builders/ClangBuilder.py Mon Mar 9 17:30:25 2015
@@ -2,7 +2,7 @@ import buildbot
import buildbot.process.factory
import os
-from buildbot.process.properties import WithProperties
+from buildbot.process.properties import WithProperties, Property
from buildbot.steps.shell import Configure, ShellCommand, SetProperty
from buildbot.steps.shell import WarningCountingShellCommand
from buildbot.steps.source import SVN
@@ -433,13 +433,41 @@ def getClangBuildFactory(
return f
-# CMake Linux builds
+def addSVNUpdateSteps(f, checkout_clang_tools_extra=True, checkout_compiler_rt=True):
+ # We *must* checkout at least Clang+LLVM
+ f.addStep(SVN(name='svn-llvm',
+ mode='update', baseURL='http://llvm.org/svn/llvm-project/llvm/',
+ defaultBranch='trunk',
+ workdir='llvm'))
+ f.addStep(SVN(name='svn-clang',
+ mode='update', baseURL='http://llvm.org/svn/llvm-project/cfe/',
+ defaultBranch='trunk',
+ workdir='llvm/tools/clang'))
+
+ # Extra stuff that will be built/tested
+ if checkout_clang_tools_extra:
+ f.addStep(SVN(name='svn-clang-tools-extra',
+ mode='update', baseURL='http://llvm.org/svn/llvm-project/clang-tools-extra/',
+ defaultBranch='trunk',
+ workdir='llvm/tools/clang/tools/extra'))
+ if checkout_compiler_rt:
+ f.addStep(SVN(name='svn-compiler-rt',
+ mode='update', baseURL='http://llvm.org/svn/llvm-project/compiler-rt/',
+ defaultBranch='trunk',
+ workdir='llvm/projects/compiler-rt'))
+
+
def getClangCMakeBuildFactory(
clean=True,
test=True,
cmake='cmake',
jobs=None,
+ # VS tools environment variable if using MSVC. For example,
+ # %VS120COMNTOOLS% selects the 2013 toolchain.
+ vs=None,
+ vs_target_arch='x86',
+
# Multi-stage compilation
useTwoStage=False,
testStage1=True,
@@ -457,27 +485,8 @@ def getClangCMakeBuildFactory(
############# PREPARING
f = buildbot.process.factory.BuildFactory()
- # We *must* checkout at least Clang+LLVM
- f.addStep(SVN(name='svn-llvm',
- mode='update', baseURL='http://llvm.org/svn/llvm-project/llvm/',
- defaultBranch='trunk',
- workdir='llvm'))
- f.addStep(SVN(name='svn-clang',
- mode='update', baseURL='http://llvm.org/svn/llvm-project/cfe/',
- defaultBranch='trunk',
- workdir='llvm/tools/clang'))
-
- # Extra stuff that will be built/tested
- if checkout_clang_tools_extra:
- f.addStep(SVN(name='svn-clang-tools-extra',
- mode='update', baseURL='http://llvm.org/svn/llvm-project/clang-tools-extra/',
- defaultBranch='trunk',
- workdir='llvm/tools/clang/tools/extra'))
- if checkout_compiler_rt:
- f.addStep(SVN(name='svn-compiler-rt',
- mode='update', baseURL='http://llvm.org/svn/llvm-project/compiler-rt/',
- defaultBranch='trunk',
- workdir='llvm/projects/compiler-rt'))
+ addSVNUpdateSteps(f, checkout_clang_tools_extra=checkout_clang_tools_extra,
+ checkout_compiler_rt=checkout_compiler_rt)
# If jobs not defined, Ninja will choose a suitable value
jobs_cmd=[]
@@ -490,12 +499,26 @@ def getClangCMakeBuildFactory(
ninja_cmd=['ninja'] + jobs_cmd
ninja_install_cmd=['ninja', 'install'] + jobs_cmd
ninja_check_cmd=['ninja', 'check-all'] + jobs_cmd
+ check_build_cmd = ["sh", "-c",
+ "test -e build.ninja && echo OK || echo Missing"]
+ if vs:
+ check_build_cmd = ["cmd", "/c", "if exist build.ninja (echo OK) " +
+ " else (echo Missing & exit 1)"]
# Global configurations
stage1_build='stage1'
stage1_install='stage1.install'
stage2_build='stage2'
+ # Set up VS environment, if appropriate.
+ if vs:
+ f.addStep(SetProperty(
+ command=builders_util.getVisualStudioEnvironment(vs, vs_target_arch),
+ extract_fn=builders_util.extractSlaveEnvironment))
+ assert not env, "Can't have custom builder env vars with VS"
+ env = Property('slave_env')
+
+
############# CLEANING
if clean:
f.addStep(ShellCommand(name='clean stage 1',
@@ -508,8 +531,7 @@ def getClangCMakeBuildFactory(
else:
f.addStep(SetProperty(name="check ninja files 1",
workdir=stage1_build,
- command=["sh", "-c",
- "test -e build.ninja && echo OK || echo Missing"],
+ command=check_build_cmd,
flunkOnFailure=False,
property="exists_ninja_1"))
@@ -564,33 +586,46 @@ def getClangCMakeBuildFactory(
else:
f.addStep(SetProperty(name="check ninja files 2",
workdir=stage2_build,
- command=["sh", "-c",
- "test -e build.ninja && echo OK || echo Missing"],
+ command=check_build_cmd,
flunkOnFailure=False,
property="exists_ninja_2"))
-
+ # Compute the cmake define flag to set the C and C++ compiler to clang. Use
+ # clang-cl if we used MSVC for stage1.
+ if not vs:
+ cc = 'clang'
+ cxx = 'clang++'
+ else:
+ cc = 'clang-cl.exe'
+ cxx = 'clang-cl.exe'
+
+ # Set the compiler using the CC and CXX environment variables to work around
+ # backslash string escaping bugs somewhere between buildbot and cmake. The
+ # env.exe helper is required to run the tests, so hopefully it's already on
+ # PATH.
+ cmake_cmd2 = ['env',
+ WithProperties('CC=%(workdir)s/'+stage1_install+'/bin/'+cc),
+ WithProperties('CXX=%(workdir)s/'+stage1_install+'/bin/'+cxx),
+ cmake, "-G", "Ninja", "../llvm",
+ "-DCMAKE_BUILD_TYPE="+stage2_config,
+ "-DLLVM_ENABLE_ASSERTIONS=True",
+ "-DLLVM_LIT_ARGS="+lit_args] + extra_cmake_args
+
f.addStep(ShellCommand(name='cmake stage 2',
- command=[cmake, "-G", "Ninja", "../llvm",
- "-DCMAKE_BUILD_TYPE="+stage2_config,
- "-DLLVM_ENABLE_ASSERTIONS=True",
- WithProperties("-DCMAKE_C_COMPILER=%(workdir)s/"+stage1_install+"/bin/clang"),
- WithProperties("-DCMAKE_CXX_COMPILER=%(workdir)s/"+stage1_install+"/bin/clang++"),
- "-DLLVM_LIT_ARGS="+lit_args]
- + extra_cmake_args,
+ command=cmake_cmd2,
haltOnFailure=True,
description='cmake stage 2',
workdir=stage2_build,
doStepIf=lambda step: step.build.getProperty("exists_ninja_2") != "OK",
env=env))
-
+
f.addStep(WarningCountingShellCommand(name='build stage 2',
command=ninja_cmd,
haltOnFailure=True,
description='ninja all',
workdir=stage2_build,
env=env))
-
+
if test:
f.addStep(lit_test_command.LitTestCommand(name='ninja check 2',
command=ninja_check_cmd,
More information about the llvm-commits
mailing list