Skip to content

Commit

Permalink
Projucer: Use a workaround to set the VS2017 Windows target platform …
Browse files Browse the repository at this point in the history
…option to the latest Windows 10 SDK installed on the build machine by default
  • Loading branch information
ed95 committed Sep 7, 2018
1 parent 773ca9a commit bb0a0d3
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h
Expand Up @@ -77,8 +77,8 @@ class MSVCProjectExporterBase : public ProjectExporter

props.add (new TextPropertyComponent (targetPlatformVersion, "Windows Target Platform", 20, false),
String ("Specifies the version of the Windows SDK that will be used when building this project. ")
+ (isWindows10SDK ? "You can see which SDKs you have installed on your machine by going to \"Program Files (x86)\\Windows Kits\\10\\Lib\". " : "")
+ "The default value for this exporter is " + getDefaultWindowsTargetPlatformVersion());
+ (isWindows10SDK ? "Leave this field empty to use the latest Windows 10 SDK installed on the build machine."
: "The default value for this exporter is " + getDefaultWindowsTargetPlatformVersion()));
}

void addPlatformToolsetToPropertyGroup (XmlElement& p) const
Expand All @@ -89,8 +89,23 @@ class MSVCProjectExporterBase : public ProjectExporter

void addWindowsTargetPlatformVersionToPropertyGroup (XmlElement& p) const
{
forEachXmlChildElementWithTagName (p, e, "PropertyGroup")
e->createNewChildElement ("WindowsTargetPlatformVersion")->addTextElement (getWindowsTargetPlatformVersion());
auto target = getWindowsTargetPlatformVersion();

if (target == "Latest")
{
forEachXmlChildElementWithTagName (p, e, "PropertyGroup")
{
auto* child = e->createNewChildElement ("WindowsTargetPlatformVersion");

child->setAttribute ("Condition", "'$(WindowsTargetPlatformVersion)' == ''");
child->addTextElement ("$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))");
}
}
else
{
forEachXmlChildElementWithTagName (p, e, "PropertyGroup")
e->createNewChildElement ("WindowsTargetPlatformVersion")->addTextElement (target);
}
}

void addIPPSettingToPropertyGroup (XmlElement& p) const
Expand Down Expand Up @@ -1944,7 +1959,7 @@ class MSVCProjectExporterVC2017 : public MSVCProjectExporterBase
String getSolutionComment() const override { return "# Visual Studio 2017"; }
String getToolsVersion() const override { return "15.0"; }
String getDefaultToolset() const override { return "v141"; }
String getDefaultWindowsTargetPlatformVersion() const override { return "10.0.16299.0"; }
String getDefaultWindowsTargetPlatformVersion() const override { return "Latest"; }

static MSVCProjectExporterVC2017* createForSettings (Project& project, const ValueTree& settings)
{
Expand Down

0 comments on commit bb0a0d3

Please sign in to comment.