Merged PR 100: Update Win2D to support VS 2017

This commit is contained in:
Claire Andrews 2017-05-19 19:50:08 +00:00
Родитель 9ec7c783cc
Коммит 0c07456be8
12 изменённых файлов: 40 добавлений и 33 удалений

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

@ -109,7 +109,7 @@ appropriate test suites.
To validate your changes, run "msbuild /m /nr:false Win2D.proj" from a
Visual Studio command prompt (if using Visual Studio 2013) or MSBuild
command prompt (if using Visual Studio 2015). This will:
command prompt (if using Visual Studio 2017). This will:
- Build all flavors of all projects (debug, release, x86, x64, and ARM)
- Run all automated tests

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

@ -64,7 +64,7 @@ Studio, add the Win2D NuGet package to your project, and get started using the A
## Building Win2D from source
##### Requirements
- Recommended: Visual Studio 2015 with Update 3 and Universal Windows App Development Tools 1.4.1
- Recommended: Visual Studio 2017 with Visual Studio Tools for Universal Windows Apps 15.0.26430.06
- Visual Studio 2013 Update 5 is also supported (for Windows 8.1 or Windows Phone 8.1 development only)
##### Clone Repository
@ -72,8 +72,8 @@ Studio, add the Win2D NuGet package to your project, and get started using the A
- Add the Win2D repository URL (https://github.com/Microsoft/Win2D.git) and hit 'Clone'
##### Build NuGet Packages
- If using Visual Studio 2015:
- Launch 'MSBuild Command Prompt for VS2015'
- If using Visual Studio 2017:
- Launch 'Developer Command Prompt for VS2017'
- If using Visual Studio 2013:
- In Windows search, type 'Visual Studio Tools', and select that folder to open it
- Launch 'Developer Command Prompt for VS2013'

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

@ -26,7 +26,7 @@
<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>
<RunningFrom2015Prompt Condition="'$(VisualStudioVersion)' &gt;= '14.0'">true</RunningFrom2015Prompt>
<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>
@ -43,7 +43,7 @@
<SkippedBuildPhone>true</SkippedBuildPhone>
</PropertyGroup>
<PropertyGroup Condition="('$(Has10Sdk)' != 'true' or '$(RunningFrom2015Prompt)' != 'true') and $(BuildUAP)">
<PropertyGroup Condition="('$(Has10Sdk)' != 'true' or '$(RunningFrom2017Prompt)' != 'true') and $(BuildUAP)">
<BuildUAP>false</BuildUAP>
<SkippedBuildUAP>true</SkippedBuildUAP>
</PropertyGroup>
@ -378,8 +378,8 @@
<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 '$(RunningFrom2015Prompt)' != 'true'"
Text="Skipped building for Windows 10 UAP since not running from a MSBuild Command Prompt for VS2015" />
<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" />

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

@ -18,8 +18,8 @@ IF "%1" == "no81" (
)
IF NOT "%NOUAP%" == "1" (
IF "%VisualStudioVersion%" LSS "14.0" (
ECHO Warning: Visual Studio 2015 or higher required to build with Universal Windows Platform support.
IF "%VisualStudioVersion%" LSS "15.0" (
ECHO Warning: Visual Studio 2017 or higher required to build with Universal Windows Platform support.
ECHO Building without Universal Windows Platform support.
ECHO.
SET NOUAP=1
@ -77,8 +77,8 @@ ECHO.
ECHO For Visual Studio 2013, building for Windows / Phone 8.1:
ECHO - Visual Studio 2013 Command Prompt
ECHO.
ECHO For Visual Studio 2015, building for Windows / Phone 8.1 and Universal Windows Platform:
ECHO - MSBuild Command Prompt for VS2015
ECHO For Visual Studio 2017, building for Windows / Phone 8.1 and Universal Windows Platform:
ECHO - Developer Command Prompt for VS2017
ECHO.
PAUSE
GOTO END

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

@ -37,13 +37,13 @@
</PropertyGroup>
<PropertyGroup Condition="'$(TargetPlatformIdentifier)' == 'UAP'">
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.10240.0</WindowsTargetPlatformMinVersion>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(TargetPlatformIdentifier)' == 'UAP'">
<ClCompile>
<AdditionalOptions>/DNTDDI_VERSION=0x0A000002 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/DNTDDI_VERSION=0x0A000003 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
</ItemDefinitionGroup>

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

@ -18,7 +18,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(TargetPlatformIdentifier)' == 'UAP'">
<TargetPlatformVersion>10.0.14393.0</TargetPlatformVersion>
<TargetPlatformVersion>10.0.15063.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>
</PropertyGroup>
</Project>

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

@ -33,7 +33,7 @@
<ItemDefinitionGroup>
<Link>
<DelayLoadDLLs>d3dcompiler_47.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<AdditionalDependencies>mincore.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>

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

@ -89,14 +89,14 @@ Licensed under the MIT License. See LICENSE.txt in the project root for license
<listItem>
To develop for Windows 10 (Universal Windows Platform):
<list class="bullet">
<listItem>Recommended version: Visual Studio Community 2015 with Update 3 and Universal Windows App Development Tools 1.4.1</listItem>
<listItem>Recommended version: Visual Studio Community 2017 with Visual Studio Tools for Universal Windows Apps 15.0.26430.06</listItem>
<listItem>Minimum version: Visual Studio Community 2015 with Update 1</listItem>
</list>
<listItem>
To develop for Windows 8.1 or Windows Phone 8.1:
<list class="bullet">
<listItem>Recommended version: Visual Studio Community 2015</listItem>
<listItem>Recommended version: Visual Studio Community 2017</listItem>
<listItem>Minimum version: Visual Studio Community 2013 with Update 5</listItem>
<listItem>If using Visual Studio Express, requires the 'for Windows' version (not 'for Windows Desktop')</listItem>
</list>
@ -108,7 +108,7 @@ Licensed under the MIT License. See LICENSE.txt in the project root for license
<list class="bullet">
<listItem>Go to 'File' -> 'New' -> 'Project...'</listItem>
<listItem>Select 'Visual C#', 'Visual C++', or 'Visual Basic'</listItem>
<listItem>Create a 'Blank App (Universal Windows)' (Visual Studio 2015) or 'Blank App (Universal Apps)' (Visual Studio 2013)</listItem>
<listItem>Create a 'Blank App (Universal Windows)' (Visual Studio 2017) or 'Blank App (Universal Apps)' (Visual Studio 2013)</listItem>
<listItem>Enter a project name of your choosing</listItem>
<listItem>Click 'OK'</listItem>
</list>

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

@ -108,8 +108,8 @@ Licensed under the MIT License. See LICENSE.txt in the project root for license
<p>
Custom pixel shaders are written in HLSL (High Level Shading Language) and
compiled with the Direct3D Shader Compiler (fxc.exe). This tool can be found in
the Visual Studio 2015 "Developer Command Prompt" (note this is different from
the "MSBuild Command Prompt").
the Visual Studio 2015 "Developer Command Prompt" or Visual Studio 2017
"Developer Command Prompt" (note this is different from the "MSBuild Command Prompt").
</p>
<p>
To compile your shader, invoke fxc twice using the options:

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

@ -17,6 +17,13 @@
using namespace ABI::Microsoft::Graphics::Canvas;
using namespace ABI::Microsoft::Graphics::Canvas::Text;
// There are cases in which a DWrite method has two overloads where only one of them is valid, and
// we want to create a pointer-to-member to one overload. However, as of VS2017. the compiler can't automatically
// determine the valid one, so we need to explicitly choose the overload. The typedefs below are for doing that.
typedef HRESULT(__stdcall IDWriteTextLayout::*getStringLengthMethod_t)(uint32_t, uint32_t*, DWRITE_TEXT_RANGE*);
typedef HRESULT(__stdcall IDWriteTextLayout::*getStringMethod_t)(uint32_t, wchar_t*, uint32_t, DWRITE_TEXT_RANGE*);
template <class GET_ATTRIBUTE_LENGTH_METHOD, class GET_ATTRIBUTE_METHOD>
static WinString GetTextFromLayoutResource(
GET_ATTRIBUTE_LENGTH_METHOD fnGetLength,
@ -647,8 +654,8 @@ IFACEMETHODIMP CanvasTextLayout::GetFontFamily(
auto& resource = GetResource();
auto fontFamilyName = GetTextFromLayoutResource(
&IDWriteTextLayout::GetFontFamilyNameLength,
&IDWriteTextLayout::GetFontFamilyName,
static_cast<getStringLengthMethod_t>(&IDWriteTextLayout::GetFontFamilyNameLength),
static_cast<getStringMethod_t>(&IDWriteTextLayout::GetFontFamilyName),
characterIndex,
resource.Get());
@ -747,8 +754,8 @@ IFACEMETHODIMP CanvasTextLayout::GetLocaleName(
auto& resource = GetResource();
auto name = GetTextFromLayoutResource(
&IDWriteTextLayout::GetLocaleNameLength,
&IDWriteTextLayout::GetLocaleName,
static_cast<getStringLengthMethod_t>(&IDWriteTextLayout::GetLocaleNameLength),
static_cast<getStringMethod_t>(&IDWriteTextLayout::GetLocaleName),
characterIndex,
resource.Get());
@ -1594,7 +1601,7 @@ IFACEMETHODIMP CanvasTextLayout::get_LineMetrics(
auto& resource = GetResource();
uint32_t lineCount;
HRESULT hr = resource->GetLineMetrics(nullptr, 0, &lineCount);
HRESULT hr = resource->GetLineMetrics(static_cast<DWriteMetricsType*>(nullptr), 0, &lineCount);
assert(hr == E_NOT_SUFFICIENT_BUFFER);
if (hr != E_NOT_SUFFICIENT_BUFFER)

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

@ -260,10 +260,10 @@ TEST_CLASS(CanvasVirtualBitmapUnitTest)
{
std::pair<HRESULT, boolean> testCases[]
{
{ S_OK , TRUE },
{ D2DERR_WRONG_STATE , TRUE },
{ D2DERR_UNSUPPORTED_OPERATION , FALSE },
{ E_FAIL , TRUE }
{ S_OK , true },
{ D2DERR_WRONG_STATE , true },
{ D2DERR_UNSUPPORTED_OPERATION , false },
{ E_FAIL , true }
};
for (auto testCase : testCases)

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

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>{063AB629-AADF-4749-B259-AB815B1AEB01}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
@ -12,7 +12,7 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<TargetName>winrt.test.internal.uap</TargetName>
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>