mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-07 05:53:59 -07:00
use only ninja, remove sccache
This commit is contained in:
parent
61e16679f1
commit
ac2533ca60
3 changed files with 34 additions and 51 deletions
|
|
@ -12,7 +12,7 @@
|
||||||
# --ccache [<size>] uses ccache and shows stats, optionally provide size
|
# --ccache [<size>] uses ccache and shows stats, optionally provide size
|
||||||
# --dir <dir> sets the name of the build dir, default is "build"
|
# --dir <dir> sets the name of the build dir, default is "build"
|
||||||
# --target-macos-version <version> sets the min os version - only used for macOS builds
|
# --target-macos-version <version> sets the min os version - only used for macOS builds
|
||||||
# uses env: BUILDTYPE MAKE_INSTALL MAKE_PACKAGE PACKAGE_TYPE PACKAGE_SUFFIX MAKE_SERVER MAKE_NO_CLIENT MAKE_TEST USE_CCACHE CCACHE_SIZE CCACHE_VARIANT BUILD_DIR CMAKE_GENERATOR CMAKE_GENERATOR_PLATFORM TARGET_MACOS_VERSION
|
# uses env: BUILDTYPE MAKE_INSTALL MAKE_PACKAGE PACKAGE_TYPE PACKAGE_SUFFIX MAKE_SERVER MAKE_NO_CLIENT MAKE_TEST USE_CCACHE CCACHE_SIZE BUILD_DIR CMAKE_GENERATOR CMAKE_GENERATOR_PLATFORM TARGET_MACOS_VERSION
|
||||||
# (correspond to args: --debug/--release --install --package <package type> --suffix <suffix> --server --test --ccache <ccache_size> --dir <dir>)
|
# (correspond to args: --debug/--release --install --package <package type> --suffix <suffix> --server --test --ccache <ccache_size> --dir <dir>)
|
||||||
# exitcode: 1 for failure, 3 for invalid arguments
|
# exitcode: 1 for failure, 3 for invalid arguments
|
||||||
|
|
||||||
|
|
@ -128,15 +128,10 @@ if [[ $MAKE_TEST ]]; then
|
||||||
flags+=("-DTEST=1")
|
flags+=("-DTEST=1")
|
||||||
fi
|
fi
|
||||||
if [[ $USE_CCACHE ]]; then
|
if [[ $USE_CCACHE ]]; then
|
||||||
if [[ $CCACHE_VARIANT ]]; then
|
|
||||||
# COMPILER_LAUNCHER only; USE_CCACHE=OFF prevents RULE_LAUNCH_COMPILE (avoids Strawberry ccache on Windows)
|
|
||||||
flags+=("-DUSE_CCACHE=OFF" "-DCMAKE_C_COMPILER_LAUNCHER=$CCACHE_VARIANT" "-DCMAKE_CXX_COMPILER_LAUNCHER=$CCACHE_VARIANT")
|
|
||||||
else
|
|
||||||
flags+=("-DUSE_CCACHE=1")
|
flags+=("-DUSE_CCACHE=1")
|
||||||
fi
|
if [[ $CCACHE_SIZE ]]; then
|
||||||
if [[ $CCACHE_SIZE && "$CCACHE_VARIANT" != "sccache" ]]; then
|
|
||||||
# note, this setting persists after running the script
|
# note, this setting persists after running the script
|
||||||
"${CCACHE_VARIANT:-ccache}" --max-size "$CCACHE_SIZE"
|
ccache --max-size "$CCACHE_SIZE"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ $PACKAGE_TYPE ]]; then
|
if [[ $PACKAGE_TYPE ]]; then
|
||||||
|
|
@ -158,16 +153,12 @@ fi
|
||||||
buildflags=(--config "$BUILDTYPE")
|
buildflags=(--config "$BUILDTYPE")
|
||||||
|
|
||||||
function ccachestatsverbose() {
|
function ccachestatsverbose() {
|
||||||
local launcher="${CCACHE_VARIANT:-ccache}"
|
# note, verbose only works on newer ccache, discard the error
|
||||||
if [[ $launcher == "sccache" ]]; then
|
|
||||||
sccache -s
|
|
||||||
else
|
|
||||||
local got
|
local got
|
||||||
if got="$("$launcher" --show-stats --verbose 2>/dev/null)"; then
|
if got="$(ccache --show-stats --verbose 2>/dev/null)"; then
|
||||||
echo "$got"
|
echo "$got"
|
||||||
else
|
else
|
||||||
"$launcher" --show-stats
|
ccache --show-stats
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
48
.github/workflows/desktop-build.yml
vendored
48
.github/workflows/desktop-build.yml
vendored
|
|
@ -268,7 +268,7 @@ jobs:
|
||||||
qt_arch: clang_64
|
qt_arch: clang_64
|
||||||
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
||||||
cmake_generator: Ninja
|
cmake_generator: Ninja
|
||||||
ccache_variant: ccache
|
use_ccache: 1
|
||||||
|
|
||||||
- os: macOS
|
- os: macOS
|
||||||
target: 14
|
target: 14
|
||||||
|
|
@ -282,7 +282,7 @@ jobs:
|
||||||
qt_arch: clang_64
|
qt_arch: clang_64
|
||||||
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
||||||
cmake_generator: Ninja
|
cmake_generator: Ninja
|
||||||
ccache_variant: ccache
|
use_ccache: 1
|
||||||
|
|
||||||
- os: macOS
|
- os: macOS
|
||||||
target: 15
|
target: 15
|
||||||
|
|
@ -296,7 +296,7 @@ jobs:
|
||||||
qt_arch: clang_64
|
qt_arch: clang_64
|
||||||
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
||||||
cmake_generator: Ninja
|
cmake_generator: Ninja
|
||||||
ccache_variant: ccache
|
use_ccache: 1
|
||||||
|
|
||||||
- os: macOS
|
- os: macOS
|
||||||
target: 15
|
target: 15
|
||||||
|
|
@ -308,7 +308,7 @@ jobs:
|
||||||
qt_arch: clang_64
|
qt_arch: clang_64
|
||||||
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
||||||
cmake_generator: Ninja
|
cmake_generator: Ninja
|
||||||
ccache_variant: ccache
|
use_ccache: 1
|
||||||
|
|
||||||
- os: Windows
|
- os: Windows
|
||||||
target: 10
|
target: 10
|
||||||
|
|
@ -320,14 +320,14 @@ jobs:
|
||||||
qt_arch: win64_msvc2022_64
|
qt_arch: win64_msvc2022_64
|
||||||
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
||||||
cmake_generator: Ninja
|
cmake_generator: Ninja
|
||||||
ccache_variant: sccache
|
|
||||||
|
|
||||||
name: ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }}
|
name: ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }}
|
||||||
needs: configure
|
needs: configure
|
||||||
runs-on: ${{matrix.runner}}
|
runs-on: ${{matrix.runner}}
|
||||||
env:
|
env:
|
||||||
CCACHE_DIR: ${{ github.workspace }}/.cache/
|
CCACHE_DIR: ${{ github.workspace }}/.cache/
|
||||||
SCCACHE_DIR: ${{ github.workspace }}/.cache/
|
# Cache size over the entire repo is 10Gi:
|
||||||
|
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy
|
||||||
CCACHE_SIZE: 500M
|
CCACHE_SIZE: 500M
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -336,23 +336,20 @@ jobs:
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Setup ccache
|
||||||
|
if: matrix.use_ccache == 1 && matrix.os == 'macOS'
|
||||||
|
run: brew install ccache
|
||||||
|
|
||||||
- name: Restore compiler cache (ccache)
|
- name: Restore compiler cache (ccache)
|
||||||
|
if: matrix.use_ccache == 1
|
||||||
id: ccache_restore
|
id: ccache_restore
|
||||||
uses: actions/cache/restore@v5
|
uses: actions/cache/restore@v5
|
||||||
|
env:
|
||||||
|
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
||||||
with:
|
with:
|
||||||
path: ${{ github.workspace }}/.cache/
|
path: ${{ env.CCACHE_DIR }}
|
||||||
key: ${{ matrix.ccache_variant }}-${{ matrix.runner }}-${{ matrix.soc || 'Windows' }}-${{ matrix.type }}-master
|
key: ccache-${{ matrix.runner }}-${{ matrix.soc }}-${{ matrix.type }}-${{ env.BRANCH_NAME }}
|
||||||
restore-keys: |
|
restore-keys: ccache-${{ matrix.runner }}-${{ matrix.soc }}-${{ matrix.type }}-
|
||||||
${{ matrix.ccache_variant }}-${{ matrix.runner }}-${{ matrix.soc || 'Windows' }}-${{ matrix.type }}-master-
|
|
||||||
|
|
||||||
- name: Setup ${{ matrix.ccache_variant }}
|
|
||||||
uses: hendrikmuhs/ccache-action@v1.2.20
|
|
||||||
with:
|
|
||||||
key: ${{ matrix.runner }}-${{ matrix.soc || 'Windows' }}-${{ matrix.type }}-master
|
|
||||||
restore-keys: ${{ matrix.runner }}-${{ matrix.soc || 'Windows' }}-${{ matrix.type }}-master-
|
|
||||||
max-size: 500M
|
|
||||||
variant: ${{ matrix.ccache_variant }}
|
|
||||||
save: false
|
|
||||||
|
|
||||||
- name: Setup MSVC (Windows)
|
- name: Setup MSVC (Windows)
|
||||||
if: matrix.os == 'Windows'
|
if: matrix.os == 'Windows'
|
||||||
|
|
@ -431,8 +428,7 @@ jobs:
|
||||||
PACKAGE_SUFFIX: '${{matrix.package_suffix}}'
|
PACKAGE_SUFFIX: '${{matrix.package_suffix}}'
|
||||||
CMAKE_GENERATOR: ${{matrix.cmake_generator}}
|
CMAKE_GENERATOR: ${{matrix.cmake_generator}}
|
||||||
CMAKE_GENERATOR_PLATFORM: ${{ matrix.cmake_generator_platform || '' }}
|
CMAKE_GENERATOR_PLATFORM: ${{ matrix.cmake_generator_platform || '' }}
|
||||||
USE_CCACHE: 1
|
USE_CCACHE: ${{ matrix.use_ccache }}
|
||||||
CCACHE_VARIANT: ${{ matrix.ccache_variant }}
|
|
||||||
VCPKG_DISABLE_METRICS: 1
|
VCPKG_DISABLE_METRICS: 1
|
||||||
VCPKG_BINARY_SOURCES: 'clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite'
|
VCPKG_BINARY_SOURCES: 'clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite'
|
||||||
MACOS_CERTIFICATE: ${{ secrets.PROD_MACOS_CERTIFICATE }}
|
MACOS_CERTIFICATE: ${{ secrets.PROD_MACOS_CERTIFICATE }}
|
||||||
|
|
@ -445,17 +441,19 @@ jobs:
|
||||||
|
|
||||||
# Delete used cache to emulate a cache update. See https://github.com/actions/cache/issues/342.
|
# Delete used cache to emulate a cache update. See https://github.com/actions/cache/issues/342.
|
||||||
- name: Delete old compiler cache (ccache)
|
- name: Delete old compiler cache (ccache)
|
||||||
if: github.ref == 'refs/heads/master' && steps.ccache_restore.outputs.cache-hit && steps.build.outcome == 'success'
|
if: github.ref == 'refs/heads/master' && matrix.use_ccache == 1 && steps.ccache_restore.outputs.cache-hit && steps.build.outcome == 'success'
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
run: gh cache delete --repo ${{ github.repository }} ${{ steps.ccache_restore.outputs.cache-primary-key }}
|
run: gh cache delete --repo ${{ github.repository }} ${{ steps.ccache_restore.outputs.cache-primary-key }}
|
||||||
|
|
||||||
- name: Save compiler cache (ccache)
|
- name: Save compiler cache (ccache)
|
||||||
if: github.ref == 'refs/heads/master' && steps.build.outcome == 'success'
|
if: github.ref == 'refs/heads/master' && matrix.use_ccache == 1
|
||||||
uses: actions/cache/save@v5
|
uses: actions/cache/save@v5
|
||||||
|
env:
|
||||||
|
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
||||||
with:
|
with:
|
||||||
path: ${{ github.workspace }}/.cache/
|
path: ${{ env.CCACHE_DIR }}
|
||||||
key: ${{ steps.ccache_restore.outputs.cache-primary-key }}
|
key: ccache-${{ matrix.runner }}-${{ matrix.soc }}-${{ matrix.type }}-${{ env.BRANCH_NAME }}
|
||||||
|
|
||||||
- name: Sign app bundle
|
- name: Sign app bundle
|
||||||
if: matrix.os == 'macOS' && matrix.make_package && needs.configure.outputs.tag != null
|
if: matrix.os == 'macOS' && matrix.make_package && needs.configure.outputs.tag != null
|
||||||
|
|
|
||||||
|
|
@ -140,15 +140,9 @@ endif()
|
||||||
|
|
||||||
# Define proper compilation flags
|
# Define proper compilation flags
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# /Z7 when using compiler launcher (sccache): avoids C1041 PDB lock with parallel cached compiles
|
|
||||||
# /Zi /FS otherwise for Ninja + /MP parallel builds
|
|
||||||
if(CMAKE_CXX_COMPILER_LAUNCHER)
|
|
||||||
set(_msvc_debug_format " /Z7")
|
|
||||||
else()
|
|
||||||
set(_msvc_debug_format " /Zi /FS")
|
|
||||||
endif()
|
|
||||||
# Disable Warning C4251, C++20 compatibility, Multi-threaded Builds, Warn Detection, Unwind Semantics, Debug Symbols
|
# Disable Warning C4251, C++20 compatibility, Multi-threaded Builds, Warn Detection, Unwind Semantics, Debug Symbols
|
||||||
set(CMAKE_CXX_FLAGS "/wd4251 /Zc:__cplusplus /std:c++20 /permissive- /W4 /MP /EHsc${_msvc_debug_format}")
|
# /Zi /FS for Ninja + /MP parallel builds (FS allows multiple cl.exe to write PDB)
|
||||||
|
set(CMAKE_CXX_FLAGS "/wd4251 /Zc:__cplusplus /std:c++20 /permissive- /W4 /MP /EHsc /Zi /FS")
|
||||||
# Visual Studio: Maximum Optimization, Multi-threaded DLL
|
# Visual Studio: Maximum Optimization, Multi-threaded DLL
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "/Ox /MD")
|
set(CMAKE_CXX_FLAGS_RELEASE "/Ox /MD")
|
||||||
# Visual Studio: No Optimization, Multi-threaded Debug DLL
|
# Visual Studio: No Optimization, Multi-threaded Debug DLL
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue