diff options
author | Diana Picus <diana.picus@linaro.org> | 2018-02-15 05:29:46 +0100 |
---|---|---|
committer | Diana Picus <diana.picus@linaro.org> | 2018-02-21 13:47:51 +0000 |
commit | 6cdb516102c258904c250090b801776c2dffb919 (patch) | |
tree | a7881c35ea2ec3acc8afcf70c8fbb408a3b62020 /scripts | |
parent | 2c58083715559f6245a1a7406a3426d94110e28a (diff) |
build-and-test: Make it possible to customize stage 2
Same possibilities as stage 1: subprojects, CMake definitions and build
flags.
Change-Id: Ib10be5d2f7687040979c79113e7eeb0af5903df1
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/llvm.py | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/scripts/llvm.py b/scripts/llvm.py index 53ffd89..bdeae85 100644 --- a/scripts/llvm.py +++ b/scripts/llvm.py @@ -200,6 +200,9 @@ def build_and_test(args): stage1BuildFlags = args.stage1BuildFlags stage2BuildDir = args.stage2 + stage2Subprojs = args.stage2Subprojs + stage2Defs = cmake_flags_from_args(args.stage2Defs) + stage2BuildFlags = args.stage2BuildFlags enableTestSuite = args.enableTestSuite sandboxDir = args.sandbox @@ -229,6 +232,13 @@ def build_and_test(args): testedBuildDir = stage1BuildDir if stage2BuildDir is not None: + if stage2Subprojs: + toAdd = list(set(stage2Subprojs) - set(stage1Subprojs)) + toRemove = list(set(stage1Subprojs) - set(stage2Subprojs)) + sourceConfig.update( + subproj_to_repo_map(toAdd, proj, llvmRepos, args.dry), + toRemove) + if not dryRun and not os.path.exists(stage2BuildDir): os.makedirs(stage2BuildDir) @@ -238,11 +248,11 @@ def build_and_test(args): # TODO: Make sure clang is actually built in this config (preferably # before reaching this point) buildConfig2.cmake( - [ + stage2Defs + [ "-DCMAKE_C_COMPILER={}/bin/clang".format(stage1BuildDir), "-DCMAKE_CXX_COMPILER={}/bin/clang++".format(stage1BuildDir)], "Ninja") - buildConfig2.build() + buildConfig2.build(stage2BuildFlags) testedBuildDir = stage2BuildDir if enableTestSuite: @@ -518,6 +528,36 @@ buildAndTest.add_argument( dest='stage2', help="Path to the build directory for stage 2.") buildAndTest.add_argument( + '--stage2-subproject', + dest='stage2Subprojs', + metavar='SUBPROJ', + choices=valid_subprojects, + default=[], + action='append', + help="Subprojects to enable for stage 2 of the build. Can be passed " + "multiple times. Valid values for the subproject are: {}. " + "If this is a 2-stage build, the same subprojects will be used for " + "both stages unless other subprojects are explicitly requested for " + "stage 2.".format(" ".join(valid_subprojects))) +buildAndTest.add_argument( + '--stage2-cmake-def', + dest='stage2Defs', + metavar='VAR=VALUE', + default=[], + action='append', + help="Additional CMake definitions for stage 2, e.g. " + "CMAKE_BUILD_TYPE=Release. Can be passed multiple times. " + "The -D is added automatically.") +buildAndTest.add_argument( + '--stage2-build-flag', + dest='stage2BuildFlags', + metavar='FLAG', + default=[], + action='append', + help="Additional flags for the stage 2 build command (e.g. targets to " + "build). Can be passed multiple times. If your flag starts with " + "a '-', use '--stage2-build-flag=-FLAG' to pass it.") +buildAndTest.add_argument( "--enable-test-suite", dest='enableTestSuite', action='store_true', |