[CMake] Add support for specifying arguments to the bootstrap build.

This adds support for three types of argument specifications for bootstrap builds:

(1) Arguments prefixed with BOOTSTRAP_* will be passed through with the leading BOOTSTRAP_ removed.
(2) CLANG_BOOTSTRAP_PASSTHROUGH can specify a list of variables to be passed through as they are set.
(3) BOOTSTRAP_DEFAULT_PASSTHROUGH is a list of some default passthrough variables that are always passed through. Those variables include the version string and should only specify variables that are always expected to be the same between the stage1 and stage2

llvm-svn: 253721
This commit is contained in:
Chris Bieneman 2015-11-20 22:09:06 +00:00
parent 5b390b53c6
commit 8638714dc7
1 changed files with 31 additions and 0 deletions

View File

@ -652,6 +652,36 @@ if (CLANG_ENABLE_BOOTSTRAP)
set(verbose -DCMAKE_VERBOSE_MAKEFILE=On)
endif()
set(BOOTSTRAP_DEFAULT_PASSTHROUGH
PACKAGE_VERSION
LLVM_VERSION_MAJOR
LLVM_VERSION_MINOR
LLVM_VERSION_PATCH
LLVM_VERSION_SUFFIX
CLANG_REPOSITORY_STRING
CMAKE_MAKE_PROGRAM)
# Find all variables that start with BOOTSTRAP_ and populate a variable with
# them.
get_cmake_property(variableNames VARIABLES)
foreach(varaibleName ${variableNames})
if(varaibleName MATCHES "^BOOTSTRAP_")
string(SUBSTRING ${varaibleName} 10 -1 varName)
string(REPLACE ";" "\;" value "${${varaibleName}}")
list(APPEND PASSTHROUGH_VARIABLES
-D${varName}=${value})
endif()
endforeach()
# Populate the passthrough variables
foreach(varaibleName ${CLANG_BOOTSTRAP_PASSTHROUGH} ${BOOTSTRAP_DEFAULT_PASSTHROUGH})
if(${varaibleName})
string(REPLACE ";" "\;" value ${${varaibleName}})
list(APPEND PASSTHROUGH_VARIABLES
-D${varaibleName}=${value})
endif()
endforeach()
ExternalProject_Add(bootstrap
DEPENDS clang ${LTO_DEP}
PREFIX bootstrap
@ -664,6 +694,7 @@ if (CLANG_ENABLE_BOOTSTRAP)
# seem to work, so instead I'm passing this through
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
${CLANG_BOOTSTRAP_CMAKE_ARGS}
${PASSTHROUGH_VARIABLES}
-DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++
-DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
-DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang