Append additional metadata in targets file, to preserve project settings (#597)

* Move all additional item metadata to targets file to accumulate project settings

* nuget build script
This commit is contained in:
Scott Jones 2020-04-20 15:19:30 -07:00 коммит произвёл GitHub
Родитель ae94947a23
Коммит bb6fd22785
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 42 добавлений и 33 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -5,6 +5,7 @@
*_i.c
*_p.c
*.c
*.nupkg
test*.xml
build
packages

Двоичные данные
Microsoft.Windows.CppWinRT.1.0.0.nupkg

Двоичный файл не отображается.

13
build_nuget.cmd Normal file
Просмотреть файл

@ -0,0 +1,13 @@
rem @echo off
set target_version=%1
if "%target_version%"=="" set target_version=1.2.3.4
call msbuild /m /p:Configuration=Release,Platform=x86,CppWinRTBuildVersion=%target_version% cppwinrt.sln /t:fast_fwd
call msbuild /m /p:Configuration=Release,Platform=x64,CppWinRTBuildVersion=%target_version% cppwinrt.sln /t:fast_fwd
call msbuild /m /p:Configuration=Release,Platform=arm,CppWinRTBuildVersion=%target_version% cppwinrt.sln /t:fast_fwd
call msbuild /m /p:Configuration=Release,Platform=arm64,CppWinRTBuildVersion=%target_version% cppwinrt.sln /t:fast_fwd
call msbuild /m /p:Configuration=Release,Platform=x86,CppWinRTBuildVersion=%target_version% cppwinrt.sln /t:cppwinrt
nuget pack nuget\Microsoft.Windows.CppWinRT.nuspec -Properties cppwinrt_exe=%cd%\_build\x86\Release\cppwinrt.exe;cppwinrt_fast_fwd_x86=%cd%\_build\x86\Release\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_x64=%cd%\_build\x64\Release\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_arm=%cd%\_build\arm\Release\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_arm64=%cd%\_build\arm64\Release\cppwinrt_fast_forwarder.lib

Просмотреть файл

@ -29,11 +29,8 @@ Copyright (C) Microsoft Corporation. All rights reserved.
<ClCompile>
<CompileAsWinRT Condition="'$(CppWinRTProjectLanguage)' != 'C++/CX' And '%(ClCompile.CompileAsWinRT)' == ''">false</CompileAsWinRT>
<LanguageStandard Condition="'%(ClCompile.LanguageStandard)' == ''">stdcpp17</LanguageStandard>
<AdditionalOptions>/bigobj /await %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(GeneratedFilesDir)</AdditionalIncludeDirectories>
</ClCompile>
<Midl Condition="'$(CppWinRTModernIDL)' != 'false'">
<AdditionalOptions>%(AdditionalOptions) /nomidl</AdditionalOptions>
<EnableWindowsRuntime>true</EnableWindowsRuntime>
<MetadataFileName>$(IntDir)Unmerged\%(Filename).winmd</MetadataFileName>
<GenerateClientFiles Condition="'%(Midl.GenerateClientFiles)'==''">None</GenerateClientFiles>
@ -46,9 +43,6 @@ Copyright (C) Microsoft Corporation. All rights reserved.
<ProxyFileName Condition="'%(Midl.ProxyFileName)'==''">nul</ProxyFileName>
<TypeLibraryName Condition="'%(Midl.TypeLibraryName)'==''"></TypeLibraryName>
</Midl>
<Link>
<AdditionalDependencies Condition="'$(CppWinRTLibs)' != 'false'">WindowsApp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>

Просмотреть файл

@ -23,6 +23,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
<CppWinRTWriteOnlyWhenDifferent Condition="'$(CppWinRTWriteOnlyWhenDifferent)' != 'true'">false</CppWinRTWriteOnlyWhenDifferent>
<CppWinRTPackageDir Condition="'$(CppWinRTPackage)' == 'true' and '$(CppWinRTPackageDir)'==''">$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)))..\..\</CppWinRTPackageDir>
<CppWinRTPackageDir Condition="'$(CppWinRTPackage)' != 'true' and '$(CppWinRTPackageDir)'==''">$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)))</CppWinRTPackageDir>
<CppWinRTParameters Condition="'$(CppWinRTFastAbi)'=='true'">$(CppWinRTParameters) -fastabi</CppWinRTParameters>
<CppWinRTPath Condition="'$(CppWinRTPackage)' == 'true' and '$(CppWinRTPath)'==''">"$(CppWinRTPackageDir)bin\"</CppWinRTPath>
<CppWinRTPath Condition="'$(CppWinRTPackage)' != 'true' and '$(CppWinRTPath)'==''">"$(CppWinRTPackageDir)"</CppWinRTPath>
<XamlLanguage Condition="'$(CppWinRTProjectLanguage)' == 'C++/CX'">C++</XamlLanguage>
@ -93,13 +94,6 @@ Copyright (C) Microsoft Corporation. All rights reserved.
<IncludeCopyWinMDArtifactsOutputGroup>false</IncludeCopyWinMDArtifactsOutputGroup>
</PropertyGroup>
<ItemDefinitionGroup>
<Midl Condition="'$(CppWinRTModernIDL)' != 'false'">
<AdditionalMetadataDirectories Condition="'%(AdditionalMetadataDirectories)' == '' And '$(WindowsSDK_MetadataFoundationPath)' != ''">$(WindowsSDK_MetadataFoundationPath);%(AdditionalMetadataDirectories)</AdditionalMetadataDirectories>
<AdditionalMetadataDirectories Condition="'%(AdditionalMetadataDirectories)' == '' And '$(WindowsSDK_MetadataFoundationPath)' == ''">$(WindowsSDK_MetadataPath);%(AdditionalMetadataDirectories)</AdditionalMetadataDirectories>
</Midl>
</ItemDefinitionGroup>
<Target Name="CppWinRTVerifyKitVersion" Condition="'$(CppWinRTOverrideSDKReferences)' != 'true'">
<PropertyGroup>
<_CppWinRT_RS4OrGreater>false</_CppWinRT_RS4OrGreater>
@ -626,14 +620,21 @@ $(XamlMetaDataProviderPch)
</PropertyGroup>
</Target>
<!-- Fast ABI component support -->
<PropertyGroup Condition="'$(CppWinRTFastAbi)'=='true'">
<CppWinRTParameters>$(CppWinRTParameters) -fastabi</CppWinRTParameters>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(CppWinRTFastAbi)'=='true'">
<Link>
<AdditionalDependencies>%(AdditionalDependencies);$(CppWinRTPackageDir)build\native\lib\$(Platform)\cppwinrt_fast_forwarder.lib</AdditionalDependencies>
</Link>
<!--Append any additional item metadata after all default and project settings have been applied-->
<ItemDefinitionGroup>
<ClCompile>
<AdditionalOptions>%(AdditionalOptions) /bigobj /await</AdditionalOptions>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(GeneratedFilesDir)</AdditionalIncludeDirectories>
</ClCompile>
<Midl Condition="'$(CppWinRTModernIDL)' != 'false'">
<AdditionalMetadataDirectories Condition="'%(AdditionalMetadataDirectories)' == '' And '$(WindowsSDK_MetadataFoundationPath)' != ''">$(WindowsSDK_MetadataFoundationPath);%(AdditionalMetadataDirectories)</AdditionalMetadataDirectories>
<AdditionalMetadataDirectories Condition="'%(AdditionalMetadataDirectories)' == '' And '$(WindowsSDK_MetadataFoundationPath)' == ''">$(WindowsSDK_MetadataPath);%(AdditionalMetadataDirectories)</AdditionalMetadataDirectories>
<AdditionalOptions>%(AdditionalOptions) /nomidl</AdditionalOptions>
</Midl>
<Link>
<AdditionalDependencies Condition="'$(CppWinRTLibs)' != 'false'">%(AdditionalDependencies);WindowsApp.lib</AdditionalDependencies>
<AdditionalDependencies Condition="'$(CppWinRTFastAbi)'=='true'">%(AdditionalDependencies);$(CppWinRTPackageDir)build\native\lib\$(Platform)\cppwinrt_fast_forwarder.lib</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
</Project>

Просмотреть файл

@ -6,14 +6,14 @@ Please visit [Microsoft.Windows.CppWinRT](https://www.nuget.org/packages/Microso
To add build support for C++/WinRT vcxproj projects, add a reference to the Microsoft.Windows.CppWinRT NuGet package. This customizes your project's build rules to automatically generate C++/WinRT projection headers, enabling you to both consume and produce Windows Runtime classes.
C++/WinRT detects Windows metadata referenced by the project, from:
C++/WinRT detects Windows metadata required by the project, from:
* Platform winmd files in the SDK (both MSI and NuGet)
* NuGet packages containing winmd files
* Other projects producing winmd files
* Raw winmd files
* NuGet package references containing winmd files
* Other project references producing winmd files
* Raw winmd file references
* Interface definition language (IDL) files in the project
For any winmd file referenced by the project, C++/WinRT creates reference (consuming) projection headers. Client code can simply #include these headers, which are created in the generated files directory (see below).
For any winmd file discovered above, C++/WinRT creates reference (consuming) projection headers. Client code can simply #include these headers, which are created in the generated files directory (see below).
For any IDL file contained in the project, C++/WinRT creates component (producing) projection headers. In addition, C++/WinRT generates templates and skeleton implementations for each runtime class, under the generated files directory.

Просмотреть файл

@ -3,15 +3,15 @@ The Microsoft.Windows.CppWinRT NuGet package automatically generates C++/WinRT p
enabling you to both consume and produce Windows Runtime classes.
========================================================================
C++/WinRT detects Windows metadata referenced by the project, from:
C++/WinRT detects Windows metadata required by the project, from:
* Platform winmd files in the SDK (both MSI and NuGet)
* NuGet packages containing winmd files
* Other projects producing winmd files
* Raw winmd files
* NuGet package references containing winmd files
* Other project references producing winmd files
* Raw winmd file references
* Interface definition language (IDL) files in the project
For any winmd file referenced by the project, C++/WinRT creates reference (consuming) projection headers.
Client code can simply #include these headers, which are created in the Generated Files directory.
For any winmd file discovered above, C++/WinRT creates reference (consuming) projection headers.
Client code can simply #include these headers, which are created in the generated files directory (see below).
For any IDL file contained in the project, C++/WinRT creates component (producing) projection headers.
In addition, C++/WinRT generates templates and skeleton implementations for each runtime class, under the Generated Files directory.