move platform toolset retrieval to VcprojGenerator

In a subsequent commit we will need access to more information of the
project object. This is merely a refactoring.

Change-Id: I40e501d037eb7d0295e1057e7b86e404e88e6ca3
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
Joerg Bornemann 2014-04-02 17:16:33 +02:00 committed by The Qt Project
parent 6ad458bc93
commit f412f2b5ee
5 changed files with 28 additions and 26 deletions

View File

@ -1779,8 +1779,7 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCConfiguration &tool)
xml << tag("PropertyGroup")
<< attrTag("Condition", generateCondition(tool))
<< attrTag("Label", "Configuration")
<< attrTagS(_PlatformToolSet, platformToolSetVersion(tool.CompilerVersion,
tool.WinPhone))
<< attrTagS(_PlatformToolSet, tool.PlatformToolSet)
<< attrTagS(_OutputDirectory, tool.OutputDirectory)
<< attrTagT(_ATLMinimizesCRunTimeLibraryUsage, tool.ATLMinimizesCRunTimeLibraryUsage)
<< attrTagT(_BuildBrowserInformation, tool.BuildBrowserInformation)
@ -2193,27 +2192,4 @@ QString VCXProjectWriter::generateCondition(const VCConfiguration &config)
return QStringLiteral("'$(Configuration)|$(Platform)'=='") + config.Name + QLatin1Char('\'');
}
QString VCXProjectWriter::platformToolSetVersion(const DotNET version, bool winphoneBuild)
{
// The PlatformToolset string corresponds to the name of a directory in
// $(VCTargetsPath)\Platforms\{Win32,x64,...}\PlatformToolsets
// e.g. v90, v100, v110, v110_xp, v120_CTP_Nov, v120, or WindowsSDK7.1
// This environment variable may be set by a commandline build
// environment such as the Windows SDK command prompt
QByteArray envVar = qgetenv("PlatformToolset");
if (!envVar.isEmpty())
return envVar;
switch (version)
{
case NET2012:
return winphoneBuild ? "v110_wp80" : "v110";
case NET2013:
return "v120";
default:
return QString();
}
}
QT_END_NAMESPACE

View File

@ -184,7 +184,6 @@ private:
static void outputFileConfigs(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter, const VCFilterFile &info, const QString &filtername);
static bool outputFileConfig(VCFilter &filter, XmlOutput &xml, XmlOutput &xmlFilter, const QString &filename, const QString &filtername, bool fileAllreadyAdded);
static QString generateCondition(const VCConfiguration &config);
static QString platformToolSetVersion(const DotNET version, bool winphoneBuild);
friend class XTreeNode;
friend class XFlatNode;

View File

@ -901,6 +901,7 @@ public:
QString OutputDirectory;
QString PrimaryOutput;
QString ProgramDatabase;
QString PlatformToolSet;
triState RegisterOutput;
useOfATL UseOfATL;
useOfMfc UseOfMfc;

View File

@ -384,6 +384,29 @@ QUuid VcprojGenerator::increaseUUID(const QUuid &id)
return result;
}
QString VcprojGenerator::retrievePlatformToolSet() const
{
// The PlatformToolset string corresponds to the name of a directory in
// $(VCTargetsPath)\Platforms\{Win32,x64,...}\PlatformToolsets
// e.g. v90, v100, v110, v110_xp, v120_CTP_Nov, v120, or WindowsSDK7.1
// This environment variable may be set by a commandline build
// environment such as the Windows SDK command prompt
QByteArray envVar = qgetenv("PlatformToolset");
if (!envVar.isEmpty())
return envVar;
switch (vcProject.Configuration.CompilerVersion)
{
case NET2012:
return vcProject.Configuration.WinPhone ? "v110_wp80" : "v110";
case NET2013:
return "v120";
default:
return QString();
}
}
ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QString, QString> &projLookup,
QHash<QString, QString> &projGuids,
QHash<VcsolutionDepend *, QStringList> &extraSubdirs,
@ -969,6 +992,8 @@ void VcprojGenerator::initConfiguration()
if (!conf.OutputDirectory.endsWith("\\"))
conf.OutputDirectory += '\\';
if (conf.CompilerVersion >= NET2010) {
conf.PlatformToolSet = retrievePlatformToolSet();
// The target name could have been changed.
conf.PrimaryOutput = project->first("TARGET").toQString();
if ( !conf.PrimaryOutput.isEmpty() && !project->first("TARGET_VERSION_EXT").isEmpty() && project->isActiveConfig("shared"))

View File

@ -144,6 +144,7 @@ private:
QHash<QString, ProStringList> &subdirProjectLookup,
const ProStringList &allDependencies = ProStringList());
QUuid increaseUUID(const QUuid &id);
QString retrievePlatformToolSet() const;
friend class VCFilter;
};