ICU-20238 Autodetect Visual Studio version, and autodetect the installed Windows 10 SDK version.
diff --git a/icu4c/source/allinone/Build.Windows.PlatformToolset.props b/icu4c/source/allinone/Build.Windows.PlatformToolset.props new file mode 100644 index 0000000..778ee26 --- /dev/null +++ b/icu4c/source/allinone/Build.Windows.PlatformToolset.props
@@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2016 and later: Unicode, Inc. and others. License & terms of use: http://www.unicode.org/copyright.html --> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <!-- This file is used to set the PlatformToolset configuration option for all UWP projects. --> + + <!-- Automatic PlatformToolset version selection. --> + <!-- If there is no DefaultPlatformToolset set, we will detect the version based on version of the build tools. --> + <PropertyGroup> + <BuildToolVersion>$(VisualStudioVersion)</BuildToolVersion> + <BuildToolVersion Condition="'$(BuildToolVersion)'==''">$(MSBuildToolsVersion)</BuildToolVersion> + <!-- Note: v140 is the Visual Studio 2015 toolset. v141 is the Visual Studio 2017 toolset. --> + <AutoDetectedPlatformToolset Condition="'$(BuildToolVersion)'=='14.0'">v140</AutoDetectedPlatformToolset> + <AutoDetectedPlatformToolset Condition="'$(BuildToolVersion)'=='15.0'">v141</AutoDetectedPlatformToolset> + </PropertyGroup> + <PropertyGroup Label="EmptyDefaultPlatformToolset"> + <DefaultPlatformToolset Condition=" '$(DefaultPlatformToolset)' == '' ">$(AutoDetectedPlatformToolset)</DefaultPlatformToolset> + </PropertyGroup> + <PropertyGroup Label="PlatformToolset"> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> +</Project>
diff --git a/icu4c/source/allinone/Build.Windows.ProjectConfiguration.props b/icu4c/source/allinone/Build.Windows.ProjectConfiguration.props index 0e74cb4..3557e9c 100644 --- a/icu4c/source/allinone/Build.Windows.ProjectConfiguration.props +++ b/icu4c/source/allinone/Build.Windows.ProjectConfiguration.props
@@ -21,12 +21,8 @@ <Platform>x64</Platform> </ProjectConfiguration> </ItemGroup> - <PropertyGroup> - <!-- This is the version of the MSVC tool-set to use. --> - <!-- v140 is the Visual Studio 2015 toolset. --> - <!-- v141 is the Visual Studio 2017 toolset. --> - <PlatformToolset>v141</PlatformToolset> - </PropertyGroup> + <!-- The following import will set the PlatformToolset configuration. --> + <Import Project="Build.Windows.PlatformToolset.props" /> <PropertyGroup> <!-- This is the default SDK target. --> <!-- Note that the Windows 8.1 SDK is backwards compatible down-level to Windows 7, so
diff --git a/icu4c/source/allinone/Build.Windows.UWP.ProjectConfiguration.props b/icu4c/source/allinone/Build.Windows.UWP.ProjectConfiguration.props index 5988c73..5dffa96 100644 --- a/icu4c/source/allinone/Build.Windows.UWP.ProjectConfiguration.props +++ b/icu4c/source/allinone/Build.Windows.UWP.ProjectConfiguration.props
@@ -3,21 +3,27 @@ <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <!-- This file is used to set common configuration options for all *_uwp projects. --> <PropertyGroup> - <!-- If not already set, use this version of the Win10 SDK --> - <WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion> - <!-- If not already set, set the minimum Win10 SDK version to TH1/RTM --> - <WindowsTargetPlatformMinVersion>10.0.10240.0</WindowsTargetPlatformMinVersion> - <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion> <AppContainerApplication>true</AppContainerApplication> <ApplicationType>Windows Store</ApplicationType> <ApplicationTypeRevision>10.0</ApplicationTypeRevision> </PropertyGroup> - <PropertyGroup> - <!-- This is the version of the MSVC tool-set to use. --> - <!-- v141 is the Visual Studio 2017 toolset. --> - <PlatformToolset>v141</PlatformToolset> + <!-- If not already set, then we will default to using the latest installed Windows 10 SDK version. --> + <PropertyGroup Condition="'$(WindowsTargetPlatformVersion)'==''"> + <!-- Detect the SDK version. --> + <WindowsSdkInstallFolder_10 Condition="'$(WindowsSdkInstallFolder_10)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@InstallationFolder)</WindowsSdkInstallFolder_10> + <WindowsSdkInstallFolder_10 Condition="'$(WindowsSdkInstallFolder_10)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0@InstallationFolder)</WindowsSdkInstallFolder_10> + <WindowsTargetPlatformVersion_10 Condition="'$(WindowsTargetPlatformVersion_10)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion)</WindowsTargetPlatformVersion_10> + <WindowsTargetPlatformVersion_10 Condition="'$(WindowsTargetPlatformVersion_10)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion)</WindowsTargetPlatformVersion_10> + <!-- Sometimes the version in the registry has the '.0' suffix, and sometimes it doesn't. Check and add it. --> + <WindowsTargetPlatformVersion_10 Condition="'$(WindowsTargetPlatformVersion_10)' != '' and !$(WindowsTargetPlatformVersion_10.EndsWith('.0'))">$(WindowsTargetPlatformVersion_10).0</WindowsTargetPlatformVersion_10> + <!-- Set the default. --> + <WindowsTargetPlatformVersion>$(WindowsTargetPlatformVersion_10)</WindowsTargetPlatformVersion> + <!-- Set the minimum Win10 SDK version to TH1/RTM. --> + <WindowsTargetPlatformMinVersion>10.0.10240.0</WindowsTargetPlatformMinVersion> </PropertyGroup> + <!-- The following import will set the PlatformToolset configuration. --> + <Import Project="..\allinone\Build.Windows.PlatformToolset.props" /> <ItemDefinitionGroup> <Midl> <PreprocessorDefinitions>