Skip to content

[distcc-support] Improve consistency, refactoring #5375

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 20, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -1496,6 +1496,24 @@ eval COMMON_CMAKE_OPTIONS=(${COMMON_CMAKE_OPTIONS})
eval EXTRA_CMAKE_OPTIONS=(${EXTRA_CMAKE_OPTIONS})
eval BUILD_ARGS=(${BUILD_ARGS})

if [[ -n "${DISTCC}" ]]; then
if [[ "$(uname -s)" == "Darwin" ]] ; then
# These are normally deduced by CMake, but when the compiler is set to
# distcc which is installed elsewhere, we need to set them explicitly.
COMMON_CMAKE_OPTIONS=(
"${COMMON_CMAKE_OPTIONS[@]}" "-DCMAKE_AR=$(xcrun_find_tool ar)"
"-DCMAKE_LINKER=$(xcrun_find_tool ld)"
"-DCMAKE_NM=$(xcrun_find_tool nm)"
"-DCMAKE_OBJDUMP=$(xcrun_find_tool objdump)"
"-DCMAKE_RANLIB=$(xcrun_find_tool ranlib)"
"-DCMAKE_STRIP=$(xcrun_find_tool strip)"
)
fi
fi

eval CMAKE_BUILD=("${DISTCC_PUMP}" "${CMAKE}" "--build")


if [[ "${CMAKE_GENERATOR}" == "Xcode" ]]; then
BUILD_TARGET_FLAG="-target"
fi
Expand Down Expand Up @@ -2485,10 +2503,10 @@ for host in "${ALL_HOSTS[@]}"; do

# Xcode can't restart itself if it turns out we need to reconfigure.
# Do an advance build to handle that.
call ${DISTCC_PUMP} "${CMAKE}" --build "${build_dir}" $(cmake_config_opt ${product})
call "${CMAKE_BUILD[@]}" "${build_dir}" $(cmake_config_opt ${product})
fi

call ${DISTCC_PUMP} "${CMAKE}" --build "${build_dir}" $(cmake_config_opt ${product}) -- "${BUILD_ARGS[@]}" ${build_targets[@]}
call "${CMAKE_BUILD[@]}" "${build_dir}" $(cmake_config_opt ${product}) -- "${BUILD_ARGS[@]}" ${build_targets[@]}
fi
done
done
Expand Down Expand Up @@ -2728,11 +2746,11 @@ for host in "${ALL_HOSTS[@]}"; do

trap "tests_busted ${product} ''" ERR
build_dir=$(build_directory ${host} ${product})
build_cmd=("${CMAKE}" --build "${build_dir}" $(cmake_config_opt ${product}) -- "${BUILD_ARGS[@]}")
build_cmd=("${CMAKE_BUILD[@]}" "${build_dir}" $(cmake_config_opt ${product}) -- "${BUILD_ARGS[@]}")

if [[ "${executable_target}" != "" ]]; then
echo "--- Building tests for ${product} ---"
call ${DISTCC_PUMP} "${build_cmd[@]}" ${BUILD_TARGET_FLAG} "${executable_target}"
call "${build_cmd[@]}" ${BUILD_TARGET_FLAG} "${executable_target}"
fi

# We can only run tests built for the host machine, because
Expand Down Expand Up @@ -3014,7 +3032,7 @@ for host in "${ALL_HOSTS[@]}"; do
echo "--- Installing ${product} ---"
build_dir=$(build_directory ${host} ${product})

call env DESTDIR="${host_install_destdir}" "${CMAKE}" --build "${build_dir}" -- ${INSTALL_TARGETS}
call env DESTDIR="${host_install_destdir}" "${CMAKE_BUILD[@]}" "${build_dir}" -- ${INSTALL_TARGETS}
done

if [[ "${DARWIN_INSTALL_EXTRACT_SYMBOLS}" ]] && [[ $(host_has_darwin_symbols ${host}) ]]; then
Expand Down