Only set CCACHE_WRAPPER_PATH in the build scripts if it is not already passed in.

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/29002

Test Plan: Imported from OSS

Differential Revision: D18277225

Pulled By: AshkanAliabadi

fbshipit-source-id: eb70607790754cd5d214133967404242c05dd5d5
This commit is contained in:
Ashkan Aliabadi 2019-11-01 18:37:29 -07:00 committed by Facebook Github Bot
parent e8e7d93293
commit 1345dabb1d
2 changed files with 7 additions and 3 deletions

View file

@ -26,7 +26,7 @@ if [ -n "${BUILD_PYTORCH_MOBILE:-}" ]; then
if [ "${ENABLE_BITCODE:-}" == '1' ]; then
CMAKE_ARGS+=("-DCMAKE_C_FLAGS=-fembed-bitcode")
CMAKE_ARGS+=("-DCMAKE_CXX_FLAGS=-fembed-bitcode")
fi
fi
else
# Build protobuf from third_party so we have a host protoc binary.
echo "Building protoc"
@ -45,7 +45,9 @@ fi
# CMAKE_CXX_COMPILER to /usr/bin/g++. In order to use ccache (if it is available) we
# must override these variables via CMake arguments.
CMAKE_ARGS+=("-DCMAKE_TOOLCHAIN_FILE=$CAFFE2_ROOT/cmake/iOS.cmake")
CCACHE_WRAPPER_PATH=/usr/local/opt/ccache/libexec
if [ -n "${CCACHE_WRAPPER_PATH:-}"]; then
CCACHE_WRAPPER_PATH=/usr/local/opt/ccache/libexec
fi
if [ -d "$CCACHE_WRAPPER_PATH" ]; then
CMAKE_ARGS+=("-DCMAKE_C_COMPILER=$CCACHE_WRAPPER_PATH/gcc")
CMAKE_ARGS+=("-DCMAKE_CXX_COMPILER=$CCACHE_WRAPPER_PATH/g++")

View file

@ -18,7 +18,9 @@ fi
# Use ccache if available (this path is where Homebrew installs ccache symlinks)
if [ "$(uname)" == 'Darwin' ]; then
CCACHE_WRAPPER_PATH=/usr/local/opt/ccache/libexec
if [ -n "${CCACHE_WRAPPER_PATH:-}"]; then
CCACHE_WRAPPER_PATH=/usr/local/opt/ccache/libexec
fi
if [ -d "$CCACHE_WRAPPER_PATH" ]; then
CMAKE_ARGS+=("-DCMAKE_C_COMPILER=$CCACHE_WRAPPER_PATH/gcc")
CMAKE_ARGS+=("-DCMAKE_CXX_COMPILER=$CCACHE_WRAPPER_PATH/g++")