Win2D/Win2D.proj

269 строки
13 KiB
Plaintext
Исходник Обычный вид История

<?xml version="1.0" encoding="utf-8"?>
<!--
Master script for building all permutations of project * platform * configuration.
For best performance, enable parallel builds:
msbuild Win2D.proj /maxcpucount /nr:false
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="17.0" DefaultTargets="Build">
<!-- Parameters that can be configured by the caller, eg. "msbuild Win2D.proj /p:BuildTests=false" -->
<PropertyGroup>
<BuildPlatforms>Win32;x64;ARM64;AnyCPU</BuildPlatforms>
<BuildConfigurations>Debug;Release</BuildConfigurations>
<BuildTests>true</BuildTests>
<BuildTools>true</BuildTools>
<BuildDocs>false</BuildDocs>
<RunTests>true</RunTests>
</PropertyGroup>
<PropertyGroup>
<ShouldRunUAPTests>false</ShouldRunUAPTests>
<ShouldRunUAPTests Condition="'$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion@CurrentBuildNumber)' &gt;= '10000'">true</ShouldRunUAPTests>
</PropertyGroup>
<!-- Set default platforms for each project type -->
<ItemDefinitionGroup>
<UAPProject>
<Platforms>Win32;x64;ARM64</Platforms>
<BinDir>UAP</BinDir>
</UAPProject>
<AnyCPUProject>
<Platforms>AnyCPU</Platforms>
<BinDir>Windows</BinDir>
</AnyCPUProject>
</ItemDefinitionGroup>
<!-- Projects implementing the Canvas API -->
<ItemGroup>
<UAPProject Include="winrt\lib\winrt.lib.uap.vcxproj" />
<UAPProject Include="winrt\dll\winrt.dll.uap.vcxproj" />
<AnyCPUProject Include="winrt\projection\winrt.projection.csproj" />
</ItemGroup>
<!-- Test projects -->
<ItemGroup Condition="$(BuildTests)">
<UAPProject Include="winrt\test.internal\winrt.test.internal.uap.vcxproj">
<Platforms>Win32;x64</Platforms>
<AutomatedTests Condition="$(ShouldRunUAPTests)">desktop</AutomatedTests>
</UAPProject>
</ItemGroup>
<!-- Tools projects -->
<ItemGroup Condition="$(BuildTools)">
<AnyCPUProject Include="tools\checkcode\checkcode.csproj" />
<AnyCPUProject Include="tools\codegen\exe\codegen.exe.csproj" />
<AnyCPUProject Include="tools\codegen\test\codegen.test.csproj" Condition="$(BuildTests)">
<AutomatedTests>desktop</AutomatedTests>
</AnyCPUProject>
2015-02-26 03:20:43 +03:00
<AnyCPUProject Include="tools\mock\exe\mock.exe.csproj" />
<AnyCPUProject Include="tools\mock\test\mock.test.csproj" Condition="$(BuildTests)">
<AutomatedTests>desktop</AutomatedTests>
</AnyCPUProject>
</ItemGroup>
<!-- Master target just chains to a bunch of workers -->
<Target Name="Build"
DependsOnTargets="BuildProjects; CheckCode; RunTests" />
Add ARM64 support (#722) * Add ARM64 entries where ARM entries are This change adds ARM64 entries where ARM(32) entries already exist. In the case of certain test configurations, ARM is set to use the x86 configuration so ARM64 imitates this. Since winrt.test.managed.uap.csproj is not compatible with .NET Native and the ARM64 UWP does not support .NET other than Native, it is omitted. * Upgrade DirectXTK_UWP dep to 2019.4.26.1 This takes care of unresolved externals in the Direct3DInterop library by updating to a version of directxtk_uwp that has ARM64 support. * Bump UniversalWindowsPlatform to 6.2.8 This change fixes the Nuget Restore error The local source 'C:\Users\jkunkee\source\repos\Win2D\bin' doesn't exist. Incidentally, it also pulls in a version with official ARM64 support: https://github.com/Microsoft/dotnet/blob/master/releases/UWP/net-native2.2/README.md#uwp-627-march-12th-2019 * Set TargetPlatformMinVersion to 10.0.16299.0 for ARM64 This change fixes errors about ARM64 not being supported before 16299. * Work around NuGet TargetPlatformMinVersion limits This change accomodates Visual Studio's lack of support for multiple TargetPlatformMinVersion values in one project by separating the NuGet restore and the build operations that depend on it. UWAs that intend to support ARM64 must have a TargetPlatformMinVersion of at least 10.0.16299.0, while UWAs that intend to support all past versions of Windows 10 must set it to 10.0.10240.0. The Win2D sample and test UWAs need to do both, but NuGet restore only takes one. This this change copies the restore and build operations into two such that the 16299 restore runs, the 16299 (ARM64) builds run, then the 10240 restore runs, and finally the 10240 builds run. This builds everything, including tests, for all architectures. One side effect is that the NuGet package state is left in a state that supports building the most common Platforms from Visual Studio. A corrolary to this is that exported sample projects will require similar arrangements to build for both full Windows 10 backwards compatibility and for ARM64. Since BuildDocs.proj also uses NuGet Restore, it specifically uses the more general 10240 restore target. * Drop WorkAroundNuGetRestoreBug As of Visual Studio 2017 and this point in the commit history, this workaround is no longer necessary.
2019-09-07 01:30:24 +03:00
<!-- TargetPlatformMinVersion 10.0.16299.0 and 10.0.10240 Platforms must be build separately. -->
<Target Name="BuildProjects" DependsOnTargets="BuildProjects18362" />
Add ARM64 support (#722) * Add ARM64 entries where ARM entries are This change adds ARM64 entries where ARM(32) entries already exist. In the case of certain test configurations, ARM is set to use the x86 configuration so ARM64 imitates this. Since winrt.test.managed.uap.csproj is not compatible with .NET Native and the ARM64 UWP does not support .NET other than Native, it is omitted. * Upgrade DirectXTK_UWP dep to 2019.4.26.1 This takes care of unresolved externals in the Direct3DInterop library by updating to a version of directxtk_uwp that has ARM64 support. * Bump UniversalWindowsPlatform to 6.2.8 This change fixes the Nuget Restore error The local source 'C:\Users\jkunkee\source\repos\Win2D\bin' doesn't exist. Incidentally, it also pulls in a version with official ARM64 support: https://github.com/Microsoft/dotnet/blob/master/releases/UWP/net-native2.2/README.md#uwp-627-march-12th-2019 * Set TargetPlatformMinVersion to 10.0.16299.0 for ARM64 This change fixes errors about ARM64 not being supported before 16299. * Work around NuGet TargetPlatformMinVersion limits This change accomodates Visual Studio's lack of support for multiple TargetPlatformMinVersion values in one project by separating the NuGet restore and the build operations that depend on it. UWAs that intend to support ARM64 must have a TargetPlatformMinVersion of at least 10.0.16299.0, while UWAs that intend to support all past versions of Windows 10 must set it to 10.0.10240.0. The Win2D sample and test UWAs need to do both, but NuGet restore only takes one. This this change copies the restore and build operations into two such that the 16299 restore runs, the 16299 (ARM64) builds run, then the 10240 restore runs, and finally the 10240 builds run. This builds everything, including tests, for all architectures. One side effect is that the NuGet package state is left in a state that supports building the most common Platforms from Visual Studio. A corrolary to this is that exported sample projects will require similar arrangements to build for both full Windows 10 backwards compatibility and for ARM64. Since BuildDocs.proj also uses NuGet Restore, it specifically uses the more general 10240 restore target. * Drop WorkAroundNuGetRestoreBug As of Visual Studio 2017 and this point in the commit history, this workaround is no longer necessary.
2019-09-07 01:30:24 +03:00
<Target Name="BuildProjectsPrelim" DependsOnTargets="PrepareVersionInfo; ChooseProjectsToBuild; ChooseConfigurationsToRestore" />
<!-- Use batching to build each project in turn -->
<Target Name="BuildProjects18362"
DependsOnTargets="BuildProjectsPrelim; RestoreNuGetPackages18362"
Inputs="@(ProjectsToBuild)"
Outputs="%(PlatformIndependentName)">
<Message Importance="High" Text="Building TargetPlatformMinVersion 18362 variants of project %(ProjectsToBuild.PlatformIndependentName):" />
<Message Importance="High" Text=" %(ProjectsToBuild.Filename) (%(ProjectsToBuild.Configuration)|%(ProjectsToBuild.Platform))" />
<!-- All the variants (platform and configuration) of most projects can be built in parallel -->
Add ARM64 support (#722) * Add ARM64 entries where ARM entries are This change adds ARM64 entries where ARM(32) entries already exist. In the case of certain test configurations, ARM is set to use the x86 configuration so ARM64 imitates this. Since winrt.test.managed.uap.csproj is not compatible with .NET Native and the ARM64 UWP does not support .NET other than Native, it is omitted. * Upgrade DirectXTK_UWP dep to 2019.4.26.1 This takes care of unresolved externals in the Direct3DInterop library by updating to a version of directxtk_uwp that has ARM64 support. * Bump UniversalWindowsPlatform to 6.2.8 This change fixes the Nuget Restore error The local source 'C:\Users\jkunkee\source\repos\Win2D\bin' doesn't exist. Incidentally, it also pulls in a version with official ARM64 support: https://github.com/Microsoft/dotnet/blob/master/releases/UWP/net-native2.2/README.md#uwp-627-march-12th-2019 * Set TargetPlatformMinVersion to 10.0.16299.0 for ARM64 This change fixes errors about ARM64 not being supported before 16299. * Work around NuGet TargetPlatformMinVersion limits This change accomodates Visual Studio's lack of support for multiple TargetPlatformMinVersion values in one project by separating the NuGet restore and the build operations that depend on it. UWAs that intend to support ARM64 must have a TargetPlatformMinVersion of at least 10.0.16299.0, while UWAs that intend to support all past versions of Windows 10 must set it to 10.0.10240.0. The Win2D sample and test UWAs need to do both, but NuGet restore only takes one. This this change copies the restore and build operations into two such that the 16299 restore runs, the 16299 (ARM64) builds run, then the 10240 restore runs, and finally the 10240 builds run. This builds everything, including tests, for all architectures. One side effect is that the NuGet package state is left in a state that supports building the most common Platforms from Visual Studio. A corrolary to this is that exported sample projects will require similar arrangements to build for both full Windows 10 backwards compatibility and for ARM64. Since BuildDocs.proj also uses NuGet Restore, it specifically uses the more general 10240 restore target. * Drop WorkAroundNuGetRestoreBug As of Visual Studio 2017 and this point in the commit history, this workaround is no longer necessary.
2019-09-07 01:30:24 +03:00
<MSBuild Projects="@(ProjectsToBuild)"
BuildInParallel="%(ProjectsToBuild.BuildInParallel)"
Properties="IncludeVersionInfo=true" />
</Target>
<Target Name="ChooseProjectsToBuild">
<ItemGroup>
<!-- Expand parameter properties into item groups, so we can batch over them -->
<BuildPlatform Include="$(BuildPlatforms)" />
<BuildConfiguration Include="$(BuildConfigurations)" />
<!-- Generate the cartesian product of all projects * all platforms we are building -->
<CandidateProjects Include="@(UAPProject);@(AnyCPUProject)">
<Platform>%(BuildPlatform.Identity)</Platform>
</CandidateProjects>
<!-- Filter the list to include only project/platform pairs where the project actually supports that platform -->
<FilteredProjects Include="@(CandidateProjects)" Condition="$([System.String]::new('%(CandidateProjects.Platforms)').Contains('%(CandidateProjects.Platform)'))" />
<!-- Generate the cartesian product of our filtered project list * the configurations we are building -->
<ProjectsPerConfig Include="@(FilteredProjects)">
<Configuration>%(BuildConfiguration.Identity)</Configuration>
</ProjectsPerConfig>
<!-- Move platform and configuration into the AdditionalProperties metadata, and generate a
platform independent name that will be the same for Windows, Phone and UAP project variants -->
<ProjectsToBuild Include="@(ProjectsPerConfig)">
<AdditionalProperties>Platform=%(ProjectsPerConfig.Platform);Configuration=%(ProjectsPerConfig.Configuration)</AdditionalProperties>
<PlatformIndependentName>$([System.String]::new('%(ProjectsPerConfig.Filename)').Replace('Windows', '').Replace('Phone', '').Replace('uap', '').TrimEnd('.'))</PlatformIndependentName>
<BuildInParallel Condition="'%(ProjectsPerConfig.BuildInParallel)' == ''">true</BuildInParallel>
</ProjectsToBuild>
</ItemGroup>
</Target>
<Target Name="PrepareVersionInfo">
<MakeDir Directories="obj" />
<!-- Read the current Win2D version number -->
<ReadLinesFromFile File="build\nuget\VERSION">
<Output TaskParameter="Lines" PropertyName="Win2DVersion" />
</ReadLinesFromFile>
<!-- Read the SHA-1 hash for git HEAD, so we can later identify exactly what code went into this build -->
<Exec Command="git rev-parse --verify HEAD &gt; obj\Win2D.githash.txt" IgnoreExitCode="true">
<Output TaskParameter="ExitCode" PropertyName="GitExitCode" />
</Exec>
<WriteLinesToFile Condition="$(GitExitCode) != 0" File ="obj\Win2D.githash.txt" Lines="unknown git hash" />
<ReadLinesFromFile File="obj\Win2D.githash.txt">
<Output TaskParameter="Lines" PropertyName="GitHash" />
</ReadLinesFromFile>
<!-- Generate AssemblyVersion.cs, which adds the latest version info to managed assembly outputs -->
<ItemGroup>
<AssemblyVersionCode Include="[assembly: System.Reflection.AssemblyVersion(&quot;$(Win2DVersion)&quot;)]" />
<AssemblyVersionCode Include="[assembly: System.Reflection.AssemblyFileVersion(&quot;$(Win2DVersion)&quot;)]" />
<AssemblyVersionCode Include="[assembly: System.Reflection.AssemblyInformationalVersionAttribute(&quot;$(Win2DVersion) ($(GitHash))&quot;)]" />
</ItemGroup>
<ReadLinesFromFile File="obj\AssemblyVersion.cs">
<Output TaskParameter="Lines" ItemName="ExistingAssemblyVersion" />
</ReadLinesFromFile>
<WriteLinesToFile Condition="@(AssemblyVersionCode) != @(ExistingAssemblyVersion)" File="obj\AssemblyVersion.cs" Lines="@(AssemblyVersionCode)" Overwrite="true" />
<!-- Also generate DllVersion.h, which adds version info to native DLLs -->
<ItemGroup>
<DllVersionCode Include="#define DLL_VERSION $(Win2DVersion.Replace('.', ','))" />
<DllVersionCode Include="#define DLL_VERSION_STRING &quot;$(Win2DVersion)&quot;" />
<DllVersionCode Include="#define DLL_VERSION_STRING_LONG &quot;$(Win2DVersion) ($(GitHash))&quot;" />
</ItemGroup>
<ReadLinesFromFile File="obj\DllVersion.h">
<Output TaskParameter="Lines" ItemName="ExistingDllVersion" />
</ReadLinesFromFile>
<WriteLinesToFile Condition="@(DllVersionCode) != @(ExistingDllVersion)" File="obj\DllVersion.h" Lines="@(DllVersionCode)" Overwrite="true" />
</Target>
<!-- Make sure all our source files have the right copyright and formatting -->
<Target Name="CheckCode"
Condition="$(BuildTools) and $(BuildPlatforms.Contains('AnyCPU'))">
<Message Importance="High" Text="Checking copyright banners and source code formatting" />
<MSBuild Projects="tools\checkcode\RunCodeChecks.proj" />
</Target>
<!-- Build the reference documentation -->
<UsingTask TaskName="SetEnv" AssemblyFile="$(VCTargetsPath)Microsoft.Build.CppTasks.Common.dll"/>
<!-- Run the automated tests -->
<PropertyGroup>
<_VsTestPathUnderCommonTools>..\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe</_VsTestPathUnderCommonTools>
<_VsTest Condition="Exists('$(VS120COMNTOOLS)$(_VsTestPathUnderCommonTools)')">$(VS120COMNTOOLS)$(_VsTestPathUnderCommonTools)</_VsTest>
<_VsTest Condition="Exists('$(VS140COMNTOOLS)$(_VsTestPathUnderCommonTools)')">$(VS140COMNTOOLS)$(_VsTestPathUnderCommonTools)</_VsTest>
<_VsTest Condition="Exists('$(VS150COMNTOOLS)$(_VsTestPathUnderCommonTools)')">$(VS150COMNTOOLS)$(_VsTestPathUnderCommonTools)</_VsTest>
2019-09-07 02:13:03 +03:00
<_VsTest Condition="Exists('$(VS160COMNTOOLS)$(_VsTestPathUnderCommonTools)')">$(VS160COMNTOOLS)$(_VsTestPathUnderCommonTools)</_VsTest>
<_VsTest Condition="Exists('$(VS170COMNTOOLS)$(_VsTestPathUnderCommonTools)')">$(VS170COMNTOOLS)$(_VsTestPathUnderCommonTools)</_VsTest>
<VsTest Condition="'$(_VsTest)' != ''">"$([System.IO.Path]::GetFullPath('$(_VsTest)'))"</VsTest>
</PropertyGroup>
<Target Name="RunTests"
Condition="$(BuildTests) and $(RunTests)"
DependsOnTargets="ChooseProjectsToBuild; ChooseTestsToRun"
Inputs="@(TestProjects)"
Outputs="%(TestProjects.TestAppX)">
<PropertyGroup>
<PowerShellExe Condition=" '$(PowerShellExe)'=='' ">%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe</PowerShellExe>
</PropertyGroup>
<Error Text="vstest.console.exe not found, please specify using the VsTest property" Condition="'$(VsTest)' == ''" />
<Message Importance="High" Text="Running tests: %(TestProjects.Filename) (%(TestProjects.Configuration)|%(TestProjects.Platform))" />
2019-09-07 02:13:03 +03:00
<Exec Command="$(PowerShellExe) -NonInteractive -executionpolicy Unrestricted -command &quot;&amp; { get-appxpackage -name E2C40EB9-8CCE-48B1-9A5C-4C8CA4999631 | remove-appxpackage } &quot;" ConsoleToMsBuild="true" ContinueOnError="ErrorAndContinue" IgnoreStandardErrorWarningFormat="true"/>
<Exec Command="$(VsTest) %(TestProjects.TestBinary)%(TestProjects.TestArgs)" ContinueOnError="ErrorAndContinue" IgnoreStandardErrorWarningFormat="true" />
</Target>
<Target Name="ChooseTestsToRun">
<ItemGroup>
Add ARM64 support (#722) * Add ARM64 entries where ARM entries are This change adds ARM64 entries where ARM(32) entries already exist. In the case of certain test configurations, ARM is set to use the x86 configuration so ARM64 imitates this. Since winrt.test.managed.uap.csproj is not compatible with .NET Native and the ARM64 UWP does not support .NET other than Native, it is omitted. * Upgrade DirectXTK_UWP dep to 2019.4.26.1 This takes care of unresolved externals in the Direct3DInterop library by updating to a version of directxtk_uwp that has ARM64 support. * Bump UniversalWindowsPlatform to 6.2.8 This change fixes the Nuget Restore error The local source 'C:\Users\jkunkee\source\repos\Win2D\bin' doesn't exist. Incidentally, it also pulls in a version with official ARM64 support: https://github.com/Microsoft/dotnet/blob/master/releases/UWP/net-native2.2/README.md#uwp-627-march-12th-2019 * Set TargetPlatformMinVersion to 10.0.16299.0 for ARM64 This change fixes errors about ARM64 not being supported before 16299. * Work around NuGet TargetPlatformMinVersion limits This change accomodates Visual Studio's lack of support for multiple TargetPlatformMinVersion values in one project by separating the NuGet restore and the build operations that depend on it. UWAs that intend to support ARM64 must have a TargetPlatformMinVersion of at least 10.0.16299.0, while UWAs that intend to support all past versions of Windows 10 must set it to 10.0.10240.0. The Win2D sample and test UWAs need to do both, but NuGet restore only takes one. This this change copies the restore and build operations into two such that the 16299 restore runs, the 16299 (ARM64) builds run, then the 10240 restore runs, and finally the 10240 builds run. This builds everything, including tests, for all architectures. One side effect is that the NuGet package state is left in a state that supports building the most common Platforms from Visual Studio. A corrolary to this is that exported sample projects will require similar arrangements to build for both full Windows 10 backwards compatibility and for ARM64. Since BuildDocs.proj also uses NuGet Restore, it specifically uses the more general 10240 restore target. * Drop WorkAroundNuGetRestoreBug As of Visual Studio 2017 and this point in the commit history, this workaround is no longer necessary.
2019-09-07 01:30:24 +03:00
<TestProjects Include="@(ProjectsToBuild)" Condition="%(ProjectsToBuild.AutomatedTests) != '' and %(ProjectsToBuild.Platform) != ARM and %(ProjectsToBuild.Platform) != ARM64">
<!-- Remap Win32 to x86 -->
<TestPlatform Condition="%(ProjectsToBuild.Platform) == Win32">x86</TestPlatform>
<TestPlatform Condition="%(ProjectsToBuild.Platform) != Win32">%(ProjectsToBuild.Platform)</TestPlatform>
<!-- Work out where the test binaries are located -->
<TestPath>bin\%(ProjectsToBuild.BinDir)%(TestProjects.TestPlatform)\%(ProjectsToBuild.Configuration)</TestPath>
<TestAppX Condition="%(ProjectsToBuild.Configuration) == Release">%(ProjectsToBuild.Filename)_1.0.0.0_%(ProjectsToBuild.Platform)</TestAppX>
<TestAppX Condition="%(ProjectsToBuild.Configuration) != Release">%(ProjectsToBuild.Filename)_1.0.0.0_%(ProjectsToBuild.Platform)_%(ProjectsToBuild.Configuration)</TestAppX>
<!-- Binaries can be either a .dll for desktop tests, or .appx for store app tests -->
<TestBinary Condition="%(ProjectsToBuild.AutomatedTests) == desktop">%(TestProjects.TestPath)\%(ProjectsToBuild.Filename)\%(ProjectsToBuild.Filename).dll</TestBinary>
<TestBinary Condition="%(ProjectsToBuild.AutomatedTests) == store">%(TestProjects.TestPath)\%(ProjectsToBuild.Filename)\AppPackages\%(TestProjects.TestAppX)_Test\%(TestProjects.TestAppX).appx</TestBinary>
<!-- Do we need the /Platform or /InIsolation arguments for this test project? -->
<TestArgs Condition="%(ProjectsToBuild.Platform) == x64">%(TestProjects.TestArgs) /Platform:x64</TestArgs>
<TestArgs Condition="%(ProjectsToBuild.Platform) == x64 or %(ProjectsToBuild.AutomatedTests) == store">%(TestProjects.TestArgs) /InIsolation</TestArgs>
</TestProjects>
</ItemGroup>
</Target>
<Target Name="ChooseConfigurationsToRestore">
<ItemGroup>
<ProjectToRestore Include="$(MSBuildThisFileDirectory)Microsoft.Graphics.Win2D.sln" />
<!-- Expand parameter properties into item groups, so we can batch over them -->
<BuildPlatform Include="$(BuildPlatforms)" />
<BuildConfiguration Include="$(BuildConfigurations)" />
<!-- Generate the cartesian product of all platforms * configurations that we are building -->
<ConfigToRestore Include="@(ProjectToRestore)">
<Configuration>%(BuildConfiguration.Identity)</Configuration>
</ConfigToRestore>
<NuGetRestore Include="@(ConfigToRestore)" Condition="%(BuildPlatform.Identity) != AnyCPU">
<Platform>%(BuildPlatform.Identity)</Platform>
</NuGetRestore>
<!-- Internal Microsoft builds can optionally consume the Windows SDK via NuGet -->
<NuGetRestore Include="build\pkges\packages.config" Condition="'$(UseNuGetSDK)' != ''" />
</ItemGroup>
</Target>
<Import Project="$(MsBuildThisFileDirectory)build\nuget-restore.targets" />
</Project>