diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 143c88f8ea..b085f9c8f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,20 +64,10 @@ jobs: sudo ln -s /usr/lib/x86_64-linux-gnu/libscalapack-openmpi.so /usr/lib/x86_64-linux-gnu/libscalapack.so echo "MPIEXEC=/usr/bin/mpiexec" >> $GITHUB_ENV - - name: Prepare ccache timestamp - id: ccache_cache_timestamp - shell: cmake -P {0} - run: | - string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) - message("::set-output name=timestamp::${current_date}") - - - name: Setup ccache cache files - uses: actions/cache@v1.1.0 + - name: Setup ccache + uses: hendrikmuhs/ccache-action@v1.2 with: - path: ${{github.workspace}}/build/.ccache - key: ${{ matrix.config.name }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} - restore-keys: | - ${{ matrix.config.name }}-ccache- + key: ccache-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.task_backend }} - name: "Configure build: ${{ env.BUILD_CONFIG }}" shell: bash diff --git a/CMakeLists.txt b/CMakeLists.txt index 101b1b0d16..a130211293 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -299,6 +299,16 @@ include_directories(${PROJECT_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/src) ########################## add_custom_target(External-tiledarray) +# ccache is an optional dep but must be found first so that the rest of dependencies can use it +find_program(CCACHE ccache) +if(CCACHE) + mark_as_advanced(CCACHE) + message (STATUS "Found ccache: ${CCACHE}") + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE}" CACHE STRING "Compiler launcher to use for compiling C++") + set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE}" CACHE STRING "Compiler launcher to use for compiling C") + set(CMAKE_CUDA_COMPILER_LAUNCHER "${CCACHE}" CACHE STRING "Compiler launcher to use for compiling CUDA") +endif(CCACHE) + # required deps: # 1. derive runtime (CUDA/HIP/...) first since others may depend on it if(ENABLE_CUDA) @@ -336,15 +346,7 @@ if(ENABLE_SCALAPACK) include(external/scalapackpp.cmake) endif() -# optional deps: -# 1. ccache -find_program(CCACHE ccache) -if(CCACHE) - mark_as_advanced(CCACHE) - message (STATUS "Found ccache: ${CCACHE}") - set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE}" CACHE STRING "Compiler launcher to use for compiling C++") - set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE}" CACHE STRING "Compiler launcher to use for compiling C") -endif(CCACHE) +# other optional deps: # 2. TTG # N.B. make sure TA configures MADNESS correctly #if (TA_TTG) diff --git a/external/librett.cmake b/external/librett.cmake index afebabb486..5eca3314ce 100644 --- a/external/librett.cmake +++ b/external/librett.cmake @@ -98,6 +98,13 @@ else() "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") endif(CMAKE_TOOLCHAIN_FILE) + foreach(lang C CXX CUDA) + if (DEFINED CMAKE_${lang}_COMPILER_LAUNCHER) + list(APPEND LIBRETT_CMAKE_ARGS + "-DCMAKE_${lang}_COMPILER_LAUNCHER=${CMAKE_${lang}_COMPILER_LAUNCHER}") + endif() + endforeach() + if (BUILD_SHARED_LIBS) set(LIBRETT_DEFAULT_LIBRARY_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}) else(BUILD_SHARED_LIBS) diff --git a/external/umpire.cmake b/external/umpire.cmake index 37152e98d2..c6abe2dfd0 100644 --- a/external/umpire.cmake +++ b/external/umpire.cmake @@ -152,6 +152,13 @@ else() ) endif(CMAKE_TOOLCHAIN_FILE) + foreach(lang C CXX CUDA) + if (DEFINED CMAKE_${lang}_COMPILER_LAUNCHER) + list(APPEND UMPIRE_CMAKE_ARGS + "-DCMAKE_${lang}_COMPILER_LAUNCHER=${CMAKE_${lang}_COMPILER_LAUNCHER}") + endif() + endforeach() + if (BUILD_SHARED_LIBS) set(UMPIRE_DEFAULT_LIBRARY_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}) else(BUILD_SHARED_LIBS)