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

Closed
wants to merge 2 commits into from
Closed

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)

@flibitijibibo
Copy link
Collaborator

Update from the GDK side:

Have you looked at using a NuGet package instead?

https://www.nuget.org/packages?q=MIcrosoft.GDK.PC

I assume it still downloads a lot but maybe it's less than the installer...?

@madebr
Copy link
Contributor

madebr commented Jul 25, 2024

I got it working in the end.
You can build the GDK applications without installing anything, but you need to install the GDK runtime to actually run the examples.
After doing that, everything works fine.

I haven't yet written a proper github action to do this automatically.

@madebr
Copy link
Contributor

madebr commented Jul 25, 2024

About GDK, I noticed the executables require a MicrosoftGame.config file to exist in the same directory.
How does that work when building multiple executables?
Currently, they get overwritten and it's last man standing.

@flibitijibibo
Copy link
Collaborator

AFAIK the only way to separate the executables with unique MicrosoftGame.config files is to change the OutputPath, but that will definitely complicate things that depend on BasePath... maybe for CI we should just run testautomation, or maybe treat it like UWP/ARM and do build testing only?

@flibitijibibo
Copy link
Collaborator

@madebr Apologies for the ping, meant to ask: Do you have the working GDK action in a branch somewhere? Happy to throw the GPU branch at it!

@madebr
Copy link
Contributor

madebr commented Jul 30, 2024

@flibitijibibo I haven't integrated it into ci yet, but I'll do that soon'ish.

@madebr madebr mentioned this pull request Aug 4, 2024
@madebr madebr closed this in #10464 Aug 4, 2024
@madebr
Copy link
Contributor

madebr commented Aug 4, 2024

@madebr Apologies for the ping, meant to ask: Do you have the working GDK action in a branch somewhere? Happy to throw the GPU branch at it!

Your turn :)

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.

3 participants