diff --git a/.gitea/workflows/build_pc.yml b/.gitea/workflows/build_pc.yml index fb286c3..b2411d3 100644 --- a/.gitea/workflows/build_pc.yml +++ b/.gitea/workflows/build_pc.yml @@ -34,8 +34,23 @@ jobs: run: > sudo apt update && sudo apt install -y extra-cmake-modules libwayland-dev libxkbcommon-dev xorg-dev libarchive-dev libassimp-dev ninja-build glslang-tools glslang-dev unzip zip libcurl4-openssl-dev libfreetype-dev libjpeg-turbo8-dev nasm && sudo wget https://sourceforge.net/projects/bin2c/files/1.1/bin2c-1.1.zip && sudo unzip bin2c-1.1.zip && cd bin2c && sudo gcc -o bin2c bin2c.c && sudo mv bin2c /usr/bin + + - name: Get cmake checks from cache + uses: actions/cache/restore@v3 + id: cache + with: + path: | + ${{github.workspace}}/build/cmake_checks_cache.txt + ${{github.workspace}}/build/CMakeFiles/**/CMake*.cmake + key: ${{runner.os}}-cmakeChecks + - name: Configure CMake - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DDEPENDENCY_MIRROR_FILE="${{github.workspace}}/.gitea/workflows/DependencyMirrors.txt" + run: | + if [ "${{ steps.cache.outputs.cache-hit }}" != "true" ]; then + cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DDEPENDENCY_MIRROR_FILE="${{github.workspace}}/.gitea/workflows/DependencyMirrors.txt" + else + cmake -B ${{github.workspace}}/build -C ${{github.workspace}}/build/cmake_checks_cache.txt -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DDEPENDENCY_MIRROR_FILE="${{github.workspace}}/.gitea/workflows/DependencyMirrors.txt" + fi - name: Build run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - name: Test @@ -66,6 +81,16 @@ jobs: if-no-files-found: error retention-days: 30 overwrite: true + - name: Cache cmake checks + if: steps.cache.outputs.cache-hit != 'true' + id: cache-cmake-checks + uses: actions/cache/save@v3 + with: + path: | + ${{github.workspace}}/build/cmake_checks_cache.txt + ${{github.workspace}}/build/CMakeFiles/**/CMake*.cmake + key: ${{runner.os}}-cmakeChecks + diff --git a/3rdParty/CMakeLists.txt b/3rdParty/CMakeLists.txt index f76cbe2..374149e 100644 --- a/3rdParty/CMakeLists.txt +++ b/3rdParty/CMakeLists.txt @@ -32,6 +32,7 @@ add_subdirectory(boost) add_subdirectory(units) add_subdirectory(libjpeg-turbo) add_subdirectory(msdf) +add_subdirectory(cmake-checks-cache) if (NOT IOS AND ENABLE_CURL) add_subdirectory(curl) endif() diff --git a/3rdParty/cmake-checks-cache/CMakeLists.txt b/3rdParty/cmake-checks-cache/CMakeLists.txt new file mode 100644 index 0000000..5c01267 --- /dev/null +++ b/3rdParty/cmake-checks-cache/CMakeLists.txt @@ -0,0 +1,14 @@ +include (FetchContent) + +if(NOT DEFINED CMAKE_CHECKS_REPO) + set(CMAKE_CHECKS_REPO https://github.com/cristianadam/cmake-checks-cache.git) +endif () + +FetchContent_Declare( + cmake-checks-cache + GIT_REPOSITORY ${CMAKE_CHECKS_REPO} + GIT_TAG master + GIT_SHALLOW TRUE +) + +FetchContent_MakeAvailable(cmake-checks-cache) \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index b26832d..e044b9b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,9 @@ if(LINUX) find_package(ECM REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) endif() -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/functions") +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_BINARY_DIR}/_deps/cmake-checks-cache-src/CMakeChecksCache" + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/functions") include(VarsFromFile) include(SetCompilerSettings)