@@ -23,18 +23,24 @@ Copyright (C) Microsoft Corporation. All rights reserved.
2323 <XamlNamespace Condition =" '$(XamlNamespace)' == ''" >Windows.UI.Xaml</XamlNamespace >
2424 <XamlMetaDataProviderIdl Condition =" '$(XamlMetaDataProviderIdl)'== ''" >$(GeneratedFilesDir)XamlMetaDataProvider.idl</XamlMetaDataProviderIdl >
2525 <XamlMetaDataProviderCpp Condition =" '$(XamlMetaDataProviderCpp)'== ''" >$(GeneratedFilesDir)XamlMetaDataProvider.cpp</XamlMetaDataProviderCpp >
26-
26+ <!-- For CX projects, turn off the component projection generation-->
27+ <CppWinRTEnableComponentProjection Condition =" '$(CppWinRTEnableComponentProjection)' == '' AND '$(CppWinRTProjectLanguage)' == 'C++/CX' " >false</CppWinRTEnableComponentProjection >
28+ <CppWinRTEnableComponentProjection Condition =" '$(CppWinRTEnableComponentProjection)' == '' AND '$(XamlLanguage)' == 'C++' " >false</CppWinRTEnableComponentProjection >
29+ <CppWinRTEnableComponentProjection Condition =" '$(CppWinRTEnableComponentProjection)' == ''" >true</CppWinRTEnableComponentProjection >
30+ <CppWinRTEnablePlatformProjection Condition =" '$(CppWinRTEnablePlatformProjection)' == ''" >true</CppWinRTEnablePlatformProjection >
31+ <CppWinRTEnableReferenceProjection Condition =" '$(CppWinRTEnableReferenceProjection)' == ''" >true</CppWinRTEnableReferenceProjection >
32+
2733 <GeneratedFilesDir Condition =" '$(GeneratedFilesDir)' == ''" >$(IntDir)Generated Files\</GeneratedFilesDir >
2834 <!-- Override SDK's uap.props setting to ensure version-matched headers-->
2935 <CppWinRT_IncludePath >$(GeneratedFilesDir)</CppWinRT_IncludePath >
3036 <!-- TEMP: Override NuGet SDK's erroneous setting in uap.props -->
3137 <WindowsSDK_MetadataFoundationPath Condition =" ('$(WindowsSDK_MetadataFoundationPath)'!='') And !Exists($(WindowsSDK_MetadataFoundationPath))" >$(WindowsSDK_MetadataPathVersioned)</WindowsSDK_MetadataFoundationPath >
3238
3339 <GetTargetPathDependsOn >
34- $(GetTargetPathDependsOn);CppWinRTCalculateEnabledProjections;CppWinRTGetTargetPath
40+ $(GetTargetPathDependsOn);GetCppWinRTMdMergeInputs;CppWinRTResolveWinMD;
3541 </GetTargetPathDependsOn >
3642 <PrepareForBuildDependsOn >
37- $(PrepareForBuildDependsOn);CppWinRTVerifyKitVersion
43+ $(PrepareForBuildDependsOn);CppWinRTVerifyKitVersion;
3844 </PrepareForBuildDependsOn >
3945 <!-- Note: Before* targets run before Compute* targets. -->
4046 <BeforeMidlCompileTargets >
@@ -44,10 +50,10 @@ Copyright (C) Microsoft Corporation. All rights reserved.
4450 $(ComputeMidlInputsTargets);CppWinRTComputeXamlGeneratedMidlInputs;CppWinRTSetMidlReferences;
4551 </ComputeMidlInputsTargets >
4652 <AfterMidlTargets >
47- $(AfterMidlTargets);CppWinRTMergeProjectWinMDInputs
53+ $(AfterMidlTargets);GetCppWinRTMdMergeInputs; CppWinRTMergeProjectWinMDInputs;CppWinRTResolveWinMD;
4854 </AfterMidlTargets >
4955 <ResolveAssemblyReferencesDependsOn >
50- $(ResolveAssemblyReferencesDependsOn);GetCppWinRTProjectWinMDReferences;CppWinRTRemoveStaticLibraries
56+ $(ResolveAssemblyReferencesDependsOn);GetCppWinRTProjectWinMDReferences;CppWinRTRemoveStaticLibraries;
5157 </ResolveAssemblyReferencesDependsOn >
5258 <!-- Note: Before* targets run before Compute* targets. -->
5359 <BeforeClCompileTargets >
@@ -71,6 +77,11 @@ Copyright (C) Microsoft Corporation. All rights reserved.
7177
7278 </PropertyGroup >
7379
80+ <!-- For a static library we don't want the winmd/lib/pdb to be packaged -->
81+ <PropertyGroup Condition =" '$(ConfigurationType)' == 'StaticLibrary'" >
82+ <IncludeCopyWinMDArtifactsOutputGroup >false</IncludeCopyWinMDArtifactsOutputGroup >
83+ </PropertyGroup >
84+
7485 <Target Name =" CppWinRTVerifyKitVersion" Condition =" '$(CppWinRTOverrideSDKReferences)' != 'true'" >
7586 <PropertyGroup >
7687 <_CppWinRT_RS4OrGreater >false</_CppWinRT_RS4OrGreater >
@@ -94,51 +105,29 @@ Copyright (C) Microsoft Corporation. All rights reserved.
94105 </Target >
95106
96107 <Target Name =" CppWinRTHeapEnforcementOptOut" Condition =" '@(ClCompile)' != ''" >
97- <ItemGroup Condition =" '$(CppWinRTHeapEnforcement)'=='' and ('@(Page)' != '' Or '@(ApplicationDefinition)' != '')" >
98- <ClCompile >
99- <AdditionalOptions >%(ClCompile.AdditionalOptions) /DWINRT_NO_MAKE_DETECTION</AdditionalOptions >
100- </ClCompile >
101- </ItemGroup >
102- </Target >
103-
104- <Target Name =" CppWinRTCalculateEnabledProjections"
105- DependsOnTargets =" GetCppWinRTProjectWinMDReferences;GetCppWinRTMdMergeInputs;$(CppWinRTCalculateEnabledProjectionsDependsOn)"
106- BeforeTargets =" CppWinRTGetTargetPath;CppWinRTMakePlatformProjection;CppWinRTMakeComponentProjection;CppWinRTMakeReferenceProjection"
107- Returns =" $(CppWinRTEnableComponentProjection);$(CppWinRTEnablePlatformProjection);$(CppWinRTEnableReferenceProjection)" >
108- <PropertyGroup >
109- <!-- For CX projects, turn off the component projection generation-->
110- <CppWinRTEnableComponentProjection Condition =" '$(CppWinRTEnableComponentProjection)' == '' AND '$(CppWinRTProjectLanguage)' == 'C++/CX' " >false</CppWinRTEnableComponentProjection >
111- <CppWinRTEnableComponentProjection Condition =" '$(CppWinRTEnableComponentProjection)' == '' AND '$(XamlLanguage)' == 'C++' " >false</CppWinRTEnableComponentProjection >
112- <!-- Turn on component projection if not turned off and:
113- 1. @(Midl) is not empty or
114- 2. project has static library references
115- -->
116- <CppWinRTEnableComponentProjection Condition =" '$(CppWinRTEnableComponentProjection)' == '' AND '@(Midl)' != ''" >true</CppWinRTEnableComponentProjection >
117- <CppWinRTEnableComponentProjection Condition =" '$(CppWinRTEnableComponentProjection)' == '' AND '@(CppWinRTMdMergeInputs)' != ''" >true</CppWinRTEnableComponentProjection >
118- <CppWinRTEnablePlatformProjection Condition =" '$(CppWinRTEnablePlatformProjection)' == ''" >true</CppWinRTEnablePlatformProjection >
119- <CppWinRTEnableReferenceProjection Condition =" '$(CppWinRTEnableReferenceProjection)' == ''" >true</CppWinRTEnableReferenceProjection >
120- </PropertyGroup >
121- <Message Text =" CppWinRTEnableComponentProjection: $(CppWinRTEnableComponentProjection)" Importance =" $(CppWinRTVerbosity)" />
122- <Message Text =" CppWinRTEnablePlatformProjection: $(CppWinRTEnablePlatformProjection)" Importance =" $(CppWinRTVerbosity)" />
123- <Message Text =" CppWinRTEnableReferenceProjection: $(CppWinRTEnableReferenceProjection)" Importance =" $(CppWinRTVerbosity)" />
108+ <ItemGroup Condition =" '$(CppWinRTHeapEnforcement)'=='' and ('@(Page)' != '' Or '@(ApplicationDefinition)' != '')" >
109+ <ClCompile >
110+ <AdditionalOptions >%(ClCompile.AdditionalOptions) /DWINRT_NO_MAKE_DETECTION</AdditionalOptions >
111+ </ClCompile >
112+ </ItemGroup >
124113 </Target >
125114
126- <Target Name =" CppWinRTGetTargetPath "
127- Condition =" '$(CppWinRTEnableComponentProjection)' == 'true'"
128- Returns =" @(TargetPathWithTargetPlatformMoniker )" >
115+ <Target Name =" CppWinRTResolveWinMD "
116+ Condition =" '@(CppWinRTMdMergeInputs)' != '' AND ' $(CppWinRTEnableComponentProjection)' == 'true'"
117+ Returns =" @(WinMDFullPath )" >
129118 <ItemGroup >
130- <TargetPathWithTargetPlatformMoniker Remove =" $(TargetPathWithTargetPlatformMoniker )" />
131- <TargetPathWithTargetPlatformMoniker Include =" $(CppWinRTProjectWinMD)" >
119+ <WinMDFullPath Remove =" @(WinMDFullPath )" />
120+ <WinMDFullPath Include =" $(CppWinRTProjectWinMD)" >
132121 <TargetPath >$([System.IO.Path]::GetFileName('$(CppWinRTProjectWinMD)'))</TargetPath >
133122 <Primary >true</Primary >
134123 <Implementation Condition =" '$(TargetExt)' == '.dll'" >$(WinMDImplementationPath)$(RootNamespace)$(TargetExt)</Implementation >
135124 <FileType >winmd</FileType >
136125 <WinMDFile >true</WinMDFile >
137126 <ProjectName >$(MSBuildProjectName)</ProjectName >
138127 <ProjectType >$(ConfigurationType)</ProjectType >
139- </TargetPathWithTargetPlatformMoniker >
128+ </WinMDFullPath >
140129 </ItemGroup >
141- <Message Text =" CppWinRTGetTargetPath : @(TargetPathWithTargetPlatformMoniker ->'%(FullPath)')" Importance =" $(CppWinRTVerbosity)" />
130+ <Message Text =" CppWinRTResolveWinMD : @(WinMDFullPath ->'%(FullPath)')" Importance =" $(CppWinRTVerbosity)" />
142131 </Target >
143132
144133 <!-- Static library reference files are merged into the project that
@@ -158,11 +147,11 @@ Copyright (C) Microsoft Corporation. All rights reserved.
158147 DependsOnTargets =" ResolveAssemblyReferences"
159148 Returns =" @(CppWinRTPlatformWinMDInputs)" >
160149 <ItemGroup >
161- <_CppWinRTPlatformWinMDInputs Remove =" @(_CppWinRTPlatformWinMDInputs)" />
162- <_CppWinRTPlatformWinMDInputs Include =" $(WindowsSDK_MetadataPathVersioned)\**\*.winmd" />
163- <CppWinRTPlatformWinMDInputs Include =" @(_CppWinRTPlatformWinMDInputs)" >
164- <WinMDPath >%(FullPath)</WinMDPath >
165- </CppWinRTPlatformWinMDInputs >
150+ <_CppWinRTPlatformWinMDInputs Remove =" @(_CppWinRTPlatformWinMDInputs)" />
151+ <_CppWinRTPlatformWinMDInputs Include =" $(WindowsSDK_MetadataPathVersioned)\**\*.winmd" />
152+ <CppWinRTPlatformWinMDInputs Include =" @(_CppWinRTPlatformWinMDInputs)" >
153+ <WinMDPath >%(FullPath)</WinMDPath >
154+ </CppWinRTPlatformWinMDInputs >
166155 </ItemGroup >
167156 <Message Text =" CppWinRTPlatformWinMDInputs: @(CppWinRTPlatformWinMDInputs->'%(WinMDPath)')" Importance =" $(CppWinRTVerbosity)" />
168157 </Target >
@@ -232,7 +221,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
232221
233222 <!-- Calculates the input files and metadata directories to be passed to MdMerge -->
234223 <Target Name =" GetCppWinRTMdMergeInputs"
235- DependsOnTargets =" GetCppWinRTPlatformWinMDReferences;GetCppWinRTDirectWinMDReferences;GetCppWinRTProjectWinMDReferences;"
224+ DependsOnTargets =" CppWinRTComputeXamlGeneratedMidlInputs; GetCppWinRTPlatformWinMDReferences;GetCppWinRTDirectWinMDReferences;GetCppWinRTProjectWinMDReferences;"
236225 Returns =" @(CppWinRTMdMergeMetadataDirectories);@(CppWinRTMdMergeInputs)" >
237226 <ItemGroup >
238227 <_MdMergeInputs Remove =" @(_MdMergeInputs)" />
@@ -266,7 +255,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
266255 <_DisableReferences >false</_DisableReferences >
267256 <_DisableReferences Condition =" ('$(CppWinRTOverrideSDKReferences)' != 'true') and ('$(TargetPlatformVersion)' < '10.0.18310.0')" >true</_DisableReferences >
268257 </PropertyGroup >
269-
258+
270259 <ItemGroup >
271260 <Midl Remove =" $(XamlMetaDataProviderIdl)" />
272261 <Midl Include =" $(XamlMetaDataProviderIdl)" >
@@ -359,17 +348,17 @@ $(XamlMetaDataProviderPch)
359348 <AdditionalMetadataDirectories Condition =" '$(WindowsSDK_MetadataFoundationPath)' == ''" >%(Midl.AdditionalMetadataDirectories);$(WindowsSDK_MetadataPath);</AdditionalMetadataDirectories >
360349 </Midl >
361350 </ItemGroup >
362- <PropertyGroup >
363- <_MidlrtParameters >@(_MidlReferencesDistinct->'/reference " %(WinMDPath)" ','
 ')</_MidlrtParameters >
364- </PropertyGroup >
365- <WriteLinesToFile Condition =" !$(CppWinRTWriteOnlyWhenDifferent)"
366- File =" $(IntDir)midlrt.rsp" Lines =" $(_MidlrtParameters)"
367- ContinueOnError =" true" Overwrite =" true" />
368- <WriteLinesToFile Condition =" $(CppWinRTWriteOnlyWhenDifferent)"
369- File =" $(IntDir)midlrt.rsp" Lines =" $(_MidlrtParameters)"
370- ContinueOnError =" true" Overwrite =" true"
371- WriteOnlyWhenDifferent =" true" />
372- <Message Text =" CppWinRTMidlReferences: @(_MidlReferences->'%(WinMDPath)')" Importance =" $(CppWinRTVerbosity)" />
351+ <PropertyGroup >
352+ <_MidlrtParameters >@(_MidlReferencesDistinct->'/reference " %(WinMDPath)" ','
 ')</_MidlrtParameters >
353+ </PropertyGroup >
354+ <WriteLinesToFile Condition =" !$(CppWinRTWriteOnlyWhenDifferent)"
355+ File =" $(IntDir)midlrt.rsp" Lines =" $(_MidlrtParameters)"
356+ ContinueOnError =" true" Overwrite =" true" />
357+ <WriteLinesToFile Condition =" $(CppWinRTWriteOnlyWhenDifferent)"
358+ File =" $(IntDir)midlrt.rsp" Lines =" $(_MidlrtParameters)"
359+ ContinueOnError =" true" Overwrite =" true"
360+ WriteOnlyWhenDifferent =" true" />
361+ <Message Text =" CppWinRTMidlReferences: @(_MidlReferences->'%(WinMDPath)')" Importance =" $(CppWinRTVerbosity)" />
373362 </Target >
374363
375364 <!-- Merge project-generated WinMDs and project-referenced static library WinMDs into project WinMD-->
@@ -441,44 +430,44 @@ $(XamlMetaDataProviderPch)
441430 <Exec Command =" $(CppWinRTCommand)" />
442431 </Target >
443432
444- <!-- Build reference projection from WinMD project references and dynamic library project references-->
445- <Target Name =" CppWinRTMakeReferenceProjection"
446- Condition =" '$(CppWinRTEnableReferenceProjection)' == 'true'"
447- DependsOnTargets =" GetCppWinRTProjectWinMDReferences;GetCppWinRTPlatformWinMDReferences;GetCppWinRTDirectWinMDReferences;$(CppWinRTMakeReferenceProjectionDependsOn)"
448- Inputs =" @(CppWinRTDirectWinMDReferences);@(CppWinRTDynamicProjectWinMDReferences);@(CppWinRTPlatformWinMDReferences)"
449- Outputs =" $(IntDir)cppwinrt_ref.rsp" >
450- <PropertyGroup >
451- <CppWinRTCommand >$(CppWinRTPath)cppwinrt %40"$(IntDir)cppwinrt_ref.rsp"</CppWinRTCommand >
452- </PropertyGroup >
453- <ItemGroup >
454- <_CppwinrtRefInputs Remove =" @(_CppwinrtRefInputs)" />
455- <_CppwinrtRefInputs Include =" @(CppWinRTDirectWinMDReferences)" />
456- <_CppwinrtRefInputs Include =" @(CppWinRTDynamicProjectWinMDReferences)" />
457- <_CppwinrtRefRefs Remove =" @(_CppwinrtRefRefs)" />
458- <_CppwinrtRefRefs Include =" @(CppWinRTPlatformWinMDReferences)" />
459- </ItemGroup >
460- <PropertyGroup >
461- <_CppwinrtParameters >$(CppWinRTCommandVerbosity) $(CppWinRTParameters)</_CppwinrtParameters >
462- <_CppwinrtParameters >$(_CppwinrtParameters) @(_CppwinrtRefInputs->'-in " %(WinMDPath)" ', '
 ')</_CppwinrtParameters >
463- <_CppwinrtParameters >$(_CppwinrtParameters) @(_CppwinrtRefRefs->'-ref " %(WinMDPath)" ', '
 ')</_CppwinrtParameters >
464- <_CppwinrtParameters >$(_CppwinrtParameters) -out " $(GeneratedFilesDir)." </_CppwinrtParameters >
465- </PropertyGroup >
466- <WriteLinesToFile Condition =" !$(CppWinRTWriteOnlyWhenDifferent)"
467- File =" $(IntDir)cppwinrt_ref.rsp" Lines =" $(_CppwinrtParameters)"
468- ContinueOnError =" true" Overwrite =" true" />
469- <WriteLinesToFile Condition =" $(CppWinRTWriteOnlyWhenDifferent)"
470- File =" $(IntDir)cppwinrt_ref.rsp" Lines =" $(_CppwinrtParameters)"
471- ContinueOnError =" true" Overwrite =" true"
472- WriteOnlyWhenDifferent =" true" />
473- <Message Text =" $(CppWinRTCommand)" Importance =" $(CppWinRTVerbosity)" />
474- <Exec Command =" $(CppWinRTCommand)" />
475- </Target >
433+ <!-- Build reference projection from WinMD project references and dynamic library project references-->
434+ <Target Name =" CppWinRTMakeReferenceProjection"
435+ Condition =" '$(CppWinRTEnableReferenceProjection)' == 'true'"
436+ DependsOnTargets =" GetCppWinRTProjectWinMDReferences;GetCppWinRTPlatformWinMDReferences;GetCppWinRTDirectWinMDReferences;$(CppWinRTMakeReferenceProjectionDependsOn)"
437+ Inputs =" @(CppWinRTDirectWinMDReferences);@(CppWinRTDynamicProjectWinMDReferences);@(CppWinRTPlatformWinMDReferences)"
438+ Outputs =" $(IntDir)cppwinrt_ref.rsp" >
439+ <PropertyGroup >
440+ <CppWinRTCommand >$(CppWinRTPath)cppwinrt %40"$(IntDir)cppwinrt_ref.rsp"</CppWinRTCommand >
441+ </PropertyGroup >
442+ <ItemGroup >
443+ <_CppwinrtRefInputs Remove =" @(_CppwinrtRefInputs)" />
444+ <_CppwinrtRefInputs Include =" @(CppWinRTDirectWinMDReferences)" />
445+ <_CppwinrtRefInputs Include =" @(CppWinRTDynamicProjectWinMDReferences)" />
446+ <_CppwinrtRefRefs Remove =" @(_CppwinrtRefRefs)" />
447+ <_CppwinrtRefRefs Include =" @(CppWinRTPlatformWinMDReferences)" />
448+ </ItemGroup >
449+ <PropertyGroup >
450+ <_CppwinrtParameters >$(CppWinRTCommandVerbosity) $(CppWinRTParameters)</_CppwinrtParameters >
451+ <_CppwinrtParameters >$(_CppwinrtParameters) @(_CppwinrtRefInputs->'-in " %(WinMDPath)" ', '
 ')</_CppwinrtParameters >
452+ <_CppwinrtParameters >$(_CppwinrtParameters) @(_CppwinrtRefRefs->'-ref " %(WinMDPath)" ', '
 ')</_CppwinrtParameters >
453+ <_CppwinrtParameters >$(_CppwinrtParameters) -out " $(GeneratedFilesDir)." </_CppwinrtParameters >
454+ </PropertyGroup >
455+ <WriteLinesToFile Condition =" !$(CppWinRTWriteOnlyWhenDifferent)"
456+ File =" $(IntDir)cppwinrt_ref.rsp" Lines =" $(_CppwinrtParameters)"
457+ ContinueOnError =" true" Overwrite =" true" />
458+ <WriteLinesToFile Condition =" $(CppWinRTWriteOnlyWhenDifferent)"
459+ File =" $(IntDir)cppwinrt_ref.rsp" Lines =" $(_CppwinrtParameters)"
460+ ContinueOnError =" true" Overwrite =" true"
461+ WriteOnlyWhenDifferent =" true" />
462+ <Message Text =" $(CppWinRTCommand)" Importance =" $(CppWinRTVerbosity)" />
463+ <Exec Command =" $(CppWinRTCommand)" />
464+ </Target >
476465
477466 <!-- Build component projection from project WinMD file and static library project references-->
478467 <Target Name =" CppWinRTMakeComponentProjection"
479468 Condition =" '$(CppWinRTEnableComponentProjection)' == 'true'"
480- DependsOnTargets =" GetCppWinRTProjectWinMDReferences;GetCppWinRTPlatformWinMDReferences;GetCppWinRTDirectWinMDReferences;$(CppWinRTMakeComponentProjectionDependsOn)"
481- Inputs =" @(Midl->'%(MetadataFileName)' );@(CppWinRTStaticProjectWinMDReferences)"
469+ DependsOnTargets =" GetCppWinRTProjectWinMDReferences;GetCppWinRTPlatformWinMDReferences;GetCppWinRTDirectWinMDReferences;GetCppWinRTMdMergeInputs; $(CppWinRTMakeComponentProjectionDependsOn)"
470+ Inputs =" @(CppWinRTMdMergeInputs );@(CppWinRTStaticProjectWinMDReferences)"
482471 Outputs =" $(IntDir)cppwinrt_comp.rsp" >
483472 <PropertyGroup >
484473 <_PCH >@(ClCompile->Metadata('PrecompiledHeaderFile')->Distinct())</_PCH >
@@ -531,7 +520,6 @@ $(XamlMetaDataProviderPch)
531520 <Exec Command =" $(CppWinRTCommand)" Condition =" '@(_CppwinrtCompInputs)' != ''" />
532521 </Target >
533522
534- <!-- Main target that generates all the CppWinRT projections. -->
535523 <Target Name =" CppWinRTMakeProjections" DependsOnTargets =" CppWinRTCalculateEnabledProjections;CppWinRTMakePlatformProjection;CppWinRTMakeReferenceProjection;CppWinRTMakeComponentProjection;$(CppWinRTMakeProjectionsDependsOn)" />
536524
537525 <!-- Add references to all merged project WinMD files for Xaml Compiler-->
@@ -540,7 +528,7 @@ $(XamlMetaDataProviderPch)
540528 <XamlReferencesToCompile Include =" $(OutDir)*.winmd" />
541529 </ItemGroup >
542530 </Target >
543-
531+
544532 <!-- Clear merged assembly and set local assembly for Xaml Compiler.
545533 (Note: this can be removed when CppWinRT references are removed from the Xaml targets file.)-->
546534 <Target Name =" CppWinRTSetXamlLocalAssembly" DependsOnTargets =" $(CppWinRTSetXamlLocalAssemblyDependsOn)" >
0 commit comments