@@ -675,13 +675,13 @@ function set_build_options_for_host() {
675
675
# *NOTE* Currently we do not support testing LLVM via build-script. But in a
676
676
# future commit we will.
677
677
if [[ $( false_true " ${LLVM_INCLUDE_TESTS} " ) == " TRUE" ]]; then
678
- llvm_cmake_options+ =(
678
+ EXTRA_LLVM_CMAKE_OPTIONS =(
679
679
# Do not include LLVM tests.
680
680
-DLLVM_INCLUDE_TESTS:BOOL=NO
681
681
-DCLANG_INCLUDE_TESTS:BOOL=NO
682
682
)
683
683
684
- # Disable LLVM Tools that we do not use.
684
+ # Disable LLVM Tools that Swift does not use for testing .
685
685
LLVM_TOOLS_TO_DISABLE=(
686
686
BUGPOINT BUGPOINT_PASSES GOLD LLI LLVM_AS_FUZZER LLVM_C_TEST
687
687
LLVM_CXXDUMP LLVM_DIFF LLVM_DIS LLVM_DWP LLVM_EXTRACT LLVM_GO
@@ -690,21 +690,58 @@ function set_build_options_for_host() {
690
690
LLVM_STRESS LLVM_SYMBOLIZER MSBUILD OBJ2YAML OPT SANCOV SANSTATS
691
691
VERIFY_USELISTORDER XCODE_TOOLCHAIN YAML2OBJ
692
692
)
693
+
694
+ # Disable Clang Tools that Swift does not use for testing.
695
+ CLANG_TOOLS_TO_DISABLE=(
696
+ CLANG_CHECK DIAGTOOL SCAN_BUILD SCAN_VIEW CLANG_FORMAT
697
+ )
698
+
699
+ # If in addition we are asked to not generate targets for swift tests,
700
+ # then we can disable the building of even more of LLVM.
701
+ if [[ $( false_true " ${SWIFT_INCLUDE_TESTS} " ) == " TRUE" ]]; then
702
+ EXTRA_LLVM_CMAKE_OPTIONS+=(
703
+ # We do not need gtest/FileCheck and friends since we are not
704
+ # running any tests.
705
+ -DLLVM_INCLUDE_UTILS:BOOL=NO
706
+ )
707
+
708
+ # Disable the rest of the LLVM tools. We do not need any of them.
709
+ LLVM_TOOLS_TO_DISABLE+=(
710
+ DSYMUTIL LLC LLVM_AR LLVM_AS LLVM_BCANALYZER LLVM_COV
711
+ LLVM_DWARFDUMP LLVM_LINK LLVM_NM LLVM_OBJDUMP LLVM_PROFDATA
712
+ )
713
+
714
+ # Disable the rest of the Clang tools. We do not need them.
715
+ CLANG_TOOLS_TO_DISABLE+=(
716
+ ARCMT_TEST C_ARCMT_TEST C_INDEX_TEST
717
+ )
718
+
719
+ # If in addition, we are not building compiler-rt, then we do not
720
+ # even need to build clang.
721
+ #
722
+ # *NOTE* This may change once we start building the standard library
723
+ # *with the just built clang.
724
+ if [[ $( true_false " ${SKIP_BUILD_COMPILER_RT} " ) == " TRUE" ]]; then
725
+ CLANG_TOOLS_TO_DISABLE+=(
726
+ DRIVER
727
+ )
728
+ fi
729
+ fi
730
+
731
+ for arg in " ${EXTRA_LLVM_CMAKE_ARGS[@]} " ; do
732
+ llvm_cmake_options+=( " ${arg} " )
733
+ done
693
734
for tool in " ${LLVM_TOOLS_TO_DISABLE[@]} " ; do
694
735
llvm_cmake_options+=(
695
736
-DLLVM_TOOL_${tool} _BUILD:BOOL=NO
696
737
)
697
738
done
698
739
699
- # Disable Clang Tools that we do not use.
700
- CLANG_TOOLS_TO_DISABLE=(
701
- CLANG_CHECK DIAGTOOL SCAN_BUILD SCAN_VIEW CLANG_FORMAT
702
- )
703
740
for tool in " ${CLANG_TOOLS_TO_DISABLE[@]} " ; do
704
741
llvm_cmake_options+=(
705
742
-DCLANG_TOOL_${tool} _BUILD:BOOL=NO
706
743
)
707
- done
744
+ done
708
745
fi
709
746
710
747
if [[ " ${llvm_target_arch} " ]] ; then
0 commit comments