From 41c293361953f177263a70b0d41b48eba111fe09 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Fri, 2 Feb 2024 00:11:31 -0500 Subject: [PATCH] sccache for windows builds (#3385) * cache vcpkg on windows ci * try sccache as variant * missed a spot * see if we're checking here * does this do it? * trying to make minimal changes and have this work * hopefully these z7s do something * we were almost at the max already bump to double * Apply suggestions from code review * sc * latest from soh-macready branch of otrexporter --- .github/workflows/generate-builds.yml | 4 +++- CMake/DefaultCXX.cmake | 6 +++++- CMakeLists.txt | 14 +++++++++----- OTRExporter | 2 +- soh/CMake/DefaultCXX.cmake | 6 +++++- 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/.github/workflows/generate-builds.yml b/.github/workflows/generate-builds.yml index 99fa2d3bd..674f742d2 100644 --- a/.github/workflows/generate-builds.yml +++ b/.github/workflows/generate-builds.yml @@ -273,6 +273,8 @@ jobs: uses: hendrikmuhs/ccache-action@v1.2 with: key: ${{ runner.os }}-ccache + variant: sccache + max-size: "1G" - name: vcpkg uses: johnwason/vcpkg-action@v5 with: @@ -286,7 +288,7 @@ jobs: VCPKG_ROOT: ${{github.workspace}}/vcpkg run: | set $env:PATH="$env:USERPROFILE/.cargo/bin;$env:PATH" - cmake -S . -B build-windows -G Ninja -DCMAKE_MAKE_PROGRAM=ninja -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBUILD_REMOTE_CONTROL=1 + cmake -S . -B build-windows -G Ninja -DCMAKE_MAKE_PROGRAM=ninja -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DBUILD_REMOTE_CONTROL=1 cmake --build build-windows --config Release --parallel 10 mkdir soh-windows diff --git a/CMake/DefaultCXX.cmake b/CMake/DefaultCXX.cmake index e87721511..6ed89d9e0 100644 --- a/CMake/DefaultCXX.cmake +++ b/CMake/DefaultCXX.cmake @@ -8,5 +8,9 @@ if(MSVC) set_target_properties("${PROPS_TARGET}" PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") set_config_specific_property("DEFAULT_CXX_EXCEPTION_HANDLING" "/EHsc") - set_config_specific_property("DEFAULT_CXX_DEBUG_INFORMATION_FORMAT" "/Zi") + if (CMAKE_C_COMPILER_LAUNCHER MATCHES "ccache|sccache") + set_config_specific_property("DEFAULT_CXX_DEBUG_INFORMATION_FORMAT" "/Z7") + else() + set_config_specific_property("DEFAULT_CXX_DEBUG_INFORMATION_FORMAT" "/Zi") + endif() endif() \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 0cabaef20..9669c5f0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,13 +14,17 @@ add_compile_options($<$:/MP>) add_compile_options($<$:/utf-8>) if (CMAKE_SYSTEM_NAME STREQUAL "Windows") -include(CMake/automate-vcpkg.cmake) + include(CMake/automate-vcpkg.cmake) -set(VCPKG_TRIPLET x64-windows-static) -set(VCPKG_TARGET_TRIPLET x64-windows-static) + set(VCPKG_TRIPLET x64-windows-static) + set(VCPKG_TARGET_TRIPLET x64-windows-static) -vcpkg_bootstrap() -vcpkg_install_packages(zlib bzip2 libpng sdl2 sdl2-net glew glfw3) + vcpkg_bootstrap() + vcpkg_install_packages(zlib bzip2 libpng sdl2 sdl2-net glew glfw3) + + if (CMAKE_C_COMPILER_LAUNCHER MATCHES "ccache|sccache") + set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT Embedded) + endif() endif() ################################################################################ diff --git a/OTRExporter b/OTRExporter index 04b85b95f..44adc47b4 160000 --- a/OTRExporter +++ b/OTRExporter @@ -1 +1 @@ -Subproject commit 04b85b95fab07a394b62dcd28a502a3040f08e0c +Subproject commit 44adc47b4da529e72d968b14cab94aefd8260f22 diff --git a/soh/CMake/DefaultCXX.cmake b/soh/CMake/DefaultCXX.cmake index 7b052b9cc..032326a13 100644 --- a/soh/CMake/DefaultCXX.cmake +++ b/soh/CMake/DefaultCXX.cmake @@ -8,5 +8,9 @@ if(MSVC) set_target_properties("${PROPS_TARGET}" PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") set_config_specific_property("DEFAULT_CXX_EXCEPTION_HANDLING" "/EHsc") - set_config_specific_property("DEFAULT_CXX_DEBUG_INFORMATION_FORMAT" "/Zi") + if (CMAKE_C_COMPILER_LAUNCHER MATCHES "ccache|sccache") + set_config_specific_property("DEFAULT_CXX_DEBUG_INFORMATION_FORMAT" "/Z7") + else() + set_config_specific_property("DEFAULT_CXX_DEBUG_INFORMATION_FORMAT" "/Zi") + endif() endif() \ No newline at end of file