Skip to content

Commit 3661a0e

Browse files
committed
Merge pull request #2690 from gottesmm/specify_compiler_rt_uses_llvm_external_project_mechanism
[build-script] When building compiler-rt, follow LLVM's lead by speci…
2 parents d8a3920 + 3350551 commit 3661a0e

File tree

1 file changed

+26
-20
lines changed

1 file changed

+26
-20
lines changed

utils/build-script-impl

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ function set_deployment_target_based_options() {
527527
-DLLVM_HOST_TRIPLE:STRING="${llvm_host_triple}"
528528
-DLLVM_ENABLE_LIBCXX:BOOL=TRUE
529529
-DLLVM_TOOL_COMPILER_RT_BUILD:BOOL="$(false_true ${SKIP_COMPILER_RT})"
530+
-DLLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL="$(false_true ${SKIP_COMPILER_RT})"
530531
-DCOMPILER_RT_ENABLE_IOS:BOOL=FALSE
531532
-DCOMPILER_RT_ENABLE_WATCHOS:BOOL=FALSE
532533
-DCOMPILER_RT_ENABLE_TVOS:BOOL=FALSE
@@ -1894,6 +1895,31 @@ for deployment_target in "${HOST_TARGET}" "${CROSS_COMPILE_TOOLS_DEPLOYMENT_TARG
18941895
{ set +x; } 2>/dev/null
18951896
fi
18961897

1898+
# When we are building LLVM create symlinks to the c++ headers. We need
1899+
# to do this before building LLVM since compiler-rt depends on being
1900+
# built with the just built clang compiler. These are normally put into
1901+
# place during the cmake step of LLVM's build when libcxx is in
1902+
# tree... but we are not building llvm with libcxx in tree when we build
1903+
# swift. So we need to do configure's work here.
1904+
if [[ "${product}" == "llvm" ]]; then
1905+
# Find the location of the c++ header dir.
1906+
if [[ "$(uname -s)" == "Darwin" ]] ; then
1907+
HOST_CXX_DIR=$(dirname ${HOST_CXX})
1908+
HOST_CXX_HEADERS_DIR="$HOST_CXX_DIR/../../usr/include/c++"
1909+
else # Linux
1910+
HOST_CXX_HEADERS_DIR="/usr/include/c++"
1911+
fi
1912+
1913+
# Find the path in which the local clang build is expecting to find
1914+
# the c++ header files.
1915+
BUILT_CXX_INCLUDE_DIR="$llvm_build_dir/include"
1916+
1917+
echo "symlinking the system headers ($HOST_CXX_HEADERS_DIR) into the local clang build directory ($BUILT_CXX_INCLUDE_DIR)."
1918+
set -x
1919+
ln -s -f "$HOST_CXX_HEADERS_DIR" "$BUILT_CXX_INCLUDE_DIR"
1920+
{ set +x; } 2>/dev/null
1921+
fi
1922+
18971923
# Build.
18981924
if [[ ! "${skip_build}" ]]; then
18991925
if [[ "${CMAKE_GENERATOR}" == "Xcode" ]] ; then
@@ -1913,26 +1939,6 @@ for deployment_target in "${HOST_TARGET}" "${CROSS_COMPILE_TOOLS_DEPLOYMENT_TARG
19131939
${DISTCC_PUMP} "${CMAKE}" --build "${build_dir}" $(cmake_config_opt ${product}) -- "${BUILD_ARGS[@]}" ${build_targets[@]}
19141940
{ set +x; } 2>/dev/null
19151941
fi
1916-
1917-
# When we are building LLVM create symlinks to the c++ headers.
1918-
if [[ "${product}" == "llvm" ]]; then
1919-
# Find the location of the c++ header dir.
1920-
if [[ "$(uname -s)" == "Darwin" ]] ; then
1921-
HOST_CXX_DIR=$(dirname ${HOST_CXX})
1922-
HOST_CXX_HEADERS_DIR="$HOST_CXX_DIR/../../usr/include/c++"
1923-
else # Linux
1924-
HOST_CXX_HEADERS_DIR="/usr/include/c++"
1925-
fi
1926-
1927-
# Find the path in which the local clang build is expecting to find
1928-
# the c++ header files.
1929-
BUILT_CXX_INCLUDE_DIR="$llvm_build_dir/include"
1930-
1931-
echo "symlinking the system headers ($HOST_CXX_HEADERS_DIR) into the local clang build directory ($BUILT_CXX_INCLUDE_DIR)."
1932-
set -x
1933-
ln -s -f "$HOST_CXX_HEADERS_DIR" "$BUILT_CXX_INCLUDE_DIR"
1934-
{ set +x; } 2>/dev/null
1935-
fi
19361942
done
19371943
done
19381944
# END OF BUILD PHASE

0 commit comments

Comments
 (0)