Re-implements Ninja and CCache for Windows Builds (#2051)

* Keeps default compiler flags.

* Updates github actions to use ninja and ccache for windows builds.

* Fixes ghactions to use MSVC.

* Removes commented out CMake code.
This commit is contained in:
Christopher Leggett 2022-11-29 22:33:43 -05:00 committed by GitHub
parent 06df45efc7
commit 806b9dc84b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 34 deletions

View File

@ -225,15 +225,24 @@ jobs:
readme.txt readme.txt
build-windows: build-windows:
needs: extract-assets needs: extract-assets
runs-on: [self-hosted, Windows, x64] runs-on: windows-latest
steps: steps:
- name: Install dependencies
run: |
choco install ninja
Remove-Item -Path "C:\ProgramData\Chocolatey\bin\ccache.exe" -Force
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
submodules: true submodules: true
- name: ccache
uses: dcvz/ccache-action@27b9f33213c0079872f064f6b6ba0233dfa16ba2
with:
key: ${{ runner.os }}-ccache
- name: Restore assets - name: Restore assets
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
name: assets name: assets
- uses: ilammy/msvc-dev-cmd@v1
- name: Setup 7-Zip - name: Setup 7-Zip
run: | run: |
"C:\Program Files\7-Zip" >> $env:GITHUB_PATH "C:\Program Files\7-Zip" >> $env:GITHUB_PATH
@ -241,7 +250,8 @@ jobs:
run: | run: |
7z x assets.zip -aoa 7z x assets.zip -aoa
cmake -S . -B build-windows -G "Visual Studio 17 2022" -T v142 -A x64 -DCMAKE_BUILD_TYPE:STRING=Release 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
cmake --build build-windows --target OTRGui --config Release --parallel 10 cmake --build build-windows --target OTRGui --config Release --parallel 10
cmake --build build-windows --config Release --parallel 10 cmake --build build-windows --config Release --parallel 10
cd build-windows cd build-windows

View File

@ -63,38 +63,6 @@ if(NOT CMAKE_BUILD_TYPE )
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build." FORCE) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build." FORCE)
endif() endif()
################################################################################
# Global compiler options
################################################################################
if(MSVC)
# remove default flags provided with CMake for MSVC
set(CMAKE_C_FLAGS "")
set(CMAKE_C_FLAGS_DEBUG "")
set(CMAKE_C_FLAGS_RELEASE "")
set(CMAKE_CXX_FLAGS "")
set(CMAKE_CXX_FLAGS_DEBUG "")
set(CMAKE_CXX_FLAGS_RELEASE "")
endif()
################################################################################
# Global linker options
################################################################################
if(MSVC)
# remove default flags provided with CMake for MSVC
set(CMAKE_EXE_LINKER_FLAGS "")
set(CMAKE_MODULE_LINKER_FLAGS "")
set(CMAKE_SHARED_LINKER_FLAGS "")
set(CMAKE_STATIC_LINKER_FLAGS "")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_STATIC_LINKER_FLAGS_DEBUG "${CMAKE_STATIC_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS}")
endif()
################################################################################ ################################################################################
# Common utils # Common utils
################################################################################ ################################################################################