Win2D/Win2D.proj

388 строки
20 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="12.0" DefaultTargets="Build">
2014-09-04 02:46:39 +04:00
<!-- Parameters that can be configured by the caller, eg. "msbuild Win2D.proj /p:BuildPhone=false" -->
<PropertyGroup>
<BuildPlatforms>Win32;x64;ARM;AnyCPU</BuildPlatforms>
<BuildConfigurations>Debug;Release</BuildConfigurations>
<BuildWindows>true</BuildWindows>
<BuildPhone>true</BuildPhone>
<BuildUAP>true</BuildUAP>
<BuildTests>true</BuildTests>
<BuildTools>true</BuildTools>
<BuildDocs>true</BuildDocs>
<RunTests>true</RunTests>
</PropertyGroup>
<PropertyGroup>
<Has81Sdk Condition="'$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot81)' != ''">true</Has81Sdk>
<Has10Sdk Condition="'$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot10)' != ''">true</Has10Sdk>
<RunningFrom2017Prompt Condition="'$(VisualStudioVersion)' &gt;= '15.0'">true</RunningFrom2017Prompt>
<ShouldRunUAPTests>false</ShouldRunUAPTests>
<ShouldRunUAPTests Condition="'$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion@CurrentBuildNumber)' &gt;= '10000'">true</ShouldRunUAPTests>
</PropertyGroup>
<!-- Disable building targets when the SDK isn't installed -->
<PropertyGroup Condition="'$(Has81Sdk)' != 'true' and $(BuildWindows)">
<BuildWindows>false</BuildWindows>
<SkippedBuildWindows>true</SkippedBuildWindows>
</PropertyGroup>
<PropertyGroup Condition="'$(Has81Sdk)' != 'true' and $(BuildPhone)">
<BuildPhone>false</BuildPhone>
<SkippedBuildPhone>true</SkippedBuildPhone>
</PropertyGroup>
<PropertyGroup Condition="('$(Has10Sdk)' != 'true' or '$(RunningFrom2017Prompt)' != 'true') and $(BuildUAP)">
<BuildUAP>false</BuildUAP>
<SkippedBuildUAP>true</SkippedBuildUAP>
</PropertyGroup>
<!-- Set default platforms for each project type -->
<ItemDefinitionGroup>
<WindowsProject>
<Platforms>Win32;x64;ARM</Platforms>
<BinDir>Windows</BinDir>
</WindowsProject>
<PhoneProject>
<Platforms>Win32;ARM</Platforms>
<BinDir>Phone</BinDir>
</PhoneProject>
<UAPProject>
2015-03-11 20:59:26 +03:00
<Platforms>Win32;x64;ARM</Platforms>
<BinDir>UAP</BinDir>
</UAPProject>
<AnyCPUProject>
<Platforms>AnyCPU</Platforms>
<BinDir>Windows</BinDir>
</AnyCPUProject>
</ItemDefinitionGroup>
<!-- Windows projects implementing the Canvas API -->
<ItemGroup Condition="$(BuildWindows)">
<WindowsProject Include="winrt\lib\winrt.lib.Windows.vcxproj" />
<WindowsProject Include="winrt\dll\winrt.dll.Windows.vcxproj" />
<WindowsProject Include="numerics\DotNet\DotNetNumerics.Windows.csproj" />
</ItemGroup>
<!-- Windows Phone projects implementing the Canvas API -->
<ItemGroup Condition="$(BuildPhone)">
<PhoneProject Include="winrt\lib\winrt.lib.WindowsPhone.vcxproj" />
<PhoneProject Include="winrt\dll\winrt.dll.WindowsPhone.vcxproj" />
<PhoneProject Include="numerics\DotNet\DotNetNumerics.WindowsPhone.csproj" />
</ItemGroup>
<!-- UAP projects implementing the Canvas API -->
<ItemGroup Condition="$(BuildUAP)">
<UAPProject Include="winrt\lib\winrt.lib.uap.vcxproj" />
<UAPProject Include="winrt\dll\winrt.dll.uap.vcxproj" />
</ItemGroup>
<!-- Windows test projects -->
<ItemGroup Condition="$(BuildWindows) and $(BuildTests)">
<WindowsProject Include="winrt\test.internal\winrt.test.internal.Windows.vcxproj">
<Platforms>Win32;x64</Platforms>
<AutomatedTests>desktop</AutomatedTests>
</WindowsProject>
<WindowsProject Include="winrt\test.external\Windows\winrt.test.external.Windows.vcxproj">
<AutomatedTests>store</AutomatedTests>
</WindowsProject>
<WindowsProject Include="winrt\test.nativecomponent\winrt.test.nativecomponent.Windows.vcxproj" />
<WindowsProject Include="winrt\test.managed\Windows\winrt.test.managed.Windows.csproj">
<AutomatedTests>store</AutomatedTests>
</WindowsProject>
<WindowsProject Include="samples\SimpleSample\Windows\SimpleSample.Windows.csproj" />
<WindowsProject Include="samples\CoreWindowExample\Windows\CoreWindowExample.Windows.csproj" />
<WindowsProject Include="samples\ExampleGallery\Direct3DInterop\Windows\ExampleGallery.Direct3DInterop.Windows.vcxproj">
<BuildInParallel>false</BuildInParallel>
</WindowsProject>
<WindowsProject Include="samples\ExampleGallery\BackgroundTask\Windows\ExampleGallery.BackgroundTask.Windows.csproj" />
<WindowsProject Include="samples\ExampleGallery\Windows\ExampleGallery.Windows.csproj" />
<WindowsProject Include="numerics\Cpp\tests\CppNumericsTests.Windows.vcxproj">
<AutomatedTests>store</AutomatedTests>
</WindowsProject>
<WindowsProject Include="numerics\DotNet\tests\Windows\DotNetNumericsTests.Windows.csproj">
<AutomatedTests>store</AutomatedTests>
</WindowsProject>
2014-12-16 02:17:15 +03:00
<WindowsProject Include="numerics\Cpp\perftest\CppNumericsPerfTest.vcxproj">
<Platforms>Win32;x64</Platforms>
</WindowsProject>
</ItemGroup>
<!-- Windows Phone test projects -->
<ItemGroup Condition="$(BuildPhone) and $(BuildTests)">
<PhoneProject Include="winrt\test.external\WindowsPhone\winrt.test.external.WindowsPhone.vcxproj" />
<PhoneProject Include="winrt\test.nativecomponent\winrt.test.nativecomponent.WindowsPhone.vcxproj" />
<PhoneProject Include="winrt\test.managed\WindowsPhone\winrt.test.managed.WindowsPhone.csproj" />
<PhoneProject Include="samples\SimpleSample\WindowsPhone\SimpleSample.WindowsPhone.csproj" />
<PhoneProject Include="samples\CoreWindowExample\WindowsPhone\CoreWindowExample.WindowsPhone.csproj" />
<PhoneProject Include="samples\ExampleGallery\Direct3DInterop\WindowsPhone\ExampleGallery.Direct3DInterop.WindowsPhone.vcxproj">
<BuildInParallel>false</BuildInParallel>
</PhoneProject>
<PhoneProject Include="samples\ExampleGallery\BackgroundTask\WindowsPhone\ExampleGallery.BackgroundTask.WindowsPhone.csproj"/>
<PhoneProject Include="samples\ExampleGallery\WindowsPhone\ExampleGallery.WindowsPhone.csproj"/>
<PhoneProject Include="numerics\Cpp\tests\CppNumericsTests.WindowsPhone.vcxproj" />
<PhoneProject Include="numerics\DotNet\tests\WindowsPhone\DotNetNumericsTests.WindowsPhone.csproj" />
</ItemGroup>
<!-- UAP test projects -->
<ItemGroup Condition="$(BuildUAP) and $(BuildTests)">
<UAPProject Include="winrt\test.internal\winrt.test.internal.uap.vcxproj">
<Platforms>Win32;x64</Platforms>
<AutomatedTests Condition="$(ShouldRunUAPTests)">desktop</AutomatedTests>
</UAPProject>
<UAPProject Include="winrt\test.external\UAP\winrt.test.external.uap.vcxproj">
<Platforms>Win32;x64</Platforms>
<AutomatedTests Condition="$(ShouldRunUAPTests)">store</AutomatedTests>
</UAPProject>
<UAPProject Include="winrt\test.nativecomponent\winrt.test.nativecomponent.uap.vcxproj" />
<UAPProject Include="winrt\test.managed\UAP\winrt.test.managed.uap.csproj">
<AutomatedTests Condition="$(ShouldRunUAPTests)">store</AutomatedTests>
</UAPProject>
2015-05-29 00:05:32 +03:00
<UAPProject Include="samples\SimpleSample\UAP\SimpleSample.uap.csproj" />
2015-05-29 02:10:39 +03:00
<UAPProject Include="samples\CoreWindowExample\UAP\CoreWindowExample.uap.csproj" />
<UAPProject Include="samples\CompositionExample\CompositionExample.csproj" />
<UAPProject Include="samples\ExampleGallery\Direct3DInterop\UAP\ExampleGallery.Direct3DInterop.uap.vcxproj">
<BuildInParallel>false</BuildInParallel>
</UAPProject>
<UAPProject Include="samples\ExampleGallery\BackgroundTask\UAP\ExampleGallery.BackgroundTask.uap.csproj" />
<UAPProject Include="samples\ExampleGallery\UAP\ExampleGallery.uap.csproj" />
</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>
<AnyCPUProject Include="tools\docs\DocDiff\DocDiff.csproj" />
<AnyCPUProject Include="tools\docs\DocPreprocess\DocPreprocess.csproj" />
<AnyCPUProject Include="tools\docs\ExtractAPISurface\ExtractAPISurface.csproj" />
<AnyCPUProject Include="tools\docs\MergeIntellisense\MergeIntellisense.csproj" />
<AnyCPUProject Include="tools\exportsample\exportsample.csproj" />
</ItemGroup>
<!-- Restore NuGet packages for all projects -->
<ItemGroup>
<NuGetRestore Include="samples\**\packages.config" Condition="$(BuildTests)" />
<NuGetRestore Include="samples\**\project.json" Condition="$(BuildUAP) and $(BuildTests)" />
<NuGetRestore Include="winrt\**\project.json" Condition="$(BuildUAP) and $(BuildTests)" />
<NuGetRestore Include="numerics\**\project.json" Condition="$(BuildUAP)" />
<NuGetRestore Include="tools\exportsample\packages.config" Condition="$(BuildTools)" />
</ItemGroup>
<!-- Master target just chains to a bunch of workers -->
<Target Name="Build"
DependsOnTargets="BuildProjects; CheckCode; BuildDocs; RunTests" />
<!-- Use batching to build each project in turn -->
<Target Name="BuildProjects"
DependsOnTargets="PrepareVersionInfo; ChooseProjectsToBuild; ListSkippedTargets; RestoreNuGetPackages"
Inputs="@(ProjectsToBuild)"
Outputs="%(PlatformIndependentName)">
<Message Importance="High" Text="Building all 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 -->
<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="@(WindowsProject);@(PhoneProject);@(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"/>
<Target Name="BuildDocs"
Condition="$(BuildDocs) and
$(BuildTools) and
$(BuildUAP) and
$(BuildPlatforms.Contains('AnyCPU')) and
$(BuildPlatforms.Contains('Win32')) and
$(BuildConfigurations.Contains('Release'))">
<Message Importance="High" Text="Building documentation" />
<!-- unset SHFBROOT, so that BuildDocs only picks up the version of
sandcastle installed via nuget -->
<SetEnv Name="SHFBROOT" Prefix="false" />
2015-03-12 22:49:53 +03:00
<!-- Use <Exec> rather than <MSBuild> here, since we want BuildDocs.proj to
be isolated from the environment that's formed around running
Win2D.proj up to this point, and to suppress the Sandcastle
false positive warning BHT0001 -->
<Exec Command="msbuild $(MSBuildThisFileDirectory)tools\docs\BuildDocs.proj"
IgnoreStandardErrorWarningFormat="true"
CustomErrorRegularExpression=": error "
CustomWarningRegularExpression=": warning (?!BHT0001)" />
</Target>
<!-- 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>"$([System.IO.Path]::GetFullPath('$(_VsTest)'))"</VsTest>
</PropertyGroup>
<Target Name="RunTests"
Condition="$(BuildTests) and $(RunTests)"
DependsOnTargets="ChooseProjectsToBuild; ChooseTestsToRun"
Inputs="@(TestProjects)"
Outputs="%(TestProjects.TestAppX)">
<Message Importance="High" Text="Running tests: %(TestProjects.Filename) (%(TestProjects.Configuration)|%(TestProjects.Platform))" />
<Exec Command="$(VsTest) %(TestProjects.TestBinary)%(TestProjects.TestArgs)" ContinueOnError="ErrorAndContinue" IgnoreStandardErrorWarningFormat="true" />
</Target>
<Target Name="ChooseTestsToRun">
<ItemGroup>
<TestProjects Include="@(ProjectsToBuild)" Condition="%(ProjectsToBuild.AutomatedTests) != '' and %(ProjectsToBuild.Platform) != ARM">
<!-- 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="ListSkippedTargets">
<Warning Condition="'$(SkippedBuildWindows)' == 'true'"
Text="Skipped building for Windows 8.1 since Windows 8.1 SDK is not installed." />
<Warning Condition="'$(SkippedBuildPhone)' == 'true'"
Text="Skipped building for Windows Phone 8.1 since Windows 8.1 SDK is not installed." />
<Warning Condition="'$(SkippedBuildUAP)' == 'true' and '$(Has10Sdk)' != 'true'"
Text="Skipped building for Windows 10 UAP since Windows 10 SDK is not installed." />
<Warning Condition="'$(SkippedBuildUAP)' == 'true' and '$(Has10Sdk)' == 'true' and '$(RunningFrom2017Prompt)' != 'true'"
Text="Skipped building for Windows 10 UAP since not running from a MSBuild Command Prompt for VS2017" />
</Target>
<Import Project="$(MsBuildThisFileDirectory)build\nuget-restore.targets" />
</Project>