diff --git a/ci/scripts/python_build.sh b/ci/scripts/python_build.sh index f8c1af3982d..50fb37db1f1 100755 --- a/ci/scripts/python_build.sh +++ b/ci/scripts/python_build.sh @@ -89,7 +89,7 @@ cp -aL "${source_dir}" "${python_build_dir}" pushd "${python_build_dir}" # - Cannot use build isolation as we want to use specific dependency versions # (e.g. Numpy, Pandas) on some CI jobs. -${PYTHON:-python} -m pip install --no-deps --no-build-isolation -vv -C cmake.build-type="${CMAKE_BUILD_TYPE:-Debug}" . +time ${PYTHON:-python} -m pip install --no-deps --no-build-isolation -vv -C cmake.build-type="${CMAKE_BUILD_TYPE:-Debug}" . popd if [ "${BUILD_DOCS_PYTHON}" == "ON" ]; then diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 4bea6e7d8d4..8eae91e0ed1 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -130,11 +130,18 @@ if(CCACHE_FOUND AND NOT CMAKE_C_COMPILER_LAUNCHER AND NOT CMAKE_CXX_COMPILER_LAUNCHER) message(STATUS "Using ccache: ${CCACHE_FOUND}") - set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_FOUND}) - set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_FOUND}) - # ARROW-3985: let ccache preserve C++ comments, because some of them may be - # meaningful to the compiler - set(ENV{CCACHE_COMMENTS} "1") + # 1. Let ccache preserve C++ comments, because some of them may be + # meaningful to the compiler (ARROW-3985) + # 2. Set ccache base_dir to the build output directory as it is typically + # a temporary directory, and would otherwise fail caching because of + # using different paths everytime. + # Also, we use `cmake -E env` to set environment variables as the + # `ccache option=value ...` form of passing configuration options + # is not supported by ccache < 4.8. + set(ccache_command ${CMAKE_COMMAND} -E env CCACHE_COMMENTS=1 + CCACHE_BASEDIR=${CMAKE_BINARY_DIR} -- ${CCACHE_FOUND}) + set(CMAKE_C_COMPILER_LAUNCHER ${ccache_command}) + set(CMAKE_CXX_COMPILER_LAUNCHER ${ccache_command}) endif() #