mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-28 00:42:19 -07:00
comments
This commit is contained in:
parent
9f4af75f09
commit
f9997328c6
1 changed files with 24 additions and 14 deletions
|
|
@ -130,13 +130,14 @@ fi
|
||||||
if [[ ! $BUILD_DIR ]]; then
|
if [[ ! $BUILD_DIR ]]; then
|
||||||
BUILD_DIR="build"
|
BUILD_DIR="build"
|
||||||
fi
|
fi
|
||||||
|
# TODO check BUILD_DIR logic
|
||||||
mkdir -p "$BUILD_DIR"
|
mkdir -p "$BUILD_DIR"
|
||||||
cd "$BUILD_DIR"
|
cd "$BUILD_DIR"
|
||||||
|
|
||||||
# Set minimum CMake Version
|
# Set minimum CMake Version
|
||||||
export CMAKE_POLICY_VERSION_MINIMUM=3.10
|
export CMAKE_POLICY_VERSION_MINIMUM=3.10
|
||||||
|
|
||||||
# Add cmake flags
|
# Add CMake flags
|
||||||
flags=("-DCMAKE_BUILD_TYPE=$BUILDTYPE")
|
flags=("-DCMAKE_BUILD_TYPE=$BUILDTYPE")
|
||||||
if [[ $MAKE_SERVER ]]; then
|
if [[ $MAKE_SERVER ]]; then
|
||||||
flags+=("-DWITH_SERVER=1")
|
flags+=("-DWITH_SERVER=1")
|
||||||
|
|
@ -150,7 +151,7 @@ fi
|
||||||
if [[ $USE_CCACHE ]]; then
|
if [[ $USE_CCACHE ]]; then
|
||||||
flags+=("-DUSE_CCACHE=1")
|
flags+=("-DUSE_CCACHE=1")
|
||||||
if [[ $CCACHE_SIZE ]]; then
|
if [[ $CCACHE_SIZE ]]; then
|
||||||
# note, this setting persists after running the script
|
# Note, this setting persists after running the script
|
||||||
ccache --max-size "$CCACHE_SIZE"
|
ccache --max-size "$CCACHE_SIZE"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
@ -161,11 +162,12 @@ if [[ $USE_VCPKG ]]; then
|
||||||
flags+=("-DUSE_VCPKG=1")
|
flags+=("-DUSE_VCPKG=1")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add cmake --build flags
|
# Add CMake --build flags
|
||||||
buildflags=(--config "$BUILDTYPE")
|
buildflags=(--config "$BUILDTYPE")
|
||||||
|
|
||||||
# Compile
|
# Prepare compilation
|
||||||
if [[ $RUNNER_OS == macOS ]]; then
|
if [[ $RUNNER_OS == macOS ]]; then
|
||||||
|
# TODO qtdir
|
||||||
# QTDIR is needed for macOS since we actually only use the cached thin Qt binaries instead of the install-qt-action,
|
# QTDIR is needed for macOS since we actually only use the cached thin Qt binaries instead of the install-qt-action,
|
||||||
# which sets a few environment variables
|
# which sets a few environment variables
|
||||||
if QTDIR=$(find "$GITHUB_WORKSPACE/Qt" -depth -maxdepth 2 -name macos -type d -print -quit); then
|
if QTDIR=$(find "$GITHUB_WORKSPACE/Qt" -depth -maxdepth 2 -name macos -type d -print -quit); then
|
||||||
|
|
@ -174,17 +176,17 @@ if [[ $RUNNER_OS == macOS ]]; then
|
||||||
echo "could not find QTDIR!"
|
echo "could not find QTDIR!"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
# the qtdir is located at Qt/[qtversion]/macos
|
# The qtdir is located at Qt/<qtversion>/macos
|
||||||
# we use find to get the first subfolder with the name "macos"
|
# We use "find" to get the first subfolder with the name "macos"
|
||||||
# this works independent of the qt version as there should be only one version installed on the runner at a time
|
# This works independent of the Qt version as there should be only one version installed on the runner at a time
|
||||||
export QTDIR
|
export QTDIR
|
||||||
|
|
||||||
if [[ $TARGET_MACOS_VERSION ]]; then
|
if [[ $TARGET_MACOS_VERSION ]]; then
|
||||||
# CMAKE_OSX_DEPLOYMENT_TARGET is a vanilla cmake flag needed to compile to target macOS version
|
# CMAKE_OSX_DEPLOYMENT_TARGET is a vanilla CMake flag needed to compile to target macOS version
|
||||||
flags+=("-DCMAKE_OSX_DEPLOYMENT_TARGET=$TARGET_MACOS_VERSION")
|
flags+=("-DCMAKE_OSX_DEPLOYMENT_TARGET=$TARGET_MACOS_VERSION")
|
||||||
|
|
||||||
# vcpkg dependencies need a vcpkg triplet file to compile to the target macOS version
|
# vcpkg dependencies need a vcpkg triplet file to compile to the target macOS version
|
||||||
# an easy way is to copy the x64-osx.cmake file and modify it
|
# An easy way is to copy the x64-osx.cmake file and modify it
|
||||||
triplets_dir="/tmp/cmake/triplets"
|
triplets_dir="/tmp/cmake/triplets"
|
||||||
triplet_version="custom-triplet"
|
triplet_version="custom-triplet"
|
||||||
triplet_file="$triplets_dir/$triplet_version.cmake"
|
triplet_file="$triplets_dir/$triplet_version.cmake"
|
||||||
|
|
@ -225,7 +227,7 @@ if [[ $RUNNER_OS == macOS ]]; then
|
||||||
|
|
||||||
if [[ $MAKE_PACKAGE ]]; then
|
if [[ $MAKE_PACKAGE ]]; then
|
||||||
# Workaround https://github.com/actions/runner-images/issues/7522
|
# Workaround https://github.com/actions/runner-images/issues/7522
|
||||||
# have hdiutil repeat the command 10 times in hope of success
|
# Have hdiutil repeat the command 10 times in hope of success
|
||||||
hdiutil_script="/tmp/hdiutil.sh"
|
hdiutil_script="/tmp/hdiutil.sh"
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
echo '#!/bin/bash
|
echo '#!/bin/bash
|
||||||
|
|
@ -242,11 +244,12 @@ if [[ $RUNNER_OS == macOS ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif [[ $RUNNER_OS == Windows ]]; then
|
elif [[ $RUNNER_OS == Windows ]]; then
|
||||||
# Enable MTT, see https://devblogs.microsoft.com/cppblog/improved-parallelism-in-msbuild/
|
# Enable MSBuild switches for MTT, see https://devblogs.microsoft.com/cppblog/improved-parallelism-in-msbuild/
|
||||||
# and https://devblogs.microsoft.com/cppblog/cpp-build-throughput-investigation-and-tune-up/#multitooltask-mtt
|
# and https://devblogs.microsoft.com/cppblog/cpp-build-throughput-investigation-and-tune-up/#multitooltask-mtt
|
||||||
buildflags+=(-- -p:UseMultiToolTask=true -p:EnableClServerMode=true)
|
buildflags+=(-- -p:UseMultiToolTask=true -p:EnableClServerMode=true)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Pre-build ccache
|
||||||
if [[ $USE_CCACHE ]]; then
|
if [[ $USE_CCACHE ]]; then
|
||||||
echo "::group::Clear ccache stats"
|
echo "::group::Clear ccache stats"
|
||||||
# https://ccache.dev/manual/4.13.6.html#_command_line_options
|
# https://ccache.dev/manual/4.13.6.html#_command_line_options
|
||||||
|
|
@ -259,17 +262,20 @@ if [[ $USE_CCACHE ]]; then
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "::group::Configure cmake"
|
# Configure CMake
|
||||||
|
echo "::group::Configure CMake"
|
||||||
cmake --version
|
cmake --version
|
||||||
echo "Running cmake with flags: ${flags[*]}"
|
echo "Running CMake configuration with following flags: ${flags[*]}"
|
||||||
cmake .. "${flags[@]}"
|
cmake .. "${flags[@]}"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
# Build
|
||||||
echo "::group::Build project"
|
echo "::group::Build project"
|
||||||
echo "Running cmake --build with flags: ${buildflags[*]}"
|
echo "Running CMake with following build flags: ${buildflags[*]}"
|
||||||
cmake --build . "${buildflags[@]}"
|
cmake --build . "${buildflags[@]}"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
# Post-build ccache
|
||||||
if [[ $USE_CCACHE ]]; then
|
if [[ $USE_CCACHE ]]; then
|
||||||
if [[ $CCACHE_EVICTION_AGE ]]; then
|
if [[ $CCACHE_EVICTION_AGE ]]; then
|
||||||
echo "::group::evict ccache files older than $CCACHE_EVICTION_AGE"
|
echo "::group::evict ccache files older than $CCACHE_EVICTION_AGE"
|
||||||
|
|
@ -285,6 +291,7 @@ elif [[ $CCACHE_EVICTION_AGE ]]; then
|
||||||
echo "::error file=$0::ccache eviction is enabled while ccache is disabled!"
|
echo "::error file=$0::ccache eviction is enabled while ccache is disabled!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# [macOS] Inspect binaries
|
||||||
if [[ $RUNNER_OS == macOS ]]; then
|
if [[ $RUNNER_OS == macOS ]]; then
|
||||||
echo "::group::Inspect Mach-O binaries"
|
echo "::group::Inspect Mach-O binaries"
|
||||||
for app in cockatrice oracle servatrice; do
|
for app in cockatrice oracle servatrice; do
|
||||||
|
|
@ -298,18 +305,21 @@ if [[ $RUNNER_OS == macOS ]]; then
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Test
|
||||||
if [[ $MAKE_TEST ]]; then
|
if [[ $MAKE_TEST ]]; then
|
||||||
echo "::group::Run tests"
|
echo "::group::Run tests"
|
||||||
ctest -C "$BUILDTYPE" --output-on-failure
|
ctest -C "$BUILDTYPE" --output-on-failure
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Install
|
||||||
if [[ $MAKE_INSTALL ]]; then
|
if [[ $MAKE_INSTALL ]]; then
|
||||||
echo "::group::Install"
|
echo "::group::Install"
|
||||||
cmake --build . --target install --config "$BUILDTYPE"
|
cmake --build . --target install --config "$BUILDTYPE"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Package
|
||||||
if [[ $MAKE_PACKAGE ]]; then
|
if [[ $MAKE_PACKAGE ]]; then
|
||||||
echo "::group::Create package"
|
echo "::group::Create package"
|
||||||
cmake --build . --target package --config "$BUILDTYPE"
|
cmake --build . --target package --config "$BUILDTYPE"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue