Skip to content

Commit 68888f3

Browse files
authored
Merge branch 'master' into user/jlaans/static-library-template
2 parents ee4fa8c + 74a0ce8 commit 68888f3

File tree

8 files changed

+22
-20
lines changed

8 files changed

+22
-20
lines changed

nuget/Microsoft.Windows.CppWinRT.targets

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
2929
<CppWinRTEnableComponentProjection Condition="'$(CppWinRTEnableComponentProjection)' == ''">true</CppWinRTEnableComponentProjection>
3030
<CppWinRTEnablePlatformProjection Condition="'$(CppWinRTEnablePlatformProjection)' == ''">true</CppWinRTEnablePlatformProjection>
3131
<CppWinRTEnableReferenceProjection Condition="'$(CppWinRTEnableReferenceProjection)' == ''">true</CppWinRTEnableReferenceProjection>
32-
32+
3333
<GeneratedFilesDir Condition="'$(GeneratedFilesDir)' == ''">$(IntDir)Generated Files\</GeneratedFilesDir>
3434
<!--Override SDK's uap.props setting to ensure version-matched headers-->
3535
<CppWinRT_IncludePath>$(GeneratedFilesDir)</CppWinRT_IncludePath>
@@ -219,9 +219,11 @@ Copyright (C) Microsoft Corporation. All rights reserved.
219219
<Message Text="CppWinRTDynamicProjectWinMDReferences: @(CppWinRTDynamicProjectWinMDReferences->'%(WinMDPath)')" Importance="$(CppWinRTVerbosity)"/>
220220
</Target>
221221

222+
<Target Name="CppWinRTResolveReferences" DependsOnTargets="GetCppWinRTPlatformWinMDReferences;GetCppWinRTDirectWinMDReferences;GetCppWinRTProjectWinMDReferences;$(CppWinRTResolveReferencesDependsOn)" />
223+
222224
<!-- Calculates the input files and metadata directories to be passed to MdMerge -->
223225
<Target Name="GetCppWinRTMdMergeInputs"
224-
DependsOnTargets="CppWinRTComputeXamlGeneratedMidlInputs;GetCppWinRTPlatformWinMDReferences;GetCppWinRTDirectWinMDReferences;GetCppWinRTProjectWinMDReferences;"
226+
DependsOnTargets="CppWinRTComputeXamlGeneratedMidlInputs;CppWinRTResolveReferences;"
225227
Returns="@(CppWinRTMdMergeMetadataDirectories);@(CppWinRTMdMergeInputs)">
226228
<ItemGroup>
227229
<_MdMergeInputs Remove="@(_MdMergeInputs)"/>
@@ -248,6 +250,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
248250
</Target>
249251

250252
<!-- Adds the XamlMetadataProvider idl to the Midl itemgroup, if building any xaml content -->
253+
<!-- Note that Condition is evaluated before DependsOnTargets are run -->
251254
<Target Name="CppWinRTComputeXamlGeneratedMidlInputs"
252255
DependsOnTargets="$(CppWinRTComputeXamlGeneratedMidlInputsDependsOn)"
253256
Condition="'@(Page)@(ApplicationDefinition)' != '' and '$(XamlLanguage)' == 'CppWinRT' and '$(CppWinRTAddXamlMetaDataProviderIdl)' == 'true'">
@@ -265,6 +268,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
265268
</Target>
266269

267270
<!-- Adds the XamlMetadataProvider cpp to the ClCompile itemgroup, if building any xaml content -->
271+
<!-- Note that Condition is evaluated before DependsOnTargets are run -->
268272
<Target Name="CppWinRTComputeXamlGeneratedCompileInputs"
269273
DependsOnTargets="$(CppWinRTComputeXamlGeneratedCompileInputsDependsOn)"
270274
Condition="'@(Page)@(ApplicationDefinition)' != '' and '$(XamlLanguage)' == 'CppWinRT' and '$(CppWinRTAddXamlMetaDataProviderIdl)' == 'true'">
@@ -361,6 +365,9 @@ $(XamlMetaDataProviderPch)
361365
<Message Text="CppWinRTMidlReferences: @(_MidlReferences->'%(WinMDPath)')" Importance="$(CppWinRTVerbosity)"/>
362366
</Target>
363367

368+
<!--Ctrl+F7 (selected file) midl compilation support-->
369+
<Target Name="CppWinRTSetSelectMidlReferences" BeforeTargets="SelectMidl" DependsOnTargets="CppWinRTSetMidlReferences" />
370+
364371
<!--Merge project-generated WinMDs and project-referenced static library WinMDs into project WinMD-->
365372
<Target Name="CppWinRTMergeProjectWinMDInputs"
366373
DependsOnTargets="Midl;GetCppWinRTMdMergeInputs;$(CppWinRTMergeProjectWinMDInputsDependsOn)"
@@ -402,6 +409,7 @@ $(XamlMetaDataProviderPch)
402409
</Target>
403410

404411
<!-- Build the platform projection from the winmds that sip with the platform in the Windows SDK -->
412+
<!-- Note that Condition is evaluated before DependsOnTargets are run -->
405413
<Target Name="CppWinRTMakePlatformProjection"
406414
Condition="'$(CppWinRTEnablePlatformProjection)' == 'true' AND '$(CppWinRTOverrideSDKReferences)' != 'true'"
407415
DependsOnTargets="GetCppWinRTPlatformWinMDInputs;$(CppWinRTMakePlatformProjectionDependsOn)"
@@ -431,9 +439,10 @@ $(XamlMetaDataProviderPch)
431439
</Target>
432440

433441
<!--Build reference projection from WinMD project references and dynamic library project references-->
442+
<!-- Note that Condition is evaluated before DependsOnTargets are run -->
434443
<Target Name="CppWinRTMakeReferenceProjection"
435444
Condition="'@(CppWinRTDirectWinMDReferences)@(CppWinRTDynamicProjectWinMDReferences)' != '' AND '$(CppWinRTEnableReferenceProjection)' == 'true'"
436-
DependsOnTargets="GetCppWinRTProjectWinMDReferences;GetCppWinRTPlatformWinMDReferences;GetCppWinRTDirectWinMDReferences;$(CppWinRTMakeReferenceProjectionDependsOn)"
445+
DependsOnTargets="$(CppWinRTMakeReferenceProjectionDependsOn)"
437446
Inputs="@(CppWinRTDirectWinMDReferences);@(CppWinRTDynamicProjectWinMDReferences);@(CppWinRTPlatformWinMDReferences)"
438447
Outputs="$(IntDir)cppwinrt_ref.rsp">
439448
<PropertyGroup>
@@ -464,9 +473,10 @@ $(XamlMetaDataProviderPch)
464473
</Target>
465474

466475
<!--Build component projection from project WinMD file and static library project references-->
476+
<!-- Note that Condition is evaluated before DependsOnTargets are run -->
467477
<Target Name="CppWinRTMakeComponentProjection"
468478
Condition="'$(CppWinRTEnableComponentProjection)' == 'true'"
469-
DependsOnTargets="GetCppWinRTProjectWinMDReferences;GetCppWinRTPlatformWinMDReferences;GetCppWinRTDirectWinMDReferences;GetCppWinRTMdMergeInputs;$(CppWinRTMakeComponentProjectionDependsOn)"
479+
DependsOnTargets="GetCppWinRTMdMergeInputs;$(CppWinRTMakeComponentProjectionDependsOn)"
470480
Inputs="@(CppWinRTMdMergeInputs);@(CppWinRTStaticProjectWinMDReferences)"
471481
Outputs="$(IntDir)cppwinrt_comp.rsp">
472482
<PropertyGroup>
@@ -520,7 +530,7 @@ $(XamlMetaDataProviderPch)
520530
<Exec Command="$(CppWinRTCommand)" Condition="'@(_CppwinrtCompInputs)' != ''"/>
521531
</Target>
522532

523-
<Target Name="CppWinRTMakeProjections" DependsOnTargets="CppWinRTMakePlatformProjection;CppWinRTMakeReferenceProjection;CppWinRTMakeComponentProjection;$(CppWinRTMakeProjectionsDependsOn)" />
533+
<Target Name="CppWinRTMakeProjections" DependsOnTargets="CppWinRTResolveReferences;CppWinRTMakePlatformProjection;CppWinRTMakeReferenceProjection;CppWinRTMakeComponentProjection;$(CppWinRTMakeProjectionsDependsOn)" />
524534

525535
<!--Add references to all merged project WinMD files for Xaml Compiler-->
526536
<Target Name="CppWinRTAddXamlReferences"
@@ -530,10 +540,10 @@ $(XamlMetaDataProviderPch)
530540
<XamlReferencesToCompile Include="$(OutDir)*.winmd" />
531541
</ItemGroup>
532542
</Target>
533-
543+
534544
<!--Clear merged assembly and set local assembly for Xaml Compiler.
535545
(Note: this can be removed when CppWinRT references are removed from the Xaml targets file.)-->
536-
<Target Name="CppWinRTSetXamlLocalAssembly"
546+
<Target Name="CppWinRTSetXamlLocalAssembly"
537547
Condition="'@(Page)@(ApplicationDefinition)' != '' and '$(XamlLanguage)' == 'CppWinRT'"
538548
DependsOnTargets="$(CppWinRTSetXamlLocalAssemblyDependsOn)">
539549
<PropertyGroup>

vsix/ItemTemplates/ViewModel/ViewModel.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
#include "$safeitemname$.g.cpp"
55
#endif
66

7-
using namespace winrt;
8-
using namespace Windows::UI::Xaml;
9-
107
namespace winrt::$rootnamespace$::implementation
118
{
129
int32_t $safeitemname$::MyProperty()

vsix/ProjectTemplates/VC/Windows Desktop/ConsoleApplication/ConsoleApplication.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
<PrecompiledHeader>Use</PrecompiledHeader>
6464
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
6565
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
66-
<PreprocessorDefinitions>_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
66+
<PreprocessorDefinitions>_CONSOLE;WIN32_LEAN_AND_MEAN;WINRT_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
6767
<WarningLevel>Level4</WarningLevel>
6868
<AdditionalOptions>%(AdditionalOptions) /permissive- /bigobj</AdditionalOptions>
6969
</ClCompile>

vsix/ProjectTemplates/VC/Windows Desktop/WindowsApplication/WindowsApplication.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
<PrecompiledHeader>Use</PrecompiledHeader>
6464
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
6565
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
66-
<PreprocessorDefinitions>_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
66+
<PreprocessorDefinitions>_CONSOLE;WIN32_LEAN_AND_MEAN;WINRT_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
6767
<WarningLevel>Level4</WarningLevel>
6868
<AdditionalOptions>%(AdditionalOptions) /permissive- /bigobj</AdditionalOptions>
6969
</ClCompile>

vsix/ProjectTemplates/VC/Windows Universal/BlankApp/BlankApp.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
<!--Temporarily disable cppwinrt heap enforcement to work around xaml compiler generated std::shared_ptr use -->
7979
<AdditionalOptions Condition="'$(CppWinRTHeapEnforcement)'==''">/DWINRT_NO_MAKE_DETECTION %(AdditionalOptions)</AdditionalOptions>
8080
<DisableSpecificWarnings></DisableSpecificWarnings>
81+
<PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;WINRT_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
8182
</ClCompile>
8283
<Link>
8384
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>

vsix/ProjectTemplates/VC/Windows Universal/CoreApp/CoreApp.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
<WarningLevel>Level4</WarningLevel>
7777
<AdditionalOptions>%(AdditionalOptions) /bigobj</AdditionalOptions>
7878
<DisableSpecificWarnings></DisableSpecificWarnings>
79+
<PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;WINRT_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
7980
</ClCompile>
8081
<Link>
8182
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>

vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/WindowsRuntimeComponent.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
<!--Temporarily disable cppwinrt heap enforcement to work around xaml compiler generated std::shared_ptr use -->
8383
<AdditionalOptions Condition="'$(CppWinRTHeapEnforcement)'==''">/DWINRT_NO_MAKE_DETECTION %(AdditionalOptions)</AdditionalOptions>
8484
<DisableSpecificWarnings></DisableSpecificWarnings>
85-
<PreprocessorDefinitions>_WINRT_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
85+
<PreprocessorDefinitions>_WINRT_DLL;WIN32_LEAN_AND_MEAN;WINRT_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
8686
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
8787
</ClCompile>
8888
<Link>

vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/pch.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,3 @@
22
#include <unknwn.h>
33
#include <winrt/Windows.Foundation.h>
44
#include <winrt/Windows.Foundation.Collections.h>
5-
#include <winrt/Windows.UI.Xaml.h>
6-
#include <winrt/Windows.UI.Xaml.Controls.h>
7-
#include <winrt/Windows.UI.Xaml.Controls.Primitives.h>
8-
#include <winrt/Windows.UI.Xaml.Data.h>
9-
#include <winrt/Windows.UI.Xaml.Interop.h>
10-
#include <winrt/Windows.UI.Xaml.Markup.h>
11-
#include <winrt/Windows.UI.Xaml.Navigation.h>

0 commit comments

Comments
 (0)