microsoft / cppwinrt

C++/WinRT
MIT License
1.64k stars 236 forks source link

Bug: winrt.ixx is overwriten and contains only Windows Runtime APIs #1336

Closed sotanakamura closed 1 year ago

sotanakamura commented 1 year ago

Version

2.0.230706.1

Summary

In a WinUI 3 project, cppwinrt generates the projection for Windows Runtime APIs and Windows App SDK APIs. However, winrt.ixx contains only Windows Runtime APIs. This is the problem of Visual Studio build process. cppwinrt can generate winrt.ixx properly in command line.

Reproducible example

  1. Create a WinUI 3 project and build it.
  2. Open winrt.ixx and you can see it dosen't contain "Microsoft.*.h".

Expected behavior

winrt.ixx should contain "Microsoft.*.h".

Actual behavior

winrt.ixx contains only "Windows.*.h".

Additional comments

Additional information by @DarranRowe https://github.com/microsoft/WindowsAppSDK/issues/3767#issuecomment-1653807149

kennykerr commented 1 year ago

That file was for testing C++ module support, which has been blocked on compiler bugs for years, so you can just ignore it.

sylveon commented 1 year ago

I'm not sure if winrt.ixx works right now, last I tried I was getting weird runtime crashes. I had #953 (which adds proper modules support), but it is blocked by compiler bugs. It doesn't fix your issue, but I was aware of it when working on it. IIRC it would require some changes to the MSBuild machinery (which would be the last item on the checklist for modules support, but we're blocked on earlier than that).

sotanakamura commented 1 year ago

This is an additional information. cppwinrt.exe with the combination of input and reference options dosen't generate winrt.ixx. So, winrt.ixx is not overwrriten, but Windows App SDK APIs are not added in winrt.ixx during the step 2, CppWinRTMakeReferenceProjection. In the main function, setting.base is false because settings.projection_filter.empty() is false, and it skips flush_to_file. cppwinrt.exe -in packages\Microsoft.WindowsAppSDK.1.3.230724000\lib\uap10.0 -in packages\Microsoft.WindowsAppSDK.1.3.230724000\lib\uap10.0.18362 -ref sdk