@@ -123,6 +123,7 @@ KNOWN_SETTINGS=(
123123 skip-build-android " " " set to skip building Swift stdlibs for Android"
124124 skip-build-lldb " " " set to skip building LLDB"
125125 skip-build-llbuild " " " set to skip building llbuild"
126+ skip-build-libcxx " " " set to skip building libcxx"
126127 skip-build-swiftpm " " " set to skip building swiftpm"
127128 skip-build-swiftsyntax " " " set to skip building swiftSyntax"
128129 skip-build-skstresstester " " " set to skip building the SourceKit stress tester"
@@ -199,6 +200,7 @@ KNOWN_SETTINGS=(
199200 install-skstresstester " " " whether to install the SourceKit stress tester"
200201 install-xctest " " " whether to install xctest"
201202 install-foundation " " " whether to install foundation"
203+ install-libcxx " " " whether to install libc++"
202204 install-libdispatch " " " whether to install libdispatch"
203205 install-libicu " " " whether to install libicu"
204206 install-playgroundsupport " " " whether to install PlaygroundSupport"
@@ -255,6 +257,7 @@ KNOWN_SETTINGS=(
255257 swiftpm-cmake-options " " " CMake options used for all swiftpm targets"
256258 xctest-cmake-options " " " CMake options used for all xctest targets"
257259 playgroundsupport-cmake-options " " " CMake options used for all playgroundsupport targets"
260+ libcxx-cmake-options " " " CMake options used for all libcxx targets"
258261 # TODO: Remove this some time later.
259262 user-config-args " " " **Renamed to --extra-cmake-options**: User-supplied arguments to cmake when used to do configuration."
260263 only-execute " all" " Only execute the named action (see implementation)"
@@ -1180,6 +1183,7 @@ XCTEST_SOURCE_DIR="${WORKSPACE}/swift-corelibs-xctest"
11801183FOUNDATION_SOURCE_DIR=" ${WORKSPACE} /swift-corelibs-foundation"
11811184LIBDISPATCH_SOURCE_DIR=" ${WORKSPACE} /swift-corelibs-libdispatch"
11821185LIBICU_SOURCE_DIR=" ${WORKSPACE} /icu"
1186+ LIBCXX_SOURCE_DIR=" ${WORKSPACE} /libcxx"
11831187PLAYGROUNDSUPPORT_SOURCE_DIR=" ${WORKSPACE} /swift-xcode-playground-support"
11841188
11851189if [[ ! " ${SKIP_BUILD_PLAYGROUNDSUPPORT} " && ! -d ${PLAYGROUNDSUPPORT_SOURCE_DIR} ]]; then
@@ -1200,6 +1204,12 @@ if [ ! -d "${CLANG_SOURCE_DIR}" ] ; then
12001204 make_relative_symlink " ${WORKSPACE} /clang" " ${CLANG_SOURCE_DIR} "
12011205fi
12021206
1207+ # Don't symlink clang-tools-extra into the tree as the 'clang' symlink prevents
1208+ # make_relative_symlink from working correctly.
1209+ if [ -e " ${WORKSPACE} /clang-tools-extra" ] ; then
1210+ CLANG_TOOLS_EXTRA_SOURCE_DIR=" ${WORKSPACE} /clang-tools-extra"
1211+ fi
1212+
12031213# Symlink compiler-rt into the llvm tree, if it exists.
12041214COMPILER_RT_SOURCE_DIR=" ${LLVM_SOURCE_DIR} /projects/compiler-rt"
12051215if [ -e " ${WORKSPACE} /compiler-rt" ] ; then
@@ -1209,6 +1219,9 @@ if [ -e "${WORKSPACE}/compiler-rt" ] ; then
12091219fi
12101220
12111221PRODUCTS=(cmark llvm)
1222+ if [[ ! " ${SKIP_BUILD_LIBCXX} " ]] ; then
1223+ PRODUCTS=(" ${PRODUCTS[@]} " libcxx)
1224+ fi
12121225if [[ ! " ${SKIP_BUILD_LIBICU} " ]] ; then
12131226 PRODUCTS=(" ${PRODUCTS[@]} " libicu)
12141227fi
@@ -1545,6 +1558,10 @@ function build_directory_bin() {
15451558 llvm)
15461559 echo " ${root} /${LLVM_BUILD_TYPE} /bin"
15471560 ;;
1561+ libcxx)
1562+ # Reuse LLVM's build type.
1563+ echo " ${root} /${LLVM_BUILD_TYPE} /bin"
1564+ ;;
15481565 swift)
15491566 echo " ${root} /${SWIFT_BUILD_TYPE} /bin"
15501567 ;;
@@ -1687,6 +1704,10 @@ function cmake_config_opt() {
16871704 llvm)
16881705 echo " --config ${LLVM_BUILD_TYPE} "
16891706 ;;
1707+ libcxx)
1708+ # Reuse LLVM's build type.
1709+ echo " --config ${LLVM_BUILD_TYPE} "
1710+ ;;
16901711 swift)
16911712 echo " --config ${SWIFT_BUILD_TYPE} "
16921713 ;;
@@ -2097,6 +2118,12 @@ for host in "${ALL_HOSTS[@]}"; do
20972118 " ${llvm_cmake_options[@]} "
20982119 )
20992120
2121+ if [[ ! -z " ${CLANG_TOOLS_EXTRA_SOURCE_DIR} " ]] ; then
2122+ cmake_options+=(
2123+ -DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=" ${CLANG_TOOLS_EXTRA_SOURCE_DIR} "
2124+ )
2125+ fi
2126+
21002127 if [[ " ${BUILD_TOOLCHAIN_ONLY} " ]]; then
21012128 cmake_options+=(
21022129 -DLLVM_BUILD_TOOLS=NO
@@ -2136,6 +2163,22 @@ for host in "${ALL_HOSTS[@]}"; do
21362163
21372164 ;;
21382165
2166+ libcxx)
2167+ build_targets=(cxx-headers)
2168+ cmake_options=(
2169+ " ${cmake_options[@]} "
2170+ -DCMAKE_C_FLAGS=" $( llvm_c_flags ${host} ) "
2171+ -DCMAKE_CXX_FLAGS=" $( llvm_c_flags ${host} ) "
2172+ -DCMAKE_C_FLAGS_RELWITHDEBINFO=" -O2 -DNDEBUG"
2173+ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO=" -O2 -DNDEBUG"
2174+ -DCMAKE_BUILD_TYPE:STRING=" ${LLVM_BUILD_TYPE} "
2175+ -DLLVM_INCLUDE_DOCS:BOOL=TRUE
2176+ -DLLVM_CONFIG_PATH=" $( build_directory " ${LOCAL_HOST} " llvm) /bin/llvm-config"
2177+ " ${llvm_cmake_options[@]} "
2178+ )
2179+
2180+ ;;
2181+
21392182 swift)
21402183
21412184 if [[ ! " ${SKIP_BUILD_ANDROID} " ]]; then
@@ -2934,6 +2977,9 @@ for host in "${ALL_HOSTS[@]}"; do
29342977 llvm)
29352978 continue # We don't test LLVM
29362979 ;;
2980+ libcxx)
2981+ continue # We don't test libc++
2982+ ;;
29372983 swift)
29382984 executable_target=
29392985 results_targets=
@@ -3397,6 +3443,12 @@ for host in "${ALL_HOSTS[@]}"; do
33973443 fi
33983444 INSTALL_TARGETS=install-$( echo ${LLVM_INSTALL_COMPONENTS} | sed -E ' s/;/ install-/g' )
33993445 ;;
3446+ libcxx)
3447+ if [[ -z " ${INSTALL_LIBCXX} " ]] ; then
3448+ continue
3449+ fi
3450+ INSTALL_TARGETS=install-cxx-headers
3451+ ;;
34003452 swift)
34013453 if [[ -z " ${INSTALL_SWIFT} " ]] ; then
34023454 continue
0 commit comments