From 49957d6b0a59239c79b7948042913c7f37fed92d Mon Sep 17 00:00:00 2001 From: tooomm Date: Mon, 20 Jul 2026 22:59:17 +0200 Subject: [PATCH 01/22] enable ninja --- .ci/compile.sh | 5 ----- .github/workflows/desktop-build.yml | 11 ++--------- CMakeLists.txt | 2 +- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/.ci/compile.sh b/.ci/compile.sh index ee846897b..5b4547a82 100755 --- a/.ci/compile.sh +++ b/.ci/compile.sh @@ -250,11 +250,6 @@ if [[ $RUNNER_OS == macOS ]]; then chmod +x "$hdiutil_script" flags+=(-DCPACK_COMMAND_HDIUTIL="$hdiutil_script") fi - -elif [[ $RUNNER_OS == Windows ]]; then - # Enable 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 - buildflags+=(-- -p:UseMultiToolTask=true -p:EnableClServerMode=true) fi if [[ $USE_CCACHE ]]; then diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.yml index f1846ecf6..0eaa8ff22 100644 --- a/.github/workflows/desktop-build.yml +++ b/.github/workflows/desktop-build.yml @@ -266,7 +266,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 +281,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 +295,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 +309,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 +320,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 @@ -339,6 +333,7 @@ jobs: env: CCACHE_DIR: ${{ github.workspace }}/.cache/ 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' steps: - name: "Checkout" @@ -422,7 +417,7 @@ jobs: - name: "[Windows] Install NSIS" if: matrix.os == 'Windows' shell: bash - run: choco install nsis + run: choco install nsis --no-progress - name: "Setup vcpkg cache" id: vcpkg-cache @@ -437,8 +432,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 }} diff --git a/CMakeLists.txt b/CMakeLists.txt index c10e1db68..13cd1c86e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -312,7 +312,7 @@ if(UNIX) endif() elseif(WIN32) set(CPACK_GENERATOR NSIS ${CPACK_GENERATOR}) - if("${CMAKE_GENERATOR_PLATFORM}" MATCHES "(x64)") + if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(TRICE_IS_64_BIT 1) else() set(TRICE_IS_64_BIT 0) From 27a6eda78186968e95dfcd1a840e906618e88327 Mon Sep 17 00:00:00 2001 From: tooomm Date: Tue, 21 Jul 2026 15:14:55 +0200 Subject: [PATCH 02/22] configure msvc dev environment --- .github/workflows/desktop-build.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.yml index 0eaa8ff22..66e98ef79 100644 --- a/.github/workflows/desktop-build.yml +++ b/.github/workflows/desktop-build.yml @@ -341,12 +341,11 @@ jobs: with: submodules: recursive - - name: "[Windows] Add msbuild to PATH" + - name: "[Windows] Setup MSVC" if: matrix.os == 'Windows' - id: add-msbuild - uses: microsoft/setup-msbuild@v3 + uses: TheMrMilchmann/setup-msvc-dev@v4 with: - msbuild-architecture: x64 + arch: x64 - name: "[macOS] Setup ccache" if: matrix.os == 'macOS' && matrix.use_ccache == 1 From 967b78c029fcc3f171bb8c56a519d74d0edb34ca Mon Sep 17 00:00:00 2001 From: tooomm Date: Tue, 21 Jul 2026 17:38:19 +0200 Subject: [PATCH 03/22] debug slowness and ccache message in win logs --- .ci/compile.sh | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.ci/compile.sh b/.ci/compile.sh index 5b4547a82..a45ff338d 100755 --- a/.ci/compile.sh +++ b/.ci/compile.sh @@ -258,6 +258,27 @@ if [[ $USE_CCACHE ]]; then echo "::endgroup::" fi +if [[ $RUNNER_OS == Windows ]]; then + echo "::group::Debug tools" + echo "where ccache" + where ccache + ccache --version + echo "where ninja" + where ninja + ninja --version + echo "NUMBER_OF_PROCESSORS=$NUMBER_OF_PROCESSORS" + echo "where cl" + where cl + cl + echo "where link" + where link + link --version || link + echo "where rc" + where rc + rc + echo "::endgroup::" +fi + echo "::group::Configure cmake" cmake --version echo "Running cmake with flags: ${flags[*]}" @@ -266,7 +287,7 @@ echo "::endgroup::" echo "::group::Build project" echo "Running cmake --build with flags: ${buildflags[*]}" -cmake --build . "${buildflags[@]}" +cmake --build . "${buildflags[@]}" --verbose echo "::endgroup::" if [[ $USE_CCACHE ]]; then From 99fefee2cdf174cfe126cbe6a157c506dcc9bcb7 Mon Sep 17 00:00:00 2001 From: tooomm Date: Tue, 21 Jul 2026 19:01:26 +0200 Subject: [PATCH 04/22] Disable ccache explicitly, it's installed and available in PATH `-- Found CCache C:/Strawberry/c/bin/ccache.exe` --- .github/workflows/desktop-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.yml index 66e98ef79..67f3a2ace 100644 --- a/.github/workflows/desktop-build.yml +++ b/.github/workflows/desktop-build.yml @@ -325,6 +325,7 @@ jobs: qt_version: 6.11.0 qt_modules: qtimageformats qtmultimedia qtwebsockets type: Release + use_ccache: 0 name: ${{ matrix.os }} ${{ matrix.target }}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} needs: configure From d0fa0f9ab936d8588d62ddbae94fcdb4eb82059a Mon Sep 17 00:00:00 2001 From: tooomm Date: Tue, 21 Jul 2026 21:09:52 +0200 Subject: [PATCH 05/22] fix ccache on win --- .ci/compile.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.ci/compile.sh b/.ci/compile.sh index a45ff338d..e028219f4 100755 --- a/.ci/compile.sh +++ b/.ci/compile.sh @@ -147,14 +147,16 @@ fi if [[ $MAKE_TEST ]]; then flags+=("-DTEST=1") fi -if [[ $USE_CCACHE ]]; then +if [[ $USE_CCACHE == "1" ]]; then flags+=("-DUSE_CCACHE=1") - if [[ $CCACHE_SIZE ]]; then + if [[ -n $CCACHE_SIZE ]]; then # note, this setting persists after running the script ccache --max-size "$CCACHE_SIZE" fi +else + flags+=("-DUSE_CCACHE=0") fi -if [[ $PACKAGE_TYPE ]]; then +if [[ -n $PACKAGE_TYPE ]]; then flags+=("-DCPACK_GENERATOR=$PACKAGE_TYPE") fi if [[ $USE_VCPKG ]]; then @@ -252,7 +254,7 @@ if [[ $RUNNER_OS == macOS ]]; then fi fi -if [[ $USE_CCACHE ]]; then +if [[ $USE_CCACHE == "1" ]]; then echo "::group::Show ccache stats" ccachestatsverbose echo "::endgroup::" @@ -290,8 +292,8 @@ echo "Running cmake --build with flags: ${buildflags[*]}" cmake --build . "${buildflags[@]}" --verbose echo "::endgroup::" -if [[ $USE_CCACHE ]]; then - if [[ $CCACHE_EVICTION_AGE ]]; then +if [[ $USE_CCACHE == "1" ]]; then + if [[ -n $CCACHE_EVICTION_AGE ]]; then echo "::group::evict ccache files older than $CCACHE_EVICTION_AGE" ccache --evict-older-than "$CCACHE_EVICTION_AGE" echo "::endgroup::" @@ -333,7 +335,7 @@ if [[ $MAKE_PACKAGE ]]; then cmake --build . --target package --config "$BUILDTYPE" echo "::endgroup::" - if [[ $PACKAGE_SUFFIX ]]; then + if [[ -n $PACKAGE_SUFFIX ]]; then echo "::group::Update package name" cd .. BUILD_DIR="$BUILD_DIR" .ci/name_build.sh "$PACKAGE_SUFFIX" From 55dc929002cf72f3810cfd48f380b634ca19f34b Mon Sep 17 00:00:00 2001 From: tooomm Date: Tue, 21 Jul 2026 21:10:11 +0200 Subject: [PATCH 06/22] more debug --- .ci/compile.sh | 6 ++++++ .github/workflows/desktop-build.yml | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/.ci/compile.sh b/.ci/compile.sh index e028219f4..317eb7e1c 100755 --- a/.ci/compile.sh +++ b/.ci/compile.sh @@ -330,6 +330,12 @@ if [[ $MAKE_INSTALL ]]; then echo "::endgroup::" fi +if [[ $RUNNER_OS == Windows ]]; then + echo "::group::Find DLLs" + find vcpkg_installed -name "*.dll" + echo "::endgroup::" +fi + if [[ $MAKE_PACKAGE ]]; then echo "::group::Create package" cmake --build . --target package --config "$BUILDTYPE" diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.yml index 67f3a2ace..ffade35be 100644 --- a/.github/workflows/desktop-build.yml +++ b/.github/workflows/desktop-build.yml @@ -425,6 +425,22 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} + - name: "[Windows] Debug PATH (bash)" + if: matrix.os == 'Windows' + shell: bash + run: | + where ninja + where cl + where link + + - name: "[Windows] Debug PATH (cmd)" + if: matrix.os == 'Windows' + shell: cmd + run: | + where ninja + where cl + where link + # Uses environment variables, see compile.sh for more details - name: "Build Cockatrice" id: build From 876504faaa046524deb0716ab4e21625d7cac880 Mon Sep 17 00:00:00 2001 From: tooomm Date: Wed, 22 Jul 2026 20:53:14 +0200 Subject: [PATCH 07/22] add vcpkg to libSearchDirs --- oracle/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/oracle/CMakeLists.txt b/oracle/CMakeLists.txt index a51982625..ce7b76b4c 100644 --- a/oracle/CMakeLists.txt +++ b/oracle/CMakeLists.txt @@ -233,6 +233,7 @@ if(WIN32) set(plugin_dest_dir Plugins) set(qtconf_dest_dir .) list(APPEND libSearchDirs ${QT_LIBRARY_DIR}) + list(APPEND libSearchDirs "${CMAKE_BINARY_DIR}/vcpkg_installed/${VCPKG_TARGET_TRIPLET}/bin") install( DIRECTORY "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${CMAKE_BUILD_TYPE}/" From cfa0c8fe1308de1daa8600bb22e62fbfe3f2fc76 Mon Sep 17 00:00:00 2001 From: tooomm Date: Wed, 22 Jul 2026 21:02:04 +0200 Subject: [PATCH 08/22] lint --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 13cd1c86e..d0bd782a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -174,7 +174,7 @@ elseif(CMAKE_COMPILER_IS_GNUCXX) -Wno-error=delete-non-virtual-dtor -Wno-error=sign-compare -Wno-error=missing-declarations - -Wno-error=sfinae-incomplete # GCC 16+: Qt MOC + protobuf forward decls trigger this + -Wno-error=sfinae-incomplete # GCC 16+: Qt MOC + protobuf forward decls trigger this ) foreach(FLAG ${ADDITIONAL_DEBUG_FLAGS}) From 6aa3467dabc5c69464d0ca8fa609dd7992cb50e4 Mon Sep 17 00:00:00 2001 From: tooomm Date: Wed, 22 Jul 2026 21:06:45 +0200 Subject: [PATCH 09/22] remove vcpkg dll debug --- .ci/compile.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.ci/compile.sh b/.ci/compile.sh index 317eb7e1c..e028219f4 100755 --- a/.ci/compile.sh +++ b/.ci/compile.sh @@ -330,12 +330,6 @@ if [[ $MAKE_INSTALL ]]; then echo "::endgroup::" fi -if [[ $RUNNER_OS == Windows ]]; then - echo "::group::Find DLLs" - find vcpkg_installed -name "*.dll" - echo "::endgroup::" -fi - if [[ $MAKE_PACKAGE ]]; then echo "::group::Create package" cmake --build . --target package --config "$BUILDTYPE" From 43ef4c94dc1caa37f90b93f2cb2c6660642eaddd Mon Sep 17 00:00:00 2001 From: tooomm Date: Wed, 22 Jul 2026 22:00:20 +0200 Subject: [PATCH 10/22] disable vpckg applocal on win --- .ci/compile.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/compile.sh b/.ci/compile.sh index e028219f4..717c9a02e 100755 --- a/.ci/compile.sh +++ b/.ci/compile.sh @@ -161,6 +161,7 @@ if [[ -n $PACKAGE_TYPE ]]; then fi if [[ $USE_VCPKG ]]; then flags+=("-DUSE_VCPKG=1") + flags+=("-DVCPKG_APPLOCAL_DEPS=OFF") # disable copying of runtime DLLs into build output on Windows fi # Add cmake --build flags From b9ba3eba31100ee505ec676b8a390a7001c94bf6 Mon Sep 17 00:00:00 2001 From: tooomm Date: Wed, 22 Jul 2026 22:10:56 +0200 Subject: [PATCH 11/22] fix pdb locations --- .github/workflows/desktop-build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.yml index ffade35be..c084c1798 100644 --- a/.github/workflows/desktop-build.yml +++ b/.github/workflows/desktop-build.yml @@ -543,9 +543,9 @@ jobs: if-no-files-found: error name: ${{ steps.build.outputs.name }}-PDBs path: | - build/cockatrice/Release/*.pdb - build/oracle/Release/*.pdb - build/servatrice/Release/*.pdb + build/cockatrice/*.pdb + build/oracle/*.pdb + build/servatrice/*.pdb - name: "Upload to release" if: needs.configure.outputs.tag != null && matrix.make_package == '1' From 91dd255801cf0c5cafcbafe750e9e1e8f690b16d Mon Sep 17 00:00:00 2001 From: tooomm Date: Thu, 23 Jul 2026 11:02:25 +0200 Subject: [PATCH 12/22] cmake flags - c++20 standard already defined - /FS is handled by cmake - strict c++ mode by disabling extensions (more modern) -"cplusplus" fix was appended already - scope /MP flag only for visual studio generator --- CMakeLists.txt | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d0bd782a8..4ac9201ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,15 +27,10 @@ option(USE_VCPKG "Use vcpkg regardless of OS" OFF) # Default to "Release" build type # User-provided value for CMAKE_BUILD_TYPE must be checked before the PROJECT() call -if(DEFINED CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE - ${CMAKE_BUILD_TYPE} - CACHE STRING "Type of build" - ) -else() +if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release - CACHE STRING "Type of build" + CACHE STRING "Build type" ) endif() @@ -87,6 +82,7 @@ set(CMAKE_CXX_STANDARD CACHE STRING "C++ ISO Standard" ) set(CMAKE_CXX_STANDARD_REQUIRED True) +set(CMAKE_CXX_EXTENSIONS OFF) # Set conventional loops set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) @@ -102,8 +98,7 @@ include(createversionfile) # Define a proper install path if(UNIX) - if(APPLE) - # macOS + if(APPLE) # macOS # Due to the special bundle structure ignore # the prefix eventually set by the user. set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/release) @@ -139,12 +134,25 @@ elseif(WIN32) endif() # Define proper compilation flags -if(MSVC) - # 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 /Zi") - # Visual Studio: Maximum Optimization, Multi-threaded DLL +if(MSVC) # MS Visual C++ compiler + # /wd4251 Suppress C4251 (DLL interface) warnings + # /W4 Enable warning level 4 + # /EHsc Enable standard C++ exception handling + # /Zi Generate debugging information (Program Database, PDB) + set(CMAKE_CXX_FLAGS "/wd4251 /W4 /EHsc /Zi") + + # Visual Studio generator: Append parallelisation flag (not needed with Ninja) + # /MP Enable parallel compilation + if(CMAKE_GENERATOR MATCHES "^Visual Studio") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") + endif() + + # /Ox Enable maximum optimization + # /MD Link against the multi-threaded DLL runtime library (Release CRT) set(CMAKE_CXX_FLAGS_RELEASE "/Ox /MD") - # Visual Studio: No Optimization, Multi-threaded Debug DLL + + # /Od Disable optimization + # /MDd Link against the multi-threaded Debug DLL runtime library (Debug CRT) set(CMAKE_CXX_FLAGS_DEBUG "/Od /MDd") # Generate PDB, even when in release (So developers can better analyze crash logs) From aaeaa0b89ee4a23a36f15ec35bb865b55c2348be Mon Sep 17 00:00:00 2001 From: tooomm Date: Thu, 23 Jul 2026 11:20:23 +0200 Subject: [PATCH 13/22] remove some debug again --- .ci/compile.sh | 21 --------------------- .github/workflows/desktop-build.yml | 16 ---------------- 2 files changed, 37 deletions(-) diff --git a/.ci/compile.sh b/.ci/compile.sh index 717c9a02e..6e9b6e994 100755 --- a/.ci/compile.sh +++ b/.ci/compile.sh @@ -261,27 +261,6 @@ if [[ $USE_CCACHE == "1" ]]; then echo "::endgroup::" fi -if [[ $RUNNER_OS == Windows ]]; then - echo "::group::Debug tools" - echo "where ccache" - where ccache - ccache --version - echo "where ninja" - where ninja - ninja --version - echo "NUMBER_OF_PROCESSORS=$NUMBER_OF_PROCESSORS" - echo "where cl" - where cl - cl - echo "where link" - where link - link --version || link - echo "where rc" - where rc - rc - echo "::endgroup::" -fi - echo "::group::Configure cmake" cmake --version echo "Running cmake with flags: ${flags[*]}" diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.yml index c084c1798..c19eddb88 100644 --- a/.github/workflows/desktop-build.yml +++ b/.github/workflows/desktop-build.yml @@ -425,22 +425,6 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} - - name: "[Windows] Debug PATH (bash)" - if: matrix.os == 'Windows' - shell: bash - run: | - where ninja - where cl - where link - - - name: "[Windows] Debug PATH (cmd)" - if: matrix.os == 'Windows' - shell: cmd - run: | - where ninja - where cl - where link - # Uses environment variables, see compile.sh for more details - name: "Build Cockatrice" id: build From 0ea9ac360775460268d25b4d350640397f1fafc1 Mon Sep 17 00:00:00 2001 From: tooomm Date: Thu, 23 Jul 2026 17:30:48 +0200 Subject: [PATCH 14/22] win only --- .ci/compile.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.ci/compile.sh b/.ci/compile.sh index 6e9b6e994..8d4cf1559 100755 --- a/.ci/compile.sh +++ b/.ci/compile.sh @@ -161,7 +161,9 @@ if [[ -n $PACKAGE_TYPE ]]; then fi if [[ $USE_VCPKG ]]; then flags+=("-DUSE_VCPKG=1") - flags+=("-DVCPKG_APPLOCAL_DEPS=OFF") # disable copying of runtime DLLs into build output on Windows + if [[ $RUNNER_OS == Windows ]]; then + flags+=("-DVCPKG_APPLOCAL_DEPS=OFF") # disable copying of runtime DLLs into build output + fi fi # Add cmake --build flags From 45fd6770ec29ac9cd4fde2ee6a00cc9ea5f01a26 Mon Sep 17 00:00:00 2001 From: tooomm Date: Thu, 23 Jul 2026 17:40:55 +0200 Subject: [PATCH 15/22] remove min policy, we set min version in cmakelists --- .ci/compile.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/.ci/compile.sh b/.ci/compile.sh index 8d4cf1559..55f16322d 100755 --- a/.ci/compile.sh +++ b/.ci/compile.sh @@ -133,9 +133,6 @@ fi mkdir -p "$BUILD_DIR" cd "$BUILD_DIR" -# Set minimum CMake Version -export CMAKE_POLICY_VERSION_MINIMUM=3.10 - # Add cmake flags flags=("-DCMAKE_BUILD_TYPE=$BUILDTYPE") if [[ $MAKE_SERVER ]]; then From c1eb26754af30497c0334c43ae04bf6d15f420f1 Mon Sep 17 00:00:00 2001 From: tooomm Date: Thu, 23 Jul 2026 18:01:12 +0200 Subject: [PATCH 16/22] debug ctest and readd msbuild flags (guarded) --- .ci/compile.sh | 41 +++++++++++++++++++++++++++++++++++++++-- tests/CMakeLists.txt | 4 ++-- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/.ci/compile.sh b/.ci/compile.sh index 55f16322d..9ad68cfa0 100755 --- a/.ci/compile.sh +++ b/.ci/compile.sh @@ -146,6 +146,7 @@ if [[ $MAKE_TEST ]]; then fi if [[ $USE_CCACHE == "1" ]]; then flags+=("-DUSE_CCACHE=1") + ccache --version if [[ -n $CCACHE_SIZE ]]; then # note, this setting persists after running the script ccache --max-size "$CCACHE_SIZE" @@ -176,7 +177,7 @@ function ccachestatsverbose() { fi } -# Compile +# Prepare if [[ $RUNNER_OS == macOS ]]; then # 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 @@ -252,6 +253,13 @@ if [[ $RUNNER_OS == macOS ]]; then chmod +x "$hdiutil_script" flags+=(-DCPACK_COMMAND_HDIUTIL="$hdiutil_script") fi + +elif [[ $RUNNER_OS == Windows ]]; then + if [[ "$CMAKE_GENERATOR" =~ ^Visual\ Studio ]]; then + # Enable 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 + buildflags+=(-- -p:UseMultiToolTask=true -p:EnableClServerMode=true) + fi fi if [[ $USE_CCACHE == "1" ]]; then @@ -260,12 +268,14 @@ if [[ $USE_CCACHE == "1" ]]; then echo "::endgroup::" fi +# Configure CMake echo "::group::Configure cmake" cmake --version echo "Running cmake with flags: ${flags[*]}" cmake .. "${flags[@]}" echo "::endgroup::" +# Build echo "::group::Build project" echo "Running cmake --build with flags: ${buildflags[*]}" cmake --build . "${buildflags[@]}" --verbose @@ -298,8 +308,35 @@ if [[ $RUNNER_OS == macOS ]]; then fi if [[ $MAKE_TEST ]]; then + if [[ $RUNNER_OS == Windows ]]; then + echo "::group::Run dummy_test manually" + + echo "dir" + pwd + ls -la + + echo "" + echo "find" + find . -name "dummy_test.exe" + find tests -maxdepth 1 -type f \( -name "*.dll" -o -name "*.exe" \) + + echo "" + echo "dependencies" + dumpbin //DEPENDENTS tests/dummy_test.exe + + echo "" + echo "dummy_test" + ./tests/dummy_test.exe --gtest_list_tests + echo "Exit code: $?" + + echo "::endgroup::" + fi + echo "::group::Run tests" - ctest -C "$BUILDTYPE" --output-on-failure + ctest -N -V + echo "" + ctest --version + ctest -C "$BUILDTYPE" -VV --output-on-failure echo "::endgroup::" fi diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a179a3603..94a7327d4 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -11,10 +11,9 @@ add_test(NAME server_card_counter_test COMMAND server_card_counter_test) add_test(NAME server_counter_test COMMAND server_counter_test) add_test(NAME deck_hash_performance_test COMMAND deck_hash_performance_test) +set_tests_properties(dummy_test PROPERTIES TIMEOUT 5) set_tests_properties(deck_hash_performance_test PROPERTIES TIMEOUT 5) -# Find GTest - add_executable(dummy_test dummy_test.cpp) add_executable(expression_test expression_test.cpp) add_executable(clamped_arithmetic_test clamped_arithmetic_test.cpp) @@ -24,6 +23,7 @@ add_executable(deck_hash_performance_test deck_hash_performance_test.cpp) add_executable(server_card_counter_test server_card_counter_test.cpp) add_executable(server_counter_test server_counter_test.cpp) +# Find GTest find_package(GTest) if(NOT GTEST_FOUND) From 09b55b118a8b3ef7eb91f41eb8c528e66b8564b7 Mon Sep 17 00:00:00 2001 From: tooomm Date: Fri, 24 Jul 2026 11:04:30 +0200 Subject: [PATCH 17/22] Remove test debug, readd applocal copying --- .ci/compile.sh | 44 +++++++++----------------------------------- 1 file changed, 9 insertions(+), 35 deletions(-) diff --git a/.ci/compile.sh b/.ci/compile.sh index 9ad68cfa0..75e929954 100755 --- a/.ci/compile.sh +++ b/.ci/compile.sh @@ -133,7 +133,7 @@ fi mkdir -p "$BUILD_DIR" cd "$BUILD_DIR" -# Add cmake flags +# Add CMake flags flags=("-DCMAKE_BUILD_TYPE=$BUILDTYPE") if [[ $MAKE_SERVER ]]; then flags+=("-DWITH_SERVER=1") @@ -146,9 +146,8 @@ if [[ $MAKE_TEST ]]; then fi if [[ $USE_CCACHE == "1" ]]; then flags+=("-DUSE_CCACHE=1") - ccache --version if [[ -n $CCACHE_SIZE ]]; then - # note, this setting persists after running the script + # Note, this setting persists after running the script ccache --max-size "$CCACHE_SIZE" fi else @@ -159,15 +158,16 @@ if [[ -n $PACKAGE_TYPE ]]; then fi if [[ $USE_VCPKG ]]; then flags+=("-DUSE_VCPKG=1") - if [[ $RUNNER_OS == Windows ]]; then - flags+=("-DVCPKG_APPLOCAL_DEPS=OFF") # disable copying of runtime DLLs into build output - fi +# if [[ $MAKE_PACKAGE && $RUNNER_OS == Windows ]]; then +# flags+=("-DVCPKG_APPLOCAL_DEPS=OFF") # disable copying of runtime DLLs into build output +# fi fi -# Add cmake --build flags +# Add CMake --build flags buildflags=(--config "$BUILDTYPE") function ccachestatsverbose() { + ccache --version # note, verbose only works on newer ccache, discard the error local got if got="$(ccache --show-stats --verbose 2>/dev/null)"; then @@ -269,7 +269,7 @@ if [[ $USE_CCACHE == "1" ]]; then fi # Configure CMake -echo "::group::Configure cmake" +echo "::group::Configure CMake" cmake --version echo "Running cmake with flags: ${flags[*]}" cmake .. "${flags[@]}" @@ -308,35 +308,9 @@ if [[ $RUNNER_OS == macOS ]]; then fi if [[ $MAKE_TEST ]]; then - if [[ $RUNNER_OS == Windows ]]; then - echo "::group::Run dummy_test manually" - - echo "dir" - pwd - ls -la - - echo "" - echo "find" - find . -name "dummy_test.exe" - find tests -maxdepth 1 -type f \( -name "*.dll" -o -name "*.exe" \) - - echo "" - echo "dependencies" - dumpbin //DEPENDENTS tests/dummy_test.exe - - echo "" - echo "dummy_test" - ./tests/dummy_test.exe --gtest_list_tests - echo "Exit code: $?" - - echo "::endgroup::" - fi - echo "::group::Run tests" - ctest -N -V - echo "" ctest --version - ctest -C "$BUILDTYPE" -VV --output-on-failure + ctest -C "$BUILDTYPE" --output-on-failure echo "::endgroup::" fi From 16ff75c20feded75acda93317fe0dfa41b3210e4 Mon Sep 17 00:00:00 2001 From: tooomm Date: Fri, 24 Jul 2026 14:12:20 +0200 Subject: [PATCH 18/22] disable ccache if not explicitly enabled --- .ci/compile.sh | 3 +++ .github/workflows/desktop-build.yml | 1 - servatrice/check_schema_version.sh | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.ci/compile.sh b/.ci/compile.sh index 75e929954..e577e11dd 100755 --- a/.ci/compile.sh +++ b/.ci/compile.sh @@ -124,6 +124,9 @@ set -e # Setup ./servatrice/check_schema_version.sh +if [[ ! $USE_CCACHE ]]; then + USE_CCACHE=0 +fi if [[ ! $BUILDTYPE ]]; then BUILDTYPE=Release fi diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.yml index c19eddb88..9f1f051b0 100644 --- a/.github/workflows/desktop-build.yml +++ b/.github/workflows/desktop-build.yml @@ -325,7 +325,6 @@ jobs: qt_version: 6.11.0 qt_modules: qtimageformats qtmultimedia qtwebsockets type: Release - use_ccache: 0 name: ${{ matrix.os }} ${{ matrix.target }}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} needs: configure diff --git a/servatrice/check_schema_version.sh b/servatrice/check_schema_version.sh index c4aadf356..8b645b5d2 100755 --- a/servatrice/check_schema_version.sh +++ b/servatrice/check_schema_version.sh @@ -10,7 +10,7 @@ declare -i schema_ver="${version_line%%)*}" latest_migration="$(ls -1 servatrice/migrations/ | tail -n1)" xtoysql="${latest_migration#servatrice_}" xtoy="${xtoysql%.sql}" -declare -i old_ver="10#${xtoy%_to_*}" #declare as integer with base 10, numbers with a leading 0 are normally interpreted as base 16 +declare -i old_ver="10#${xtoy%_to_*}" # declare as integer with base 10, numbers with a leading 0 are normally interpreted as base 16 declare -i new_ver="10#${xtoy#*_to_}" if ((old_ver >= new_ver)); then From ee2feb4c2a6875d9fb4ad805ad304fe0262b5853 Mon Sep 17 00:00:00 2001 From: tooomm Date: Fri, 24 Jul 2026 14:25:39 +0200 Subject: [PATCH 19/22] add vs to build win matrix to confirm functionality --- .ci/compile.sh | 5 ++++- .github/workflows/desktop-build.yml | 22 ++++++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.ci/compile.sh b/.ci/compile.sh index e577e11dd..ae6284478 100755 --- a/.ci/compile.sh +++ b/.ci/compile.sh @@ -274,6 +274,9 @@ fi # Configure CMake echo "::group::Configure CMake" cmake --version + if [[ "$CMAKE_GENERATOR" =~ ^Ninja ]]; then + ninja --version + fi echo "Running cmake with flags: ${flags[*]}" cmake .. "${flags[@]}" echo "::endgroup::" @@ -281,7 +284,7 @@ echo "::endgroup::" # Build echo "::group::Build project" echo "Running cmake --build with flags: ${buildflags[*]}" -cmake --build . "${buildflags[@]}" --verbose +cmake --build . --verbose "${buildflags[@]}" echo "::endgroup::" if [[ $USE_CCACHE == "1" ]]; then diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.yml index 9f1f051b0..020cd908f 100644 --- a/.github/workflows/desktop-build.yml +++ b/.github/workflows/desktop-build.yml @@ -266,6 +266,7 @@ jobs: runner: macos-15-intel ccache_eviction_age: 7d + cmake_generator: Ninja make_package: 1 override_target: 13 package_suffix: "-macOS13_Intel" @@ -281,6 +282,7 @@ jobs: runner: macos-14 ccache_eviction_age: 7d + cmake_generator: Ninja make_package: 1 package_suffix: "-macOS14" qt_version: 6.11.0 @@ -295,6 +297,7 @@ jobs: runner: macos-15 ccache_eviction_age: 7d + cmake_generator: Ninja make_package: 1 package_suffix: "-macOS15" qt_version: 6.11.0 @@ -309,6 +312,7 @@ jobs: runner: macos-15 ccache_eviction_age: 7d + cmake_generator: Ninja qt_version: 6.11.0 qt_modules: qtimageformats qtmultimedia qtwebsockets soc: Apple @@ -320,20 +324,32 @@ jobs: target: 10 runner: windows-2025 + cmake_generator: Ninja make_package: 1 package_suffix: "-Win10" qt_version: 6.11.0 qt_modules: qtimageformats qtmultimedia qtwebsockets type: Release - name: ${{ matrix.os }} ${{ matrix.target }}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} + - os: Windows + 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 + qt_modules: qtimageformats qtmultimedia qtwebsockets + type: Release + + name: ${{ matrix.os }} ${{ matrix.target }}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }}${{ matrix.cmake_generator != 'Ninja' && ' VS' || '' }} needs: configure runs-on: ${{ matrix.runner }} timeout-minutes: 100 env: CCACHE_DIR: ${{ github.workspace }}/.cache/ 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' steps: - name: "Checkout" @@ -431,6 +447,8 @@ 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 }} From c9d5e4ebbad82dc515accde0d5b79e956d989236 Mon Sep 17 00:00:00 2001 From: tooomm Date: Fri, 24 Jul 2026 15:49:28 +0200 Subject: [PATCH 20/22] tweak visual studio test build --- .ci/compile.sh | 8 ++++---- .github/workflows/desktop-build.yml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.ci/compile.sh b/.ci/compile.sh index ae6284478..5c5e737cd 100755 --- a/.ci/compile.sh +++ b/.ci/compile.sh @@ -259,7 +259,7 @@ if [[ $RUNNER_OS == macOS ]]; then elif [[ $RUNNER_OS == Windows ]]; then if [[ "$CMAKE_GENERATOR" =~ ^Visual\ Studio ]]; 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 buildflags+=(-- -p:UseMultiToolTask=true -p:EnableClServerMode=true) fi @@ -275,15 +275,15 @@ fi echo "::group::Configure CMake" cmake --version if [[ "$CMAKE_GENERATOR" =~ ^Ninja ]]; then - ninja --version + echo "ninja $(ninja --version)" fi -echo "Running cmake with flags: ${flags[*]}" +echo "Running CMake with these flags: ${flags[*]}" cmake .. "${flags[@]}" echo "::endgroup::" # Build echo "::group::Build project" -echo "Running cmake --build with flags: ${buildflags[*]}" +echo "Running CMake with these build flags: ${buildflags[*]}" cmake --build . --verbose "${buildflags[@]}" echo "::endgroup::" diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.yml index 020cd908f..6c1e475f3 100644 --- a/.github/workflows/desktop-build.yml +++ b/.github/workflows/desktop-build.yml @@ -338,7 +338,7 @@ jobs: cmake_generator: "Visual Studio 18 2026" cmake_generator_platform: x64 make_package: 1 - package_suffix: "-Win10" + package_suffix: "-Win10_VS" qt_version: 6.11.0 qt_modules: qtimageformats qtmultimedia qtwebsockets type: Release @@ -538,7 +538,7 @@ jobs: path: ${{ steps.build.outputs.path }} - name: "[Windows] Upload PDBs (Program Databases)" - if: matrix.os == 'Windows' && github.ref_type != 'tag' + if: matrix.os == 'Windows' && github.ref_type != 'tag' && matrix.cmake_generator == 'Ninja' uses: actions/upload-artifact@v7 with: if-no-files-found: error From afbf303a4ef85f96c45e35ce5e21ef794d2d9343 Mon Sep 17 00:00:00 2001 From: tooomm Date: Fri, 24 Jul 2026 17:33:11 +0200 Subject: [PATCH 21/22] remove verbose logging --- .ci/compile.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/compile.sh b/.ci/compile.sh index 5c5e737cd..b0ce43cf8 100755 --- a/.ci/compile.sh +++ b/.ci/compile.sh @@ -284,7 +284,7 @@ echo "::endgroup::" # Build echo "::group::Build project" echo "Running CMake with these build flags: ${buildflags[*]}" -cmake --build . --verbose "${buildflags[@]}" +cmake --build . "${buildflags[@]}" echo "::endgroup::" if [[ $USE_CCACHE == "1" ]]; then From 9624f257c30151f2506e23e043b24163f3df7530 Mon Sep 17 00:00:00 2001 From: tooomm Date: Fri, 24 Jul 2026 18:50:06 +0200 Subject: [PATCH 22/22] comments --- .ci/compile.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.ci/compile.sh b/.ci/compile.sh index b0ce43cf8..be9923a66 100755 --- a/.ci/compile.sh +++ b/.ci/compile.sh @@ -133,6 +133,14 @@ fi if [[ ! $BUILD_DIR ]]; then BUILD_DIR="build" fi + +# Can be omitted when using modern CMake config commands below for config and build (chceck BUILD_DIR logic above as well) +# cmake -S . -B "$BUILD_DIR" "${flags[@]}" +# cmake --build "$BUILD_DIR" "${buildflags[@]}" +# Required to update other commands with build folder as well: +# ctest --build-config "$BUILDTYPE" --test-dir "$BUILD_DIR" --output-on-failure +# cmake --build "$BUILD_DIR" --target install --config "$BUILDTYPE" +# cmake --build "$BUILD_DIR" --target package --config "$BUILDTYPE" (remove cd from renaming) mkdir -p "$BUILD_DIR" cd "$BUILD_DIR" @@ -180,7 +188,7 @@ function ccachestatsverbose() { fi } -# Prepare +# Prepare compilation if [[ $RUNNER_OS == macOS ]]; then # 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 @@ -278,6 +286,7 @@ cmake --version echo "ninja $(ninja --version)" fi echo "Running CMake with these flags: ${flags[*]}" +# Equivalent to modern and more explicit "cmake -S .. -B build" cmake .. "${flags[@]}" echo "::endgroup::" @@ -313,21 +322,26 @@ if [[ $RUNNER_OS == macOS ]]; then echo "::endgroup::" fi +# Test if [[ $MAKE_TEST ]]; then echo "::group::Run tests" ctest --version - ctest -C "$BUILDTYPE" --output-on-failure + ctest --build-config "$BUILDTYPE" --output-on-failure echo "::endgroup::" fi +# Install if [[ $MAKE_INSTALL ]]; then echo "::group::Install" + # Equivalent to modern "cmake --install ." cmake --build . --target install --config "$BUILDTYPE" echo "::endgroup::" fi +# Package if [[ $MAKE_PACKAGE ]]; then echo "::group::Create package" + cpack --version cmake --build . --target package --config "$BUILDTYPE" echo "::endgroup::"