2

Is there a way to change the output directory for the files generated by the midl stuff in C++ WinRT projects (The default seems to be ${ProjectDir}\Generated Files)?

The reason I'm asking is because I have a solution with many WinRT components and each of them generates 74 MB of WinRT headers in the Generates files\winrt folders. I would like to experiment with a single folder for each of them to save on build times and / or disk space. Ideally I would also like to share a single precompiled header for all of the projects.

monoceres
  • 4,722
  • 4
  • 38
  • 63
  • The output location of the projection headers can be controlled through the `-output ` command line argument of the *cppwinrt.exe* tool. I doubt you'll gain much with respect to build times; generation of the projection headers is a one-time process. I will also say that disk space savings would be minuscule compared to the PDBs, that are commonly tens of GiB in size. – IInspectable Apr 07 '22 at 10:09
  • Thanks for the comment! What do you think about using a common pch file for all of the project (that would include the standard winrt stuff)? Also, can the cppwinrt.exe arguments be controlled from vs and/or the vcxproj file? – monoceres Apr 07 '22 at 11:10
  • 1
    I was just looking into that. It seems... hard. There are lots of implicit assumptions that aren't directly reflected in the .vcxproj or .props files driving the build system. (Pre-)Generating the projection headers is possible (as evidenced by the Windows SDK shipping pre-generated headers dating back to June 2019), though I'm not sure how tractable that can be made. I'll see if I can start drafting up an answer, if only to solicit feedback to steer both Q and A towards valuable content. – IInspectable Apr 07 '22 at 11:16

0 Answers0