Skip to content

Commit 218799a

Browse files
committed
[build-script] build LLVMTestingSupport only if target is generated
Otherwise the build will fail if we pass `--no-llvm-include-tests` or we set directly `LLVM_INCLUDE_TESTS` directly to `FALSE`/`OFF` Addresses rdar://153562845
1 parent 64404f5 commit 218799a

File tree

1 file changed

+7
-4
lines changed
  • utils/swift_build_support/swift_build_support/products

1 file changed

+7
-4
lines changed

utils/swift_build_support/swift_build_support/products/llvm.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,7 @@ def build(self, host_target):
271271
'llvm-size'
272272
])
273273
else:
274-
# We build LLVMTestingSupport unconditionally
275-
# to support scenarios where tests are run
276-
# outside of `build-script` (e.g. with `run-test`)
277-
build_targets = ['all', 'LLVMTestingSupport']
274+
build_targets = ['all']
278275

279276
if self.args.llvm_ninja_targets_for_cross_compile_hosts and \
280277
self.is_cross_compile_target(host_target):
@@ -422,6 +419,12 @@ def build(self, host_target):
422419
llvm_cmake_options.define('LLVM_INCLUDE_TESTS', 'NO')
423420
llvm_cmake_options.define('CLANG_INCLUDE_TESTS', 'NO')
424421

422+
if ("-DLLVM_INCLUDE_TESTS=NO" not in llvm_cmake_options
423+
and "-DLLVM_INCLUDE_TESTS:BOOL=FALSE" not in llvm_cmake_options):
424+
# This supports scenarios where tests are run
425+
# outside of `build-script` (e.g. with `run-test`)
426+
build_targets.append('LLVMTestingSupport')
427+
425428
build_root = os.path.dirname(self.build_dir)
426429
host_machine_target = targets.StdlibDeploymentTarget.host_target().name
427430
host_build_dir = os.path.join(build_root, 'llvm-{}'.format(

0 commit comments

Comments
 (0)