mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 00:55:09 -07:00
Use CMakePresets
Added in 3.19: https://cmake.org/cmake/help/v3.19/manual/cmake-presets.7.html
This commit is contained in:
parent
6766b0af89
commit
6c6a2ee7c2
4 changed files with 141 additions and 45 deletions
|
|
@ -14,8 +14,8 @@
|
|||
# --dir <dir> sets the name of the build dir, default is "build"
|
||||
# --cmake-generator <generator> sets CMAKE_GENERATOR as used by cmake
|
||||
# --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_EVICTION_AGE BUILD_DIR CMAKE_GENERATOR TARGET_MACOS_VERSION
|
||||
# (correspond to args: --debug/--release --install --package <package type> --suffix <suffix> --server --test --ccache <ccache_size> --dir <dir>)
|
||||
# uses env: BUILDTYPE MAKE_INSTALL MAKE_PACKAGE PACKAGE_TYPE PACKAGE_SUFFIX MAKE_TEST USE_CCACHE CCACHE_SIZE CCACHE_EVICTION_AGE BUILD_DIR CMAKE_GENERATOR TARGET_MACOS_VERSION
|
||||
# (correspond to args: --debug/--release --install --package <package type> --suffix <suffix> --test --ccache <ccache_size> --dir <dir>)
|
||||
# exitcode: 1 for failure, 3 for invalid arguments
|
||||
|
||||
# Read arguments
|
||||
|
|
@ -45,14 +45,6 @@ while [[ $# != 0 ]]; do
|
|||
PACKAGE_SUFFIX="$1"
|
||||
shift
|
||||
;;
|
||||
'--server')
|
||||
MAKE_SERVER=1
|
||||
shift
|
||||
;;
|
||||
'--no-client')
|
||||
MAKE_NO_CLIENT=1
|
||||
shift
|
||||
;;
|
||||
'--test')
|
||||
MAKE_TEST=1
|
||||
shift
|
||||
|
|
@ -82,10 +74,6 @@ while [[ $# != 0 ]]; do
|
|||
CCACHE_EVICTION_AGE=$1
|
||||
shift
|
||||
;;
|
||||
'--vcpkg')
|
||||
USE_VCPKG=1
|
||||
shift
|
||||
;;
|
||||
'--dir')
|
||||
shift
|
||||
if [[ $# == 0 ]]; then
|
||||
|
|
@ -138,12 +126,6 @@ export CMAKE_POLICY_VERSION_MINIMUM=3.10
|
|||
|
||||
# Add cmake flags
|
||||
flags=("-DCMAKE_BUILD_TYPE=$BUILDTYPE")
|
||||
if [[ $MAKE_SERVER ]]; then
|
||||
flags+=("-DWITH_SERVER=1")
|
||||
fi
|
||||
if [[ $MAKE_NO_CLIENT ]]; then
|
||||
flags+=("-DWITH_CLIENT=0" "-DWITH_ORACLE=0")
|
||||
fi
|
||||
if [[ $MAKE_TEST ]]; then
|
||||
flags+=("-DTEST=1")
|
||||
fi
|
||||
|
|
@ -157,9 +139,6 @@ fi
|
|||
if [[ $PACKAGE_TYPE ]]; then
|
||||
flags+=("-DCPACK_GENERATOR=$PACKAGE_TYPE")
|
||||
fi
|
||||
if [[ $USE_VCPKG ]]; then
|
||||
flags+=("-DUSE_VCPKG=1")
|
||||
fi
|
||||
|
||||
# Add cmake --build flags
|
||||
buildflags=(--config "$BUILDTYPE")
|
||||
|
|
|
|||
17
.github/workflows/desktop-build.yml
vendored
17
.github/workflows/desktop-build.yml
vendored
|
|
@ -153,7 +153,6 @@ jobs:
|
|||
CACHE: ${{ github.workspace }}/.cache/${{ matrix.distro }}${{ matrix.version }} # directory for caching docker image and ccache
|
||||
CCACHE_EVICTION_AGE: 7d
|
||||
CCACHE_SIZE: 550M # space of all repo is 10Gi: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy
|
||||
CMAKE_GENERATOR: 'Ninja'
|
||||
NAME: ${{ matrix.distro }}${{ matrix.version }}
|
||||
|
||||
steps:
|
||||
|
|
@ -179,8 +178,7 @@ jobs:
|
|||
shell: bash
|
||||
run: |
|
||||
source .ci/docker.sh
|
||||
RUN --server --debug --test --ccache "$CCACHE_SIZE" \
|
||||
--cmake-generator "$CMAKE_GENERATOR"
|
||||
RUN --server --debug --test --ccache "$CCACHE_SIZE"
|
||||
|
||||
- name: "Build release package"
|
||||
id: build
|
||||
|
|
@ -189,14 +187,11 @@ jobs:
|
|||
env:
|
||||
SUFFIX: '-${{ matrix.distro }}${{ matrix.version }}'
|
||||
package: '${{ matrix.package }}'
|
||||
server_only: '${{ matrix.server_only }}'
|
||||
run: |
|
||||
source .ci/docker.sh
|
||||
args=()
|
||||
[[ $server_only == yes ]] && args+=(--no-client)
|
||||
[[ $GITHUB_REF == "refs/heads/master" ]] && args+=(--evict-ccache "$CCACHE_EVICTION_AGE")
|
||||
args+=(--ccache "$CCACHE_SIZE")
|
||||
args+=(--cmake-generator "$CMAKE_GENERATOR")
|
||||
args+=(--suffix "$SUFFIX")
|
||||
|
||||
RUN --server --release --package "$package" "${args[@]}"
|
||||
|
|
@ -266,7 +261,6 @@ jobs:
|
|||
runner: macos-15-intel
|
||||
|
||||
ccache_eviction_age: 7d
|
||||
cmake_generator: Ninja
|
||||
make_package: 1
|
||||
override_target: 13
|
||||
package_suffix: "-macOS13_Intel"
|
||||
|
|
@ -282,7 +276,6 @@ jobs:
|
|||
runner: macos-14
|
||||
|
||||
ccache_eviction_age: 7d
|
||||
cmake_generator: Ninja
|
||||
make_package: 1
|
||||
package_suffix: "-macOS14"
|
||||
qt_version: 6.11.0
|
||||
|
|
@ -297,7 +290,6 @@ jobs:
|
|||
runner: macos-15
|
||||
|
||||
ccache_eviction_age: 7d
|
||||
cmake_generator: Ninja
|
||||
make_package: 1
|
||||
package_suffix: "-macOS15"
|
||||
qt_version: 6.11.0
|
||||
|
|
@ -312,7 +304,6 @@ jobs:
|
|||
runner: macos-15
|
||||
|
||||
ccache_eviction_age: 7d
|
||||
cmake_generator: Ninja
|
||||
qt_version: 6.11.0
|
||||
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
||||
soc: Apple
|
||||
|
|
@ -324,8 +315,6 @@ jobs:
|
|||
target: 10
|
||||
runner: windows-2025
|
||||
|
||||
cmake_generator: "Visual Studio 18 2026"
|
||||
cmake_generator_platform: x64
|
||||
make_package: 1
|
||||
package_suffix: "-Win10"
|
||||
qt_version: 6.11.0
|
||||
|
|
@ -437,8 +426,6 @@ jobs:
|
|||
env:
|
||||
BUILDTYPE: '${{ matrix.type }}'
|
||||
CCACHE_EVICTION_AGE: ${{ matrix.ccache_eviction_age }}
|
||||
CMAKE_GENERATOR: ${{ matrix.cmake_generator }}
|
||||
CMAKE_GENERATOR_PLATFORM: ${{ matrix.cmake_generator_platform }}
|
||||
DEVELOPER_DIR: '/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer'
|
||||
MACOS_CERTIFICATE: ${{ secrets.PROD_MACOS_CERTIFICATE }}
|
||||
MACOS_CERTIFICATE_NAME: ${{ secrets.PROD_MACOS_CERTIFICATE_NAME }}
|
||||
|
|
@ -447,9 +434,7 @@ jobs:
|
|||
MAKE_PACKAGE: '${{ matrix.make_package }}'
|
||||
PACKAGE_SUFFIX: '${{ matrix.package_suffix }}'
|
||||
TARGET_MACOS_VERSION: ${{ matrix.override_target }}
|
||||
USE_CCACHE: ${{ matrix.use_ccache }}
|
||||
VCPKG_BINARY_SOURCES: 'clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite'
|
||||
VCPKG_DISABLE_METRICS: 1
|
||||
run: .ci/compile.sh --server --test --vcpkg
|
||||
|
||||
# Delete used cache to emulate a ccache update. See https://github.com/actions/cache/issues/342
|
||||
|
|
|
|||
|
|
@ -48,12 +48,7 @@ if(USE_CCACHE)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(WIN32 OR USE_VCPKG)
|
||||
# Use vcpkg toolchain on Windows (and on macOS in CI)
|
||||
set(CMAKE_TOOLCHAIN_FILE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake
|
||||
CACHE STRING "Vcpkg toolchain file"
|
||||
)
|
||||
if(WIN32 or APPLE)
|
||||
# Qt path set by user or env var
|
||||
if(QTDIR
|
||||
OR DEFINED ENV{QTDIR}
|
||||
|
|
|
|||
137
CMakePresets.json
Normal file
137
CMakePresets.json
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
{
|
||||
"version": 5,
|
||||
"cmakeMinimumRequired": {
|
||||
"major": 3,
|
||||
"minor": 25,
|
||||
"patch": 0
|
||||
},
|
||||
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "ci-base",
|
||||
"description": "",
|
||||
"hidden": true,
|
||||
"binaryDir": "${sourceDir}/build",
|
||||
"environment": {
|
||||
},
|
||||
"cacheVariables": {
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"name": "linux-release",
|
||||
"description": "",
|
||||
"inherits": "ci-base",
|
||||
"generator": "Ninja",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"WITH_CLIENT": "1",
|
||||
"WITH_ORACLE": "1",
|
||||
"WITH_SERVER": "1",
|
||||
"USE_CCACHE": "1"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"name": "linux-debug",
|
||||
"description": "",
|
||||
"inherits": "ci-base",
|
||||
"generator": "Ninja",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"WITH_CLIENT": "1",
|
||||
"WITH_ORACLE": "1",
|
||||
"WITH_SERVER": "1",
|
||||
"TEST": "1",
|
||||
"USE_CCACHE": "1"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"name": "linux-servatrice",
|
||||
"description": "",
|
||||
"inherits": "ci-base",
|
||||
"generator": "Ninja",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"WITH_CLIENT": "0",
|
||||
"WITH_ORACLE": "0",
|
||||
"WITH_SERVER": "1",
|
||||
"USE_CCACHE": "1"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"name": "ci-base-vcpkg",
|
||||
"description": "",
|
||||
"hidden": true,
|
||||
"binaryDir": "${sourceDir}/build",
|
||||
"environment": {
|
||||
"VCPKG_DISABLE_METRICS": "1"
|
||||
},
|
||||
"cacheVariables": {
|
||||
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake",
|
||||
"VCPKG_INSTALL_OPTIONS": "--x-abi-tools-use-exact-versions"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"name": "macos-release",
|
||||
"description": "",
|
||||
"inherits": "ci-base-vcpkg",
|
||||
"generator": "Ninja",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"WITH_CLIENT": "1",
|
||||
"WITH_ORACLE": "1",
|
||||
"WITH_SERVER": "1",
|
||||
"USE_CCACHE": "1"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"name": "macos-debug",
|
||||
"description": "",
|
||||
"inherits": "ci-base-vcpkg",
|
||||
"generator": "Ninja",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"WITH_CLIENT": "1",
|
||||
"WITH_ORACLE": "1",
|
||||
"WITH_SERVER": "1",
|
||||
"TEST": "1",
|
||||
"USE_CCACHE": "1"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"name": "windows-release",
|
||||
"description": "",
|
||||
"inherits": "ci-base-vcpkg",
|
||||
"generator": "Visual Studio 17 2022",
|
||||
"architecture": "x64",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"WITH_CLIENT": "1",
|
||||
"WITH_ORACLE": "1",
|
||||
"WITH_SERVER": "1"
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"name": "windows-debug",
|
||||
"description": "",
|
||||
"inherits": "ci-base-vcpkg",
|
||||
"generator": "Visual Studio 17 2022",
|
||||
"architecture": "x64",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"CMAKE_GENERATOR_PLATFORM": "x64"
|
||||
"WITH_CLIENT": "1",
|
||||
"WITH_ORACLE": "1",
|
||||
"WITH_SERVER": "1",
|
||||
"TEST": "1"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue