Skip to content

Commit 1eae53d

Browse files
committed
build-llvm.py: Stop build extra files more
1 parent 8fa67eb commit 1eae53d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

build-llvm.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ def fetch_llvm_binutils(root_folder, update, ref, shallow=False):
422422
if update:
423423
utils.print_header("Updating LLVM")
424424
subprocess.run(["git", "fetch", "origin"], check=True, cwd=cwd)
425+
subprocess.run(["git", "reset", "--hard"], check=True, cwd=cwd)
425426
subprocess.run(["git", "checkout", ref], check=True, cwd=cwd)
426427
local_ref = None
427428
try:
@@ -449,6 +450,10 @@ def fetch_llvm_binutils(root_folder, update, ref, shallow=False):
449450
],
450451
check=True)
451452
subprocess.run(["git", "checkout", ref], check=True, cwd=cwd)
453+
454+
subprocess.run(
455+
["sed", "-i", "/add_subdirectory(test)/d;/add_subdirectory(docs)/d;/add_subdirectory(tools)/d", "%s"
456+
% p.joinpath("polly").joinpath("CMakeLists.txt").as_posix()], check=True, cwd=cwd)
452457

453458
# One might wonder why we are downloading binutils in an LLVM build script :)
454459
# We need it for the LLVMgold plugin, which can be used for LTO with ld.gold,
@@ -570,6 +575,9 @@ def base_cmake_defines(dirs):
570575
# Don't include example build targets to save on cmake cycles
571576
'LLVM_INCLUDE_EXAMPLES': 'OFF',
572577

578+
'LLVM_INCLUDE_TESTS': 'OFF',
579+
'LLVM_INCLUDE_UTILS': 'OFF',
580+
'LLVM_INCLUDE_BENCHMARKS': 'OFF',
573581
}
574582
# yapf: enable
575583

@@ -705,8 +713,6 @@ def stage_specific_cmake_defines(args, dirs, stage):
705713
defines['CMAKE_BUILD_TYPE'] = 'Release'
706714
defines['LLVM_ENABLE_BACKTRACES'] = 'OFF'
707715
defines['LLVM_ENABLE_WARNINGS'] = 'OFF'
708-
defines['LLVM_INCLUDE_TESTS'] = 'OFF'
709-
defines['LLVM_INCLUDE_UTILS'] = 'OFF'
710716
else:
711717
# https://llvm.org/docs/CMake.html#frequently-used-cmake-variables
712718
defines['CMAKE_BUILD_TYPE'] = args.build_type

0 commit comments

Comments
 (0)