handle precompiled headers with `ccache` / fixed caching in some docker builds (#4505)

* CI-unixish.yml: handle precompiled headers with `ccache`

* actually support `ccache` in CMake < 3.17

* CI-unixish-docker.yml: split CMake build and test execution into separate steps

* findDependencies.cmake: only print message about macthcompiler being disabled when it is actually used

* CI-unixish-docker.yml: added missing `ccache` CMake options
This commit is contained in:
Oliver Stöneberg 2022-09-26 18:21:43 +02:00 committed by GitHub
parent 64f3f85804
commit fd9d05300e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 6 deletions

View File

@ -52,7 +52,7 @@ jobs:
key: ${{ github.workflow }}-${{ matrix.image }}
# tests require CMake 3.9 - no ccache available
- name: Test CMake build (no tests)
- name: CMake build (no tests)
if: matrix.image == 'ubuntu:14.04'
run: |
mkdir cmake.output
@ -61,7 +61,7 @@ jobs:
cmake --build . -- -j$(nproc)
# tests require CMake 3.9 - ccache available
- name: Test CMake build (no tests)
- name: CMake build (no tests)
if: matrix.image == 'centos:7' || matrix.image == 'ubuntu:16.04'
run: |
mkdir cmake.output
@ -69,13 +69,18 @@ jobs:
cmake -G "Unix Makefiles" -DHAVE_RULES=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ..
cmake --build . -- -j$(nproc)
- name: Test CMake build
- name: CMake build
if: matrix.image != 'centos:7' && matrix.image != 'ubuntu:14.04' && matrix.image != 'ubuntu:16.04'
run: |
mkdir cmake.output
cd cmake.output
cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On ..
cmake --build . --target check -- -j$(nproc)
cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ..
cmake --build . -- -j$(nproc)
- name: Run CMake test
if: matrix.image != 'centos:7' && matrix.image != 'ubuntu:14.04' && matrix.image != 'ubuntu:16.04'
run: |
cmake --build cmake.output --target check -- -j$(nproc)
build_make:

View File

@ -17,6 +17,10 @@ jobs:
runs-on: ${{ matrix.os }}
env:
# TODO: files are cached but are still cache misses on platforms other than ubuntu-22.04
CCACHE_SLOPPINESS: pch_defines,time_macros
steps:
- uses: actions/checkout@v2
@ -62,6 +66,10 @@ jobs:
runs-on: ${{ matrix.os }}
env:
# TODO: files are cached but are still cache misses
CCACHE_SLOPPINESS: pch_defines,time_macros
steps:
- uses: actions/checkout@v2

View File

@ -5,6 +5,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(GNUInstallDirs)
include(cmake/ccache.cmake)
include(cmake/compilerCheck.cmake)
include(cmake/versions.cmake)
include(cmake/options.cmake)

7
cmake/ccache.cmake Normal file
View File

@ -0,0 +1,7 @@
if (CMAKE_VERSION VERSION_LESS "3.17")
if (CMAKE_CXX_COMPILER_LAUNCHER)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CMAKE_CXX_COMPILER_LAUNCHER}")
elseif (CMAKE_C_COMPILER_LAUNCHER)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CMAKE_C_COMPILER_LAUNCHER}")
endif()
endif()

View File

@ -48,7 +48,7 @@ find_package(PythonInterp 3 QUIET)
if (NOT PYTHONINTERP_FOUND)
set(PYTHONINTERP_FOUND "")
find_package(PythonInterp 2.7 QUIET)
if (NOT PYTHONINTERP_FOUND)
if (NOT PYTHONINTERP_FOUND AND NOT USE_MATCHCOMPILER_OPT STREQUAL "Off")
message(WARNING "No python interpreter found. Therefore, the match compiler is switched off.")
set(USE_MATCHCOMPILER_OPT "Off")
endif()