Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GDK actions workflow #8847

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

chalonverse
Copy link
Contributor

This adds a simple workflow that installs the currently supported version of (public) GDK and then builds for Windows GDK using the VisualC-GDK solution file.

I figure having a workflow might be helpful for cases where some SDL3 changes may introduce compile errors that are easy to fix. Annoyingly, the "Install GDK" step takes like 10-15 minutes. I don't think it's possible to cache that in actions since it installs somewhere in program files.

@madebr
Copy link
Contributor

madebr commented Jan 16, 2024

I think it's possible to cache paths in Program Files.
The ci runs with administrator rights.

But when the cache fetching succeeds, you'd have to fixup the installation to let Visual Studio use the SDK.

@madebr
Copy link
Contributor

madebr commented Jan 16, 2024

Can these scripts be used to cache something?
https://github.com/microsoft/GDK/tree/October_2023_Update_1/SetupScripts

@chalonverse
Copy link
Contributor Author

Can these scripts be used to cache something? https://github.com/microsoft/GDK/tree/October_2023_Update_1/SetupScripts

So right now I’m using that install script, but other than some quick steps, it just calls the installer passing in /q /norestart, and that step is the one that takes forever.

The other script can extract the MSIs pretty quickly, and then you end up with the loose files, but Visual Studio isn’t setup in that case.

There is a CMake sample that has an option to build without installing using the ninja generator:
https://github.com/microsoft/Xbox-GDK-Samples/tree/main/Samples/Tools/CMakeExample

in theory we could do something similar, but it seems a bit non-trivial to setup (especially since I’m not familiar with how all the SDL CMake scripts are setup). But conceivably, if we added that, then we could cache those extracted contents.

@flibitijibibo
Copy link
Collaborator

Haven't dug into it yet but was forwarded this as a possible method of avoiding the installer times: https://github.com/microsoft/Xbox-GDK-Samples/blob/main/Samples/Tools/BWOIExample/readme_en-us.md

@chalonverse
Copy link
Contributor Author

Hmm, I had read through that before, but looking at it again makes me wonder if we can get the https://github.com/microsoft/Xbox-GDK-Samples/blob/main/Samples/Tools/BWOIExample/readme_en-us.md#building-in-a-windows-container part to work in actions?

@madebr
Copy link
Contributor

madebr commented May 24, 2024

Can these scripts be used to cache something? https://github.com/microsoft/GDK/tree/October_2023_Update_1/SetupScripts

The other script can extract the MSIs pretty quickly, and then you end up with the loose files, but Visual Studio isn’t setup in that case.

I just managed to get VisualC-GDK/SDL.sln using latest microsoft/GDK, targeting Gaming.Desktop.x64, without having to install the package, following these instructions:

Only (not-so-minor) problem is that I cannot get the test binaries to run.
When starting them, an error dialog with the text "[GDK] Could not initialize - aborting" appears. Do these programs only work when packaged? The message appears both when trying to debug in Visual Studio, or when starting them in Exlorer. The error happens before the debugger can trigger any breakpoint. Am I doing something obviously wrong? Has this something to do with makepkg? Or with Microsoft.Xbox.Services.GDK.C.Thunks.lib?
image

There is a CMake sample that has an option to build without installing using the ninja generator: https://github.com/microsoft/Xbox-GDK-Samples/tree/main/Samples/Tools/CMakeExample

These CMake scripts don't do much special. Am I correct when I say that the Gaming.Desktop.x64 platform only adds a few libraries + targets to run makepkg.
I don't find any reference to Microsoft.Xbox.Services.GDK.C.Thunks.lib in the samples repo.

@chalonverse
Copy link
Contributor Author

@madebr The action in this PR was trying to do the "install", so I wouldn't be surprised if the approach of extracting the archive is way faster.

The xgameruntime.lib and Microsoft.Xbox.Services.GDK.C.Thunks.lib are in the properties of the vcxproj for the samples under Linker>Input>Additional Dependencies. If it couldn't find the lib then I would assume you'd get a linker error.

I can reproduce that "[GDK] Could not initialize - aborting" error if delete the MicrosoftGame.config file from the directory that has the sample exe. So my guess would be making sure that with the method you're using, that the post-build copy steps are running properly. For example, testsprite.vcxproj has the following copy rules:

<ItemGroup>
<CopyFileToFolders Include="..\..\..\test\icon.bmp">
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">Copying %(Filename)%(Extension)</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
copy "%(FullPath)" "$(OutDir)\"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">copy "%(FullPath)" "$(ProjectDir)\"
copy "%(FullPath)" "$(OutDir)\"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">copy "%(FullPath)" "$(ProjectDir)\"
copy "%(FullPath)" "$(OutDir)\"</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">Copying %(Filename)%(Extension)</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
copy "%(FullPath)" "$(OutDir)\"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">copy "%(FullPath)" "$(ProjectDir)\"
copy "%(FullPath)" "$(OutDir)\"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">copy "%(FullPath)" "$(ProjectDir)\"
copy "%(FullPath)" "$(OutDir)\"</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
</CopyFileToFolders>
</ItemGroup>

And:

<ItemGroup>
<CopyFileToFolders Include="wingdk/MicrosoftGame.config">
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
</CopyFileToFolders>
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.GDK.C.Thunks.dll">
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
</CopyFileToFolders>
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="..\..\logos\Logo100x100.png" />
<CopyFileToFolders Include="..\..\logos\Logo150x150.png" />
<CopyFileToFolders Include="..\..\logos\Logo44x44.png" />
<CopyFileToFolders Include="..\..\logos\Logo480x480.png" />
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="PackageLayout.xml" />
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="xboxseries\MicrosoftGame.config">
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
</CopyFileToFolders>
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="xboxone\MicrosoftGame.config">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
</CopyFileToFolders>
</ItemGroup>

(And we could ignore all the Xbox ones for the purpose of CI, since that won't be possible to build through a public workflow as it requires an NDA install of GDKX)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants