Add support for Microsoft.WindowsAppSDK.Foundation bootstrapper#30
Add support for Microsoft.WindowsAppSDK.Foundation bootstrapper#30
Conversation
There was a problem hiding this comment.
Pull request overview
Adds CMake overlay support for the Microsoft.WindowsAppSDK.Foundation NuGet package’s “framework bootstrapper” scenario by introducing new convenience targets and conditionally exposing a bootstrap target when Microsoft.WindowsAppSDK.Runtime is available.
Changes:
- Adds
Microsoft.WindowsAppSDK.Foundation_Frameworkas an INTERFACE convenience target. - Conditionally defines
Microsoft.WindowsAppSDK.Foundation_FrameworkBootstrapwhenMicrosoft.WindowsAppSDK.Runtimecan be found, wiring in bootstrapper sources/defines and linking to the bootstrap DLL/implib. - Leaves existing
..._SelfContainedbehavior intact.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Target: Microsoft.WindowsAppSDK.Foundation_FrameworkBootstrap | ||
|
|
||
| This target needs the Microsoft.WindowsAppSDK.Runtime package to be present. If the package cannot be found, this | ||
| target will not be created, and the end-user will need to bootrap the Framework manually. |
There was a problem hiding this comment.
Spelling: comment says "bootrap"; should be "bootstrap" (also helps searchability for users scanning the file).
| target will not be created, and the end-user will need to bootrap the Framework manually. | |
| target will not be created, and the end-user will need to bootstrap the Framework manually. |
|
|
||
| target_link_libraries(Microsoft.WindowsAppSDK.Foundation_FrameworkBootstrap | ||
| INTERFACE | ||
| Microsoft.WindowsAppSDK.Runtime |
There was a problem hiding this comment.
Microsoft.WindowsAppSDK.Foundation_FrameworkBootstrap doesn't link to Microsoft.WindowsAppSDK.Foundation/..._Framework, so consuming projects that link only this target won't get the Foundation projection/include dirs. For consistency with existing *_Framework/*_SelfContained targets (which include their base target), consider linking this target against Microsoft.WindowsAppSDK.Foundation_Framework (or Microsoft.WindowsAppSDK.Foundation) as an INTERFACE dependency.
| Microsoft.WindowsAppSDK.Runtime | |
| Microsoft.WindowsAppSDK.Runtime | |
| Microsoft.WindowsAppSDK.Foundation |
jonwis
left a comment
There was a problem hiding this comment.
Seems pretty reasonable. App "targets" the framework & bootstrapper. Is it an error to target _frameworkbootstrap without _framework ?
The
Microsoft.WindowsAppSDK.FoundationNuGet package contains MSBuild/headers/source code/libs/dlls for 'bootstrapping' aspects of the Windows App SDK. This PR is to have a discussion as to how the support is surfaced.A couple of points to discuss:
There's a little awkwardness around
Microsoft.WindowsAppSDK.Runtime. TheMicrosoft.WindowsAppSDK.FoundationNuGet doesn't depend on theMicrosoft.WindowsAppSDK.RuntimeNuGet, but the bootstrapper code needs theWindowsAppSDK-VersionInfo.hfrom theMicrosoft.WindowsAppSDK.RuntimeNuGet. As a result, the CMake logic here checks to see if theMicrosoft.WindowsAppSDK.RuntimeCMake package is available, and only if it is, creates theMicrosoft.WindowsAppSDK.Foundation_FrameworkBootstraptarget. I couldn't find analogous logic in the MSBuild scripts, so I'm not really sure how it's handled.This PR specifically adds support for the
WindowsAppSdkBootstrapInitialize-controlled bootstrap. It would be great to understand options for other MSBuild properties. There are four MSBuild properties that control the behavior of the bootstrapper:How should they be surfaced? Should there be CMake variables to control what the
Microsoft.WindowsAppSDK.Foundation_FrameworkBootstraptarget represents? That seems reasonable, but it does mean that - AFAICT - the behavior of theMicrosoft.WindowsAppSDK.Foundation_FrameworkBootstraptarget would be 'fixed' for the scope of the whole CMake build. This means that you couldn't - for example - build one .exe that is framework-dependent and one that isn't. Since MSBuild re-evaluates the MSBuild-logic on a per-project basis, you can change the behavior of the compiled .cpp on a per-project basis.The alternative would be to create the necessary set of individual targets that represent the options. Which would be a little verbose/noisy.
Thoughts?
I pushed a small self-contained buddy test here incase folks want to try things out.