From 069556326f5ff12357ae8f80c40a4114758c7b65 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 11 Jul 2025 15:30:03 +0200 Subject: [PATCH 01/30] WIP: GRDK (Gaming.Desktop.x64) --- .github/workflows/ci.yml | 10 +++++ include/sentry.h | 2 +- toolchains/xbox/grdk_toolchain.cmake | 62 ++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 toolchains/xbox/grdk_toolchain.cmake diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d47bbf2c6..b52630127 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -146,6 +146,10 @@ jobs: ANDROID_API: 35 ANDROID_NDK: 27.2.12479018 ANDROID_ARCH: x86_64 + - name: Windows (Gaming.Desktop.x64) + os: windows-2025 + GDK_VERSION: 2504.1.4046 + CMAKE_DEFINES: -DCMAKE_TOOLCHAIN_FILE="./toolchains/xbox/grdk_toolchain.cmake" name: ${{ matrix.name }} runs-on: ${{ matrix.os }} @@ -163,6 +167,7 @@ jobs: SYSTEM_VERSION_COMPAT: ${{ matrix.SYSTEM_VERSION_COMPAT }} VS_GENERATOR_TOOLSET: ${{ matrix.VS_GENERATOR_TOOLSET }} SYSTEM_PYTHON: ${{ matrix.SYSTEM_PYTHON }} + GDK_VERSION: ${{ matrix.GDK_VERSION }} steps: - uses: actions/checkout@v4 @@ -257,6 +262,11 @@ jobs: run: bash scripts/start-android.sh timeout-minutes: 20 + - name: Setup GDK + if: ${{ runner.os == 'Windows' && env['GDK_VERSION'] }} + run: | + winget install --accept-source-agreements --accept-package-agreements --silent --disable-interactivity --version $env:GDK_VERSION Microsoft.Gaming.GDK + - name: Add sentry.native.test hostname if: ${{ runner.os == 'Windows' }} # The path is usually C:\Windows\System32\drivers\etc\hosts diff --git a/include/sentry.h b/include/sentry.h index 16d678bcc..53cd2ed0d 100644 --- a/include/sentry.h +++ b/include/sentry.h @@ -36,7 +36,7 @@ extern "C" { /* common platform detection */ #ifdef _WIN32 # define SENTRY_PLATFORM_WINDOWS -# ifdef _GAMING_XBOX +# if defined(_GAMING_XBOX) || defined(_GAMING_DESKTOP) // TODO # define SENTRY_PLATFORM_XBOX # endif #elif defined(__APPLE__) diff --git a/toolchains/xbox/grdk_toolchain.cmake b/toolchains/xbox/grdk_toolchain.cmake new file mode 100644 index 000000000..1fb6fb4dc --- /dev/null +++ b/toolchains/xbox/grdk_toolchain.cmake @@ -0,0 +1,62 @@ +# Adapted by Sentry from: +# https://github.com/microsoft/Xbox-GDK-Samples/blob/710f4bd9095d3796d07505249a7b383857e8a23f/Samples/Tools/CMakeGDKExample/grdk_toolchain.cmake +# +# grdk_toolchain.cmake : CMake Toolchain file for Gaming.Desktop.x64 +# +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +mark_as_advanced(CMAKE_TOOLCHAIN_FILE) + +if(_GRDK_TOOLCHAIN_) + return() +endif() + +# Microsoft Game Development Kit + +include("${CMAKE_CURRENT_LIST_DIR}/DetectGDK.cmake") + +set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES GDK_VERSION) + +set(CMAKE_SYSTEM_NAME WINDOWS) +set(CMAKE_SYSTEM_VERSION 10.0) + +set(CMAKE_GENERATOR_PLATFORM "Gaming.Desktop.x64" CACHE STRING "" FORCE) +set(CMAKE_VS_PLATFORM_NAME "Gaming.Desktop.x64" CACHE STRING "" FORCE) + +# Ensure our platform toolset is x64 +set(CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE "x64" CACHE STRING "" FORCE) + +# Let the GDK MSBuild rules decide the WindowsTargetPlatformVersion +set(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION "" CACHE STRING "" FORCE) + +if(${CMAKE_VERSION} GREATER_EQUAL "3.30") + set(CMAKE_VS_USE_DEBUG_LIBRARIES "$" CACHE STRING "" FORCE) +endif() + +# Sets platform defines +set(CMAKE_CXX_FLAGS_INIT "$ENV{CFLAGS} ${CMAKE_CXX_FLAGS_INIT} -D_GAMING_DESKTOP -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP" CACHE STRING "" FORCE) + +# Add GDK props file +file(GENERATE OUTPUT gdk_build.props INPUT ${CMAKE_CURRENT_LIST_DIR}/gdk_build.props) + +function(add_executable target_name) + _add_executable(${target_name} ${ARGN}) + set_target_properties(${target_name} PROPERTIES VS_USER_PROPS gdk_build.props) +endfunction() + +function(add_library target_name) + _add_library(${target_name} ${ARGN}) + set_target_properties(${target_name} PROPERTIES VS_USER_PROPS gdk_build.props) +endfunction() + +# Find DXC compiler +if(NOT GDK_DXCTool) + set(GDK_DXCTool "dxc.exe") + mark_as_advanced(GDK_DXCTool) +endif() + +# The MicrosoftGame.Config file needs to be in the directory with the project to enable deploy for Gaming.Desktop.x64 +file(GENERATE OUTPUT MicrosoftGame.Config INPUT ${CMAKE_CURRENT_LIST_DIR}/MicrosoftGameConfig.mgc) + +set(_GRDK_TOOLCHAIN_ ON) From 6b101e4c5dca080b39218f813dda5919418ca1ad Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 11 Jul 2025 16:38:02 +0200 Subject: [PATCH 02/30] cmake -G Visual Studio 17 2022 -A Gaming.Desktop.x64 --- .github/workflows/ci.yml | 1 + tests/cmake.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b52630127..25841d68e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -150,6 +150,7 @@ jobs: os: windows-2025 GDK_VERSION: 2504.1.4046 CMAKE_DEFINES: -DCMAKE_TOOLCHAIN_FILE="./toolchains/xbox/grdk_toolchain.cmake" + VS_GENERATOR_TOOLSET: GRDK name: ${{ matrix.name }} runs-on: ${{ matrix.os }} diff --git a/tests/cmake.py b/tests/cmake.py index 0eb89c94f..d5b6fbbd2 100644 --- a/tests/cmake.py +++ b/tests/cmake.py @@ -140,6 +140,10 @@ def cmake(cwd, targets, options=None, cflags=[]): config_cmd.append("-A x64") config_cmd.append("-T ClangCL") + if os.environ.get("VS_GENERATOR_TOOLSET") == "GRDK": + config_cmd.append("-G Visual Studio 17 2022") + config_cmd.append("-A Gaming.Desktop.x64") + for key, value in options.items(): config_cmd.append("-D{}={}".format(key, value)) if sys.platform == "win32" and os.environ.get("TEST_X86"): From 764bbe988a9ebf43106c3170093e296fb3b90b70 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 11 Jul 2025 16:57:16 +0200 Subject: [PATCH 03/30] Cache GDK --- .github/workflows/ci.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 25841d68e..dcf839f8c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -263,6 +263,16 @@ jobs: run: bash scripts/start-android.sh timeout-minutes: 20 + - name: Cache GDK + if: ${{ runner.os == 'Windows' && env['GDK_VERSION'] }} + id: cache-gdk + uses: actions/cache@v4 + with: + path: | + "C:\Program Files (x86)\Microsoft GDK\${{ env['GDK_VERSION'] }}\GRDK" + "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Platforms\Gaming.Desktop.x64\${{ env['GDK_VERSION'] }}" + key: gdk-${{ env['GDK_VERSION'] }} + - name: Setup GDK if: ${{ runner.os == 'Windows' && env['GDK_VERSION'] }} run: | From c7e9c22b85320014fa3849f7db6b819dc8f8e249 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 11 Jul 2025 17:07:42 +0200 Subject: [PATCH 04/30] Add CMakeGDKDesktop.cmake --- CMakeLists.txt | 4 +++ toolchains/xbox/CMakeGDKDesktop.cmake | 40 +++++++++++++++++++++++++++ toolchains/xbox/grdk_toolchain.cmake | 12 +------- 3 files changed, 45 insertions(+), 11 deletions(-) create mode 100644 toolchains/xbox/CMakeGDKDesktop.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 98f30edff..2c71ec1f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,10 @@ if ("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "Gaming.Xbox.XboxOne.x64") include("${SENTRY_TOOLCHAINS_DIR}/xbox/CMakeGDKXboxOne.cmake") set(XBOX TRUE) endif() +if ("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "Gaming.Desktop.x64") + include("${SENTRY_TOOLCHAINS_DIR}/xbox/CMakeGDKDesktop.cmake") + set(XBOX TRUE) +endif() #read sentry-native version file(READ "include/sentry.h" _SENTRY_HEADER_CONTENT) diff --git a/toolchains/xbox/CMakeGDKDesktop.cmake b/toolchains/xbox/CMakeGDKDesktop.cmake new file mode 100644 index 000000000..8250abd1e --- /dev/null +++ b/toolchains/xbox/CMakeGDKDesktop.cmake @@ -0,0 +1,40 @@ +# Adapted by Sentry from: +# https://github.com/microsoft/Xbox-GDK-Samples/blob/710f4bd9095d3796d07505249a7b383857e8a23f/Samples/Tools/CMakeExample/CMake/CMakeGDKDesktop.cmake +# +# CMakeGDKDesktop.cmake : CMake definitions for Microsoft GDK targeting PC +# +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +mark_as_advanced(CMAKE_TOOLCHAIN_FILE) + +if(_GDK_DESKTOP_TOOLCHAIN_) + return() +endif() + +#--- Microsoft Game Development Kit + +include("${CMAKE_CURRENT_LIST_DIR}/DetectGDK.cmake") + +set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES GDK_VERSION BUILD_USING_BWOI) + +set(CMAKE_SYSTEM_NAME WINDOWS) +set(CMAKE_SYSTEM_VERSION 10.0) + +#--- GameRuntime and Extension Libraries +include(${CMAKE_CURRENT_LIST_DIR}/GDK-targets.cmake) + +message("Microsoft GDK = ${Console_SdkRoot}/${GDK_VERSION}") + +#--- Tools +find_program(MAKEPKG_TOOL makepkg.exe + REQUIRED NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH + HINTS "${Console_SdkRoot}/bin") + +message("MGC Tool = ${MAKEPKG_TOOL}") + +find_program(DIRECTX_DXC_TOOL dxc.exe REQUIRED) + +message("DXC Compiler = ${DIRECTX_DXC_TOOL}") + +set(_GDK_DESKTOP_TOOLCHAIN_ ON) diff --git a/toolchains/xbox/grdk_toolchain.cmake b/toolchains/xbox/grdk_toolchain.cmake index 1fb6fb4dc..ec31ae291 100644 --- a/toolchains/xbox/grdk_toolchain.cmake +++ b/toolchains/xbox/grdk_toolchain.cmake @@ -40,16 +40,6 @@ set(CMAKE_CXX_FLAGS_INIT "$ENV{CFLAGS} ${CMAKE_CXX_FLAGS_INIT} -D_GAMING_DESKTOP # Add GDK props file file(GENERATE OUTPUT gdk_build.props INPUT ${CMAKE_CURRENT_LIST_DIR}/gdk_build.props) -function(add_executable target_name) - _add_executable(${target_name} ${ARGN}) - set_target_properties(${target_name} PROPERTIES VS_USER_PROPS gdk_build.props) -endfunction() - -function(add_library target_name) - _add_library(${target_name} ${ARGN}) - set_target_properties(${target_name} PROPERTIES VS_USER_PROPS gdk_build.props) -endfunction() - # Find DXC compiler if(NOT GDK_DXCTool) set(GDK_DXCTool "dxc.exe") @@ -57,6 +47,6 @@ if(NOT GDK_DXCTool) endif() # The MicrosoftGame.Config file needs to be in the directory with the project to enable deploy for Gaming.Desktop.x64 -file(GENERATE OUTPUT MicrosoftGame.Config INPUT ${CMAKE_CURRENT_LIST_DIR}/MicrosoftGameConfig.mgc) +#file(GENERATE OUTPUT MicrosoftGame.Config INPUT ${CMAKE_CURRENT_LIST_DIR}/MicrosoftGameConfig.mgc) set(_GRDK_TOOLCHAIN_ ON) From 0b321a7b46574880f53fa29d1ebe63ea82f97eec Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 11 Jul 2025 17:16:25 +0200 Subject: [PATCH 05/30] add missing cache-gdk.outputs.cache-hit check --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dcf839f8c..bb7e078a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -274,7 +274,7 @@ jobs: key: gdk-${{ env['GDK_VERSION'] }} - name: Setup GDK - if: ${{ runner.os == 'Windows' && env['GDK_VERSION'] }} + if: ${{ runner.os == 'Windows' && env['GDK_VERSION'] && steps.cache-gdk.outputs.cache-hit != 'true'}} run: | winget install --accept-source-agreements --accept-package-agreements --silent --disable-interactivity --version $env:GDK_VERSION Microsoft.Gaming.GDK From 5a15eaeedd130ff9d4e2937a4957771c2084a87e Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 11 Jul 2025 17:29:58 +0200 Subject: [PATCH 06/30] pass GDK_VERSION --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb7e078a5..209316e46 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -149,7 +149,7 @@ jobs: - name: Windows (Gaming.Desktop.x64) os: windows-2025 GDK_VERSION: 2504.1.4046 - CMAKE_DEFINES: -DCMAKE_TOOLCHAIN_FILE="./toolchains/xbox/grdk_toolchain.cmake" + CMAKE_DEFINES: -DCMAKE_TOOLCHAIN_FILE="./toolchains/xbox/grdk_toolchain.cmake" -DGDK_VERSION=250401 VS_GENERATOR_TOOLSET: GRDK name: ${{ matrix.name }} From 2fec2a18b6e12f580aecec9e6918e8ce3ea618c9 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 11 Jul 2025 17:32:50 +0200 Subject: [PATCH 07/30] restore & save cache --- .github/workflows/ci.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 209316e46..a546a1792 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -263,10 +263,10 @@ jobs: run: bash scripts/start-android.sh timeout-minutes: 20 - - name: Cache GDK + - name: Restore GDK if: ${{ runner.os == 'Windows' && env['GDK_VERSION'] }} id: cache-gdk - uses: actions/cache@v4 + uses: actions/cache/restore@v4 with: path: | "C:\Program Files (x86)\Microsoft GDK\${{ env['GDK_VERSION'] }}\GRDK" @@ -278,6 +278,15 @@ jobs: run: | winget install --accept-source-agreements --accept-package-agreements --silent --disable-interactivity --version $env:GDK_VERSION Microsoft.Gaming.GDK + - name: Cache GDK + if: ${{ runner.os == 'Windows' && env['GDK_VERSION'] }} + uses: actions/cache/save@v4 + with: + path: | + "C:\Program Files (x86)\Microsoft GDK\${{ env['GDK_VERSION'] }}\GRDK" + "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Platforms\Gaming.Desktop.x64\${{ env['GDK_VERSION'] }}" + key: gdk-${{ env['GDK_VERSION'] }} + - name: Add sentry.native.test hostname if: ${{ runner.os == 'Windows' }} # The path is usually C:\Windows\System32\drivers\etc\hosts From afc6d3bf4e9134a56b7f006ee5fbad6e7afadbff Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 11 Jul 2025 17:38:14 +0200 Subject: [PATCH 08/30] disable zlib --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a546a1792..b677b49a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -241,7 +241,7 @@ jobs: run: . "scripts\install-llvm-mingw.ps1" - name: Set up zlib for Windows - if: ${{ runner.os == 'Windows' }} + if: ${{ runner.os == 'Windows' && !env['GDK_VERSION'] }} shell: powershell run: . "scripts\install-zlib.ps1" From 18c6016edd45f455ce12506c095220369bd46c8e Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 11 Jul 2025 18:05:55 +0200 Subject: [PATCH 09/30] GDK_VERSION vs. GDK_WINGET_VERSION :( --- .github/workflows/ci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b677b49a8..10495e517 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -148,7 +148,8 @@ jobs: ANDROID_ARCH: x86_64 - name: Windows (Gaming.Desktop.x64) os: windows-2025 - GDK_VERSION: 2504.1.4046 + GDK_VERSION: 250401 + GDK_WINGET_VERSION: 2504.1.4046 CMAKE_DEFINES: -DCMAKE_TOOLCHAIN_FILE="./toolchains/xbox/grdk_toolchain.cmake" -DGDK_VERSION=250401 VS_GENERATOR_TOOLSET: GRDK @@ -169,6 +170,7 @@ jobs: VS_GENERATOR_TOOLSET: ${{ matrix.VS_GENERATOR_TOOLSET }} SYSTEM_PYTHON: ${{ matrix.SYSTEM_PYTHON }} GDK_VERSION: ${{ matrix.GDK_VERSION }} + GDK_WINGET_VERSION: ${{ matrix.GDK_WINGET_VERSION }} steps: - uses: actions/checkout@v4 @@ -274,9 +276,9 @@ jobs: key: gdk-${{ env['GDK_VERSION'] }} - name: Setup GDK - if: ${{ runner.os == 'Windows' && env['GDK_VERSION'] && steps.cache-gdk.outputs.cache-hit != 'true'}} + if: ${{ runner.os == 'Windows' && env['GDK_WINGET_VERSION'] && steps.cache-gdk.outputs.cache-hit != 'true'}} run: | - winget install --accept-source-agreements --accept-package-agreements --silent --disable-interactivity --version $env:GDK_VERSION Microsoft.Gaming.GDK + winget install --accept-source-agreements --accept-package-agreements --silent --disable-interactivity --version $env:GDK_WINGET_VERSION Microsoft.Gaming.GDK - name: Cache GDK if: ${{ runner.os == 'Windows' && env['GDK_VERSION'] }} From 998587c5860a0013c26ce4e097daf6b89da2dd55 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 11 Jul 2025 18:51:05 +0200 Subject: [PATCH 10/30] try forward slashes --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 10495e517..fa240d7e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -271,8 +271,8 @@ jobs: uses: actions/cache/restore@v4 with: path: | - "C:\Program Files (x86)\Microsoft GDK\${{ env['GDK_VERSION'] }}\GRDK" - "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Platforms\Gaming.Desktop.x64\${{ env['GDK_VERSION'] }}" + "C:/Program Files (x86)/Microsoft GDK/${{ env['GDK_VERSION'] }}" + "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Microsoft/VC/v170/Platforms/Gaming.Desktop.x64/${{ env['GDK_VERSION'] }}" key: gdk-${{ env['GDK_VERSION'] }} - name: Setup GDK @@ -285,8 +285,8 @@ jobs: uses: actions/cache/save@v4 with: path: | - "C:\Program Files (x86)\Microsoft GDK\${{ env['GDK_VERSION'] }}\GRDK" - "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Platforms\Gaming.Desktop.x64\${{ env['GDK_VERSION'] }}" + "C:/Program Files (x86)/Microsoft GDK/${{ env['GDK_VERSION'] }}" + "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Microsoft/VC/v170/Platforms/Gaming.Desktop.x64/${{ env['GDK_VERSION'] }}" key: gdk-${{ env['GDK_VERSION'] }} - name: Add sentry.native.test hostname From 80a7a3dd63948ce5dc47658e7f3ddb2a062a021b Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 11 Jul 2025 18:54:07 +0200 Subject: [PATCH 11/30] adapt DIRECTX_DXC_TOOL from the others --- toolchains/xbox/CMakeGDKDesktop.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/toolchains/xbox/CMakeGDKDesktop.cmake b/toolchains/xbox/CMakeGDKDesktop.cmake index 8250abd1e..124bc9f5a 100644 --- a/toolchains/xbox/CMakeGDKDesktop.cmake +++ b/toolchains/xbox/CMakeGDKDesktop.cmake @@ -33,7 +33,9 @@ find_program(MAKEPKG_TOOL makepkg.exe message("MGC Tool = ${MAKEPKG_TOOL}") -find_program(DIRECTX_DXC_TOOL dxc.exe REQUIRED) +find_program(DIRECTX_DXC_TOOL dxc.exe + REQUIRED NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH + HINTS "${Console_SdkRoot}/${GDK_VERSION}") message("DXC Compiler = ${DIRECTX_DXC_TOOL}") From 674f674cdbc102fc4dfc616ae800fc281e8572d1 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 11 Jul 2025 23:08:26 +0200 Subject: [PATCH 12/30] drop quotes --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa240d7e0..05f18cb35 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -271,8 +271,8 @@ jobs: uses: actions/cache/restore@v4 with: path: | - "C:/Program Files (x86)/Microsoft GDK/${{ env['GDK_VERSION'] }}" - "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Microsoft/VC/v170/Platforms/Gaming.Desktop.x64/${{ env['GDK_VERSION'] }}" + C:/Program Files (x86)/Microsoft GDK/${{ env['GDK_VERSION'] }} + C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Microsoft/VC/v170/Platforms/Gaming.Desktop.x64/${{ env['GDK_VERSION'] }} key: gdk-${{ env['GDK_VERSION'] }} - name: Setup GDK @@ -285,8 +285,8 @@ jobs: uses: actions/cache/save@v4 with: path: | - "C:/Program Files (x86)/Microsoft GDK/${{ env['GDK_VERSION'] }}" - "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Microsoft/VC/v170/Platforms/Gaming.Desktop.x64/${{ env['GDK_VERSION'] }}" + C:/Program Files (x86)/Microsoft GDK/${{ env['GDK_VERSION'] }} + C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Microsoft/VC/v170/Platforms/Gaming.Desktop.x64/${{ env['GDK_VERSION'] }} key: gdk-${{ env['GDK_VERSION'] }} - name: Add sentry.native.test hostname From 57a1c5da0ac097a7a8a81480a97de17f673e1f1c Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 11 Jul 2025 23:14:09 +0200 Subject: [PATCH 13/30] Revert "adapt DIRECTX_DXC_TOOL from the others" This reverts commit 80a7a3dd63948ce5dc47658e7f3ddb2a062a021b. --- toolchains/xbox/CMakeGDKDesktop.cmake | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/toolchains/xbox/CMakeGDKDesktop.cmake b/toolchains/xbox/CMakeGDKDesktop.cmake index 124bc9f5a..8250abd1e 100644 --- a/toolchains/xbox/CMakeGDKDesktop.cmake +++ b/toolchains/xbox/CMakeGDKDesktop.cmake @@ -33,9 +33,7 @@ find_program(MAKEPKG_TOOL makepkg.exe message("MGC Tool = ${MAKEPKG_TOOL}") -find_program(DIRECTX_DXC_TOOL dxc.exe - REQUIRED NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH - HINTS "${Console_SdkRoot}/${GDK_VERSION}") +find_program(DIRECTX_DXC_TOOL dxc.exe REQUIRED) message("DXC Compiler = ${DIRECTX_DXC_TOOL}") From 6ea7a950dd766d9fed2bc3e244b74c44b819ab6d Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 11 Jul 2025 23:15:10 +0200 Subject: [PATCH 14/30] DIRECTX_DXC_TOOL: drop REQUIRED --- toolchains/xbox/CMakeGDKDesktop.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolchains/xbox/CMakeGDKDesktop.cmake b/toolchains/xbox/CMakeGDKDesktop.cmake index 8250abd1e..ee9cd14a7 100644 --- a/toolchains/xbox/CMakeGDKDesktop.cmake +++ b/toolchains/xbox/CMakeGDKDesktop.cmake @@ -33,7 +33,7 @@ find_program(MAKEPKG_TOOL makepkg.exe message("MGC Tool = ${MAKEPKG_TOOL}") -find_program(DIRECTX_DXC_TOOL dxc.exe REQUIRED) +find_program(DIRECTX_DXC_TOOL dxc.exe) message("DXC Compiler = ${DIRECTX_DXC_TOOL}") From 14129d3d7c7c152cd5db17435a774b044d7d79c0 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 11 Jul 2025 23:45:07 +0200 Subject: [PATCH 15/30] GDK vs. XBOX --- CMakeLists.txt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c71ec1f8..07b1bcab6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,14 +12,16 @@ set(SENTRY_TOOLCHAINS_DIR "${CMAKE_CURRENT_LIST_DIR}/toolchains") if ("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "Gaming.Xbox.Scarlett.x64") include("${SENTRY_TOOLCHAINS_DIR}/xbox/CMakeGDKScarlett.cmake") set(XBOX TRUE) + set(GDK TRUE) endif() if ("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "Gaming.Xbox.XboxOne.x64") include("${SENTRY_TOOLCHAINS_DIR}/xbox/CMakeGDKXboxOne.cmake") set(XBOX TRUE) + set(GDK TRUE) endif() if ("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "Gaming.Desktop.x64") include("${SENTRY_TOOLCHAINS_DIR}/xbox/CMakeGDKDesktop.cmake") - set(XBOX TRUE) + set(GDK TRUE) endif() #read sentry-native version @@ -85,7 +87,7 @@ option(SENTRY_BUILD_TESTS "Build sentry-native tests" "${SENTRY_MAIN_PROJECT}") option(SENTRY_BUILD_EXAMPLES "Build sentry-native example(s)" "${SENTRY_MAIN_PROJECT}") option(SENTRY_BUILD_BENCHMARKS "Build sentry-native benchmarks" OFF) -if(NOT XBOX) +if(NOT GDK) option(SENTRY_LINK_PTHREAD "Link platform threads library" ON) if(SENTRY_LINK_PTHREAD) set(THREADS_PREFER_PTHREAD_FLAG ON) @@ -175,7 +177,7 @@ option(SENTRY_ENABLE_INSTALL "Enable sentry installation" "${SENTRY_MAIN_PROJECT if(MSVC AND CMAKE_GENERATOR_TOOLSET MATCHES "_xp$") message(WARNING "Crashpad is not supported for MSVC with XP toolset. Default backend was switched to 'breakpad'") set(SENTRY_DEFAULT_BACKEND "breakpad") -elseif(MSVC AND XBOX) +elseif(MSVC AND GDK) set(SENTRY_DEFAULT_BACKEND "breakpad") elseif((APPLE AND NOT IOS) OR WIN32 OR LINUX) set(SENTRY_DEFAULT_BACKEND "crashpad") @@ -292,7 +294,7 @@ endfunction() # ===== sentry library ===== add_library(sentry ${SENTRY_LIBRARY_TYPE} "${PROJECT_SOURCE_DIR}/vendor/mpack.c") -if (XBOX) +if (GDK) set_target_properties(sentry PROPERTIES VS_USER_PROPS gdk_build.props) endif() target_sources(sentry PRIVATE "${PROJECT_SOURCE_DIR}/include/sentry.h") @@ -387,7 +389,7 @@ if(MSVC) # using `/Wall` is not feasible, as it spews tons of warnings from windows headers # supress C5105, introduced in VS 16.8, which breaks on the Windows SDKs own `winbase.h` header - if (XBOX) + if (GDK) target_compile_options(sentry PRIVATE $) else() target_compile_options(sentry PRIVATE $) @@ -504,7 +506,7 @@ if(SENTRY_TRANSPORT_WINHTTP) endif() # handle platform threads library -if(NOT XBOX) +if(NOT GDK) if(SENTRY_LINK_PTHREAD) list(APPEND _SENTRY_PLATFORM_LIBS "Threads::Threads") endif() @@ -709,7 +711,7 @@ endif() if(SENTRY_BUILD_EXAMPLES) add_executable(sentry_example examples/example.c) - if(XBOX) + if(GDK) set_target_properties(sentry_example PROPERTIES VS_USER_PROPS gdk_build.props) endif() target_link_libraries(sentry_example PRIVATE sentry) From f9f859266c0d94ef57af4df70c5e77baa2e3c414 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 11 Jul 2025 23:47:37 +0200 Subject: [PATCH 16/30] check cache-gdk.outputs.cache-hit --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05f18cb35..2900dfbee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -276,12 +276,12 @@ jobs: key: gdk-${{ env['GDK_VERSION'] }} - name: Setup GDK - if: ${{ runner.os == 'Windows' && env['GDK_WINGET_VERSION'] && steps.cache-gdk.outputs.cache-hit != 'true'}} + if: ${{ runner.os == 'Windows' && env['GDK_WINGET_VERSION'] && steps.cache-gdk.outputs.cache-hit != 'true' }} run: | winget install --accept-source-agreements --accept-package-agreements --silent --disable-interactivity --version $env:GDK_WINGET_VERSION Microsoft.Gaming.GDK - name: Cache GDK - if: ${{ runner.os == 'Windows' && env['GDK_VERSION'] }} + if: ${{ runner.os == 'Windows' && env['GDK_VERSION'] && steps.cache-gdk.outputs.cache-hit != 'true' }} uses: actions/cache/save@v4 with: path: | From cfdea920077b72af0ab0c6e221ff66970f29cd7a Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 11 Jul 2025 23:55:02 +0200 Subject: [PATCH 17/30] comment out cache --- .github/workflows/ci.yml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2900dfbee..cb4ea75e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -265,29 +265,29 @@ jobs: run: bash scripts/start-android.sh timeout-minutes: 20 - - name: Restore GDK - if: ${{ runner.os == 'Windows' && env['GDK_VERSION'] }} - id: cache-gdk - uses: actions/cache/restore@v4 - with: - path: | - C:/Program Files (x86)/Microsoft GDK/${{ env['GDK_VERSION'] }} - C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Microsoft/VC/v170/Platforms/Gaming.Desktop.x64/${{ env['GDK_VERSION'] }} - key: gdk-${{ env['GDK_VERSION'] }} + # - name: Restore GDK + # if: ${{ runner.os == 'Windows' && env['GDK_VERSION'] }} + # id: cache-gdk + # uses: actions/cache/restore@v4 + # with: + # path: | + # C:/Program Files (x86)/Microsoft GDK/${{ env['GDK_VERSION'] }} + # C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Microsoft/VC/v170/Platforms/Gaming.Desktop.x64/${{ env['GDK_VERSION'] }} + # key: gdk-${{ env['GDK_VERSION'] }} - name: Setup GDK - if: ${{ runner.os == 'Windows' && env['GDK_WINGET_VERSION'] && steps.cache-gdk.outputs.cache-hit != 'true' }} + if: ${{ runner.os == 'Windows' && env['GDK_WINGET_VERSION'] }} # && steps.cache-gdk.outputs.cache-hit != 'true' run: | winget install --accept-source-agreements --accept-package-agreements --silent --disable-interactivity --version $env:GDK_WINGET_VERSION Microsoft.Gaming.GDK - - name: Cache GDK - if: ${{ runner.os == 'Windows' && env['GDK_VERSION'] && steps.cache-gdk.outputs.cache-hit != 'true' }} - uses: actions/cache/save@v4 - with: - path: | - C:/Program Files (x86)/Microsoft GDK/${{ env['GDK_VERSION'] }} - C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Microsoft/VC/v170/Platforms/Gaming.Desktop.x64/${{ env['GDK_VERSION'] }} - key: gdk-${{ env['GDK_VERSION'] }} + # - name: Cache GDK + # if: ${{ runner.os == 'Windows' && env['GDK_VERSION'] && steps.cache-gdk.outputs.cache-hit != 'true' }} + # uses: actions/cache/save@v4 + # with: + # path: | + # C:/Program Files (x86)/Microsoft GDK/${{ env['GDK_VERSION'] }} + # C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Microsoft/VC/v170/Platforms/Gaming.Desktop.x64/${{ env['GDK_VERSION'] }} + # key: gdk-${{ env['GDK_VERSION'] }} - name: Add sentry.native.test hostname if: ${{ runner.os == 'Windows' }} From afcd2dd6341e141b6f48918b0399c70598ccdb38 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sat, 12 Jul 2025 00:05:42 +0200 Subject: [PATCH 18/30] dbg --- toolchains/xbox/GDK-targets.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolchains/xbox/GDK-targets.cmake b/toolchains/xbox/GDK-targets.cmake index 6a23ddfaf..9d6f79866 100644 --- a/toolchains/xbox/GDK-targets.cmake +++ b/toolchains/xbox/GDK-targets.cmake @@ -36,7 +36,7 @@ else() endif() if(NOT EXISTS "${Console_SdkRoot}/${GDK_VERSION}") - message(FATAL_ERROR "ERROR: Cannot locate Microsoft Game Development Kit (GDK) - ${GDK_VERSION}") + message(FATAL_ERROR "ERROR: Cannot locate Microsoft Game Development Kit (GDK) - ${GDK_VERSION} in ${Console_SdkRoot}") endif() #--- GameRuntime Library (for Xbox these are included in the Console_Libs variable) From 17262edc0b264e6ac5dc9eaf01faf601dda55ba1 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sat, 12 Jul 2025 00:22:50 +0200 Subject: [PATCH 19/30] restore cache --- .github/workflows/ci.yml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb4ea75e4..b337cf9f5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -265,29 +265,29 @@ jobs: run: bash scripts/start-android.sh timeout-minutes: 20 - # - name: Restore GDK - # if: ${{ runner.os == 'Windows' && env['GDK_VERSION'] }} - # id: cache-gdk - # uses: actions/cache/restore@v4 - # with: - # path: | - # C:/Program Files (x86)/Microsoft GDK/${{ env['GDK_VERSION'] }} - # C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Microsoft/VC/v170/Platforms/Gaming.Desktop.x64/${{ env['GDK_VERSION'] }} - # key: gdk-${{ env['GDK_VERSION'] }} + - name: Restore GDK + if: ${{ runner.os == 'Windows' && env['GDK_VERSION'] }} + id: cache-gdk + uses: actions/cache/restore@v4 + with: + path: | + C:/Program Files (x86)/Microsoft GDK + C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Microsoft/VC/v170/Platforms/Gaming.Desktop.x64/${{ env['GDK_VERSION'] }} + key: gdk-${{ env['GDK_VERSION'] }} - name: Setup GDK - if: ${{ runner.os == 'Windows' && env['GDK_WINGET_VERSION'] }} # && steps.cache-gdk.outputs.cache-hit != 'true' + if: ${{ runner.os == 'Windows' && env['GDK_WINGET_VERSION'] && steps.cache-gdk.outputs.cache-hit != 'true' }} run: | winget install --accept-source-agreements --accept-package-agreements --silent --disable-interactivity --version $env:GDK_WINGET_VERSION Microsoft.Gaming.GDK - # - name: Cache GDK - # if: ${{ runner.os == 'Windows' && env['GDK_VERSION'] && steps.cache-gdk.outputs.cache-hit != 'true' }} - # uses: actions/cache/save@v4 - # with: - # path: | - # C:/Program Files (x86)/Microsoft GDK/${{ env['GDK_VERSION'] }} - # C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Microsoft/VC/v170/Platforms/Gaming.Desktop.x64/${{ env['GDK_VERSION'] }} - # key: gdk-${{ env['GDK_VERSION'] }} + - name: Cache GDK + if: ${{ runner.os == 'Windows' && env['GDK_VERSION'] && steps.cache-gdk.outputs.cache-hit != 'true' }} + uses: actions/cache/save@v4 + with: + path: | + C:/Program Files (x86)/Microsoft GDK + C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Microsoft/VC/v170/Platforms/Gaming.Desktop.x64/${{ env['GDK_VERSION'] }} + key: gdk-${{ env['GDK_VERSION'] }} - name: Add sentry.native.test hostname if: ${{ runner.os == 'Windows' }} From e5513a695c34aa662082d00d0681081d6af760b1 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sat, 12 Jul 2025 00:23:55 +0200 Subject: [PATCH 20/30] fixup registry --- .github/workflows/ci.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b337cf9f5..c5cd94f1f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -275,11 +275,19 @@ jobs: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Microsoft/VC/v170/Platforms/Gaming.Desktop.x64/${{ env['GDK_VERSION'] }} key: gdk-${{ env['GDK_VERSION'] }} - - name: Setup GDK + - name: Install GDK if: ${{ runner.os == 'Windows' && env['GDK_WINGET_VERSION'] && steps.cache-gdk.outputs.cache-hit != 'true' }} run: | winget install --accept-source-agreements --accept-package-agreements --silent --disable-interactivity --version $env:GDK_WINGET_VERSION Microsoft.Gaming.GDK + - name: Setup GDK + run: | + $path = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\GDK' + if (-not (Test-Path $path)) { + New-Item -Path $path -Force | Out-Null + } + Set-ItemProperty -Path $path -Name GRDKInstallPath -Value 'C:\Program Files (x86)\Microsoft GDK\' + - name: Cache GDK if: ${{ runner.os == 'Windows' && env['GDK_VERSION'] && steps.cache-gdk.outputs.cache-hit != 'true' }} uses: actions/cache/save@v4 From d298015683b6968d727dcfdc3df72af9f7f63eff Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sat, 12 Jul 2025 07:25:45 +0200 Subject: [PATCH 21/30] setup gdk is win-only --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5cd94f1f..70ebb940c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -281,6 +281,7 @@ jobs: winget install --accept-source-agreements --accept-package-agreements --silent --disable-interactivity --version $env:GDK_WINGET_VERSION Microsoft.Gaming.GDK - name: Setup GDK + if: ${{ runner.os == 'Windows' && env['GDK_VERSION'] }} run: | $path = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\GDK' if (-not (Test-Path $path)) { From 0d8bf6956c012086d0f454f2341cf05a2b706d1a Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sat, 12 Jul 2025 07:26:10 +0200 Subject: [PATCH 22/30] fix skip_test --- tests/unit/test_symbolizer.c | 2 +- tests/unit/test_unwinder.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/test_symbolizer.c b/tests/unit/test_symbolizer.c index 4e04a2393..ca0835b72 100644 --- a/tests/unit/test_symbolizer.c +++ b/tests/unit/test_symbolizer.c @@ -31,7 +31,7 @@ asserter(const sentry_frame_info_t *info, void *data) SENTRY_TEST(symbolizer) { #if defined(SENTRY_PLATFORM_NX) || defined(SENTRY_PLATFORM_XBOX) - return SKIP_TEST(); + SKIP_TEST(); #endif int called = 0; #ifdef SENTRY_PLATFORM_AIX diff --git a/tests/unit/test_unwinder.c b/tests/unit/test_unwinder.c index d99179dc9..6ceb105df 100644 --- a/tests/unit/test_unwinder.c +++ b/tests/unit/test_unwinder.c @@ -39,7 +39,7 @@ find_frame(const sentry_frame_info_t *info, void *data) SENTRY_TEST(unwinder) { #if defined(SENTRY_PLATFORM_NX) || defined(SENTRY_PLATFORM_XBOX) - return SKIP_TEST(); + SKIP_TEST(); #endif void *backtrace1[MAX_FRAMES] = { 0 }; size_t frame_count1 = invoke_unwinder(backtrace1); From 2715d161e077212f6c850f8e1851e260674d46c6 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sat, 12 Jul 2025 08:28:22 +0200 Subject: [PATCH 23/30] add SENTRY_PLATFORM_GDK --- include/sentry.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/sentry.h b/include/sentry.h index 53cd2ed0d..1b0c816da 100644 --- a/include/sentry.h +++ b/include/sentry.h @@ -36,8 +36,12 @@ extern "C" { /* common platform detection */ #ifdef _WIN32 # define SENTRY_PLATFORM_WINDOWS -# if defined(_GAMING_XBOX) || defined(_GAMING_DESKTOP) // TODO +# if defined(_GAMING_XBOX) # define SENTRY_PLATFORM_XBOX +# define SENTRY_PLATFORM_GDK +# endif +# if defined(_GAMING_DESKTOP) +# define SENTRY_PLATFORM_GDK # endif #elif defined(__APPLE__) # include From d4ccc7b368292a2e64c7971a4c97677b343df965 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sat, 12 Jul 2025 21:59:45 +0200 Subject: [PATCH 24/30] setup-gdk composite action --- .github/actions/setup-gdk/action.yml | 43 ++++++++++++++++++++++++++++ .github/workflows/ci.yml | 37 +++--------------------- 2 files changed, 47 insertions(+), 33 deletions(-) create mode 100644 .github/actions/setup-gdk/action.yml diff --git a/.github/actions/setup-gdk/action.yml b/.github/actions/setup-gdk/action.yml new file mode 100644 index 000000000..c6171e0bf --- /dev/null +++ b/.github/actions/setup-gdk/action.yml @@ -0,0 +1,43 @@ +name: Setup GDK +description: Installs Microsoft.Gaming.GDK using WinGet +inputs: + gdk-version: + description: GDK version to install (e.g. 2504.1.4046) + required: true + +runs: + using: composite + steps: + - name: Cache GDK directory + id: cache-gdk-directory + uses: actions/cache@v4 + with: + path: | + C:/Program Files (x86)/Microsoft GDK + C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Microsoft/VC/v170/Platforms/Gaming.Desktop.x64 + key: setup-gdk-directory-${{ inputs.gdk-version }} + + - name: Cache GDK registry + id: cache-gdk-registry + uses: actions/cache@v4 + with: + path: ${{ runner.temp }}/gdk.reg + key: setup-gdk-registry-${{ inputs.gdk-version }} + + - name: Install GDK + shell: pwsh + if: ${{ steps.cache-gdk-directory.outputs.cache-hit != 'true' }} + run: | + winget install --accept-source-agreements --accept-package-agreements --silent --disable-interactivity --version ${{ inputs.gdk-version }} Microsoft.Gaming.GDK + + - name: Import GDK registry + shell: pwsh + if: ${{ steps.cache-gdk-registry.outputs.cache-hit == 'true' }} + run: | + reg import "$env:RUNNER_TEMP\gdk.reg" + + - name: Export GDK registry + shell: pwsh + if: ${{ steps.cache-gdk-registry.outputs.cache-hit != 'true' }} + run: | + reg export "HKLM\SOFTWARE\WOW6432Node\Microsoft\GDK" "$env:RUNNER_TEMP\gdk.reg" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70ebb940c..c90821550 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -148,8 +148,7 @@ jobs: ANDROID_ARCH: x86_64 - name: Windows (Gaming.Desktop.x64) os: windows-2025 - GDK_VERSION: 250401 - GDK_WINGET_VERSION: 2504.1.4046 + GDK_VERSION: 2504.1.4046 CMAKE_DEFINES: -DCMAKE_TOOLCHAIN_FILE="./toolchains/xbox/grdk_toolchain.cmake" -DGDK_VERSION=250401 VS_GENERATOR_TOOLSET: GRDK @@ -170,7 +169,6 @@ jobs: VS_GENERATOR_TOOLSET: ${{ matrix.VS_GENERATOR_TOOLSET }} SYSTEM_PYTHON: ${{ matrix.SYSTEM_PYTHON }} GDK_VERSION: ${{ matrix.GDK_VERSION }} - GDK_WINGET_VERSION: ${{ matrix.GDK_WINGET_VERSION }} steps: - uses: actions/checkout@v4 @@ -243,7 +241,7 @@ jobs: run: . "scripts\install-llvm-mingw.ps1" - name: Set up zlib for Windows - if: ${{ runner.os == 'Windows' && !env['GDK_VERSION'] }} + if: ${{ runner.os == 'Windows' }} shell: powershell run: . "scripts\install-zlib.ps1" @@ -265,38 +263,11 @@ jobs: run: bash scripts/start-android.sh timeout-minutes: 20 - - name: Restore GDK - if: ${{ runner.os == 'Windows' && env['GDK_VERSION'] }} - id: cache-gdk - uses: actions/cache/restore@v4 - with: - path: | - C:/Program Files (x86)/Microsoft GDK - C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Microsoft/VC/v170/Platforms/Gaming.Desktop.x64/${{ env['GDK_VERSION'] }} - key: gdk-${{ env['GDK_VERSION'] }} - - - name: Install GDK - if: ${{ runner.os == 'Windows' && env['GDK_WINGET_VERSION'] && steps.cache-gdk.outputs.cache-hit != 'true' }} - run: | - winget install --accept-source-agreements --accept-package-agreements --silent --disable-interactivity --version $env:GDK_WINGET_VERSION Microsoft.Gaming.GDK - - name: Setup GDK if: ${{ runner.os == 'Windows' && env['GDK_VERSION'] }} - run: | - $path = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\GDK' - if (-not (Test-Path $path)) { - New-Item -Path $path -Force | Out-Null - } - Set-ItemProperty -Path $path -Name GRDKInstallPath -Value 'C:\Program Files (x86)\Microsoft GDK\' - - - name: Cache GDK - if: ${{ runner.os == 'Windows' && env['GDK_VERSION'] && steps.cache-gdk.outputs.cache-hit != 'true' }} - uses: actions/cache/save@v4 + uses: ./.github/actions/setup-gdk with: - path: | - C:/Program Files (x86)/Microsoft GDK - C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Microsoft/VC/v170/Platforms/Gaming.Desktop.x64/${{ env['GDK_VERSION'] }} - key: gdk-${{ env['GDK_VERSION'] }} + gdk-version: ${{ env['GDK_VERSION'] }} - name: Add sentry.native.test hostname if: ${{ runner.os == 'Windows' }} From 4f637f320ab4f25a02c99f5346696a8b3cb9124d Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sat, 12 Jul 2025 22:48:38 +0200 Subject: [PATCH 25/30] respect CMAKE_DEFINES --- scripts/install-zlib.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install-zlib.ps1 b/scripts/install-zlib.ps1 index c9b543638..b60919e24 100644 --- a/scripts/install-zlib.ps1 +++ b/scripts/install-zlib.ps1 @@ -35,7 +35,7 @@ cmake.exe --build "${ZLIB_BUILD_PATH}" --target zlibstatic Copy-Item "${ZLIB_SOURCE_PATH}\zlib.h" "${ZLIB_BUILD_PATH}" # Append zlib CMAKE_DEFINES to the runner env. -if ($env:TEST_MINGW -eq 1) { +if ($env:TEST_MINGW -eq 1 -or ![string]::IsNullOrEmpty($env:GDK_VERSION)) { $NEW_CMAKE_DEFINES="CMAKE_DEFINES=${env:CMAKE_DEFINES} -DZLIB_LIBRARY=${ZLIB_BUILD_PATH}\libzlibstatic.a -DZLIB_INCLUDE_DIR=${ZLIB_BUILD_PATH} -GNinja" } Else { From dacc744098e3ccdbd41e34134470730ab324fc52 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sat, 12 Jul 2025 22:55:27 +0200 Subject: [PATCH 26/30] setup-gdk: restore/save cache --- .github/actions/setup-gdk/action.yml | 34 ++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/.github/actions/setup-gdk/action.yml b/.github/actions/setup-gdk/action.yml index c6171e0bf..2d4249edd 100644 --- a/.github/actions/setup-gdk/action.yml +++ b/.github/actions/setup-gdk/action.yml @@ -8,36 +8,52 @@ inputs: runs: using: composite steps: - - name: Cache GDK directory - id: cache-gdk-directory - uses: actions/cache@v4 + - name: Restore GDK directory + id: gdk-directory + uses: actions/cache/restore@v4 with: path: | C:/Program Files (x86)/Microsoft GDK C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Microsoft/VC/v170/Platforms/Gaming.Desktop.x64 key: setup-gdk-directory-${{ inputs.gdk-version }} - - name: Cache GDK registry - id: cache-gdk-registry - uses: actions/cache@v4 + - name: Restore GDK registry + id: gdk-registry + uses: actions/restore/cache@v4 with: path: ${{ runner.temp }}/gdk.reg key: setup-gdk-registry-${{ inputs.gdk-version }} - name: Install GDK shell: pwsh - if: ${{ steps.cache-gdk-directory.outputs.cache-hit != 'true' }} + if: steps.gdk-directory.outputs.cache-hit != 'true' run: | winget install --accept-source-agreements --accept-package-agreements --silent --disable-interactivity --version ${{ inputs.gdk-version }} Microsoft.Gaming.GDK + - name: Cache GDK directory + if: steps.gdk-directory.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + path: | + C:/Program Files (x86)/Microsoft GDK + C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Microsoft/VC/v170/Platforms/Gaming.Desktop.x64 + key: setup-gdk-directory-${{ inputs.gdk-version }} + - name: Import GDK registry shell: pwsh - if: ${{ steps.cache-gdk-registry.outputs.cache-hit == 'true' }} + if: steps.gdk-registry.outputs.cache-hit == 'true' run: | reg import "$env:RUNNER_TEMP\gdk.reg" - name: Export GDK registry shell: pwsh - if: ${{ steps.cache-gdk-registry.outputs.cache-hit != 'true' }} + if: steps.gdk-registry.outputs.cache-hit != 'true' run: | reg export "HKLM\SOFTWARE\WOW6432Node\Microsoft\GDK" "$env:RUNNER_TEMP\gdk.reg" + + - name: Cache GDK registry + if: steps.gdk-registry.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + path: ${{ runner.temp }}/gdk.reg + key: setup-gdk-registry-${{ inputs.gdk-version }} From f11ad8c99abf9f762f82e4e7863e9215b817bcb3 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sat, 12 Jul 2025 22:59:44 +0200 Subject: [PATCH 27/30] fix actions/cache/restore --- .github/actions/setup-gdk/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-gdk/action.yml b/.github/actions/setup-gdk/action.yml index 2d4249edd..35de8ccdb 100644 --- a/.github/actions/setup-gdk/action.yml +++ b/.github/actions/setup-gdk/action.yml @@ -19,7 +19,7 @@ runs: - name: Restore GDK registry id: gdk-registry - uses: actions/restore/cache@v4 + uses: actions/cache/restore@v4 with: path: ${{ runner.temp }}/gdk.reg key: setup-gdk-registry-${{ inputs.gdk-version }} From a2360f7b965153ece5e195ab447f996c0b0da829 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sat, 12 Jul 2025 23:02:10 +0200 Subject: [PATCH 28/30] respect CMAKE_DEFINES --- scripts/install-zlib.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install-zlib.ps1 b/scripts/install-zlib.ps1 index b60919e24..52e09ad1a 100644 --- a/scripts/install-zlib.ps1 +++ b/scripts/install-zlib.ps1 @@ -35,10 +35,10 @@ cmake.exe --build "${ZLIB_BUILD_PATH}" --target zlibstatic Copy-Item "${ZLIB_SOURCE_PATH}\zlib.h" "${ZLIB_BUILD_PATH}" # Append zlib CMAKE_DEFINES to the runner env. -if ($env:TEST_MINGW -eq 1 -or ![string]::IsNullOrEmpty($env:GDK_VERSION)) { +if ($env:TEST_MINGW -eq 1) { $NEW_CMAKE_DEFINES="CMAKE_DEFINES=${env:CMAKE_DEFINES} -DZLIB_LIBRARY=${ZLIB_BUILD_PATH}\libzlibstatic.a -DZLIB_INCLUDE_DIR=${ZLIB_BUILD_PATH} -GNinja" } Else { - $NEW_CMAKE_DEFINES="CMAKE_DEFINES=-DZLIB_LIBRARY=${ZLIB_BUILD_PATH}\Debug\zlibstaticd.lib -DZLIB_INCLUDE_DIR=${ZLIB_BUILD_PATH}" + $NEW_CMAKE_DEFINES="CMAKE_DEFINES=${env:CMAKE_DEFINES} -DZLIB_LIBRARY=${ZLIB_BUILD_PATH}\Debug\zlibstaticd.lib -DZLIB_INCLUDE_DIR=${ZLIB_BUILD_PATH}" } $NEW_CMAKE_DEFINES | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append \ No newline at end of file From adb69c287e8a43c40e03ac9b728e9d9560881a66 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 13 Jul 2025 09:33:06 +0200 Subject: [PATCH 29/30] merge gdk caches --- .github/actions/setup-gdk/action.yml | 47 +++++++++------------------- 1 file changed, 15 insertions(+), 32 deletions(-) diff --git a/.github/actions/setup-gdk/action.yml b/.github/actions/setup-gdk/action.yml index 35de8ccdb..1a4d86e75 100644 --- a/.github/actions/setup-gdk/action.yml +++ b/.github/actions/setup-gdk/action.yml @@ -8,52 +8,35 @@ inputs: runs: using: composite steps: - - name: Restore GDK directory - id: gdk-directory + - name: Restore GDK + id: cache-gdk uses: actions/cache/restore@v4 with: path: | C:/Program Files (x86)/Microsoft GDK C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Microsoft/VC/v170/Platforms/Gaming.Desktop.x64 - key: setup-gdk-directory-${{ inputs.gdk-version }} + ${{ runner.temp }}/gdk.reg + key: setup-gdk-${{ inputs.gdk-version }} - - name: Restore GDK registry - id: gdk-registry - uses: actions/cache/restore@v4 - with: - path: ${{ runner.temp }}/gdk.reg - key: setup-gdk-registry-${{ inputs.gdk-version }} + - name: Setup GDK + if: ${{ steps.cache-gdk.outputs.cache-hit == 'true' }} + shell: pwsh + run: | + reg import "$env:RUNNER_TEMP\gdk.reg" - name: Install GDK + if: ${{ steps.cache-gdk.outputs.cache-hit != 'true' }} shell: pwsh - if: steps.gdk-directory.outputs.cache-hit != 'true' run: | winget install --accept-source-agreements --accept-package-agreements --silent --disable-interactivity --version ${{ inputs.gdk-version }} Microsoft.Gaming.GDK + reg export "HKLM\SOFTWARE\WOW6432Node\Microsoft\GDK" "$env:RUNNER_TEMP\gdk.reg" - - name: Cache GDK directory - if: steps.gdk-directory.outputs.cache-hit != 'true' + - name: Cache GDK + if: ${{ steps.cache-gdk.outputs.cache-hit != 'true' }} uses: actions/cache/save@v4 with: path: | C:/Program Files (x86)/Microsoft GDK C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Microsoft/VC/v170/Platforms/Gaming.Desktop.x64 - key: setup-gdk-directory-${{ inputs.gdk-version }} - - - name: Import GDK registry - shell: pwsh - if: steps.gdk-registry.outputs.cache-hit == 'true' - run: | - reg import "$env:RUNNER_TEMP\gdk.reg" - - - name: Export GDK registry - shell: pwsh - if: steps.gdk-registry.outputs.cache-hit != 'true' - run: | - reg export "HKLM\SOFTWARE\WOW6432Node\Microsoft\GDK" "$env:RUNNER_TEMP\gdk.reg" - - - name: Cache GDK registry - if: steps.gdk-registry.outputs.cache-hit != 'true' - uses: actions/cache/save@v4 - with: - path: ${{ runner.temp }}/gdk.reg - key: setup-gdk-registry-${{ inputs.gdk-version }} + ${{ runner.temp }}/gdk.reg + key: setup-gdk-${{ inputs.gdk-version }} From 8eba500b429b30d539ce37f7c2c31f2f6cbc85f8 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 16 Jul 2025 17:32:45 +0200 Subject: [PATCH 30/30] Update .github/actions/setup-gdk/action.yml Co-authored-by: Bruno Garcia --- .github/actions/setup-gdk/action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup-gdk/action.yml b/.github/actions/setup-gdk/action.yml index 1a4d86e75..9661f5483 100644 --- a/.github/actions/setup-gdk/action.yml +++ b/.github/actions/setup-gdk/action.yml @@ -27,8 +27,10 @@ runs: - name: Install GDK if: ${{ steps.cache-gdk.outputs.cache-hit != 'true' }} shell: pwsh + env: + GDK_VERSION: ${{ inputs.gdk-version }} run: | - winget install --accept-source-agreements --accept-package-agreements --silent --disable-interactivity --version ${{ inputs.gdk-version }} Microsoft.Gaming.GDK + winget install --accept-source-agreements --accept-package-agreements --silent --disable-interactivity --version "$env:GDK_VERSION" Microsoft.Gaming.GDK reg export "HKLM\SOFTWARE\WOW6432Node\Microsoft\GDK" "$env:RUNNER_TEMP\gdk.reg" - name: Cache GDK