Move mkspec policy into the Qt4 targets

For embedded we do not want to override the mkspec as used in the Qt version
since that was most likely tweaked to work with the tool chain selected.

In a generic desktop target we want to be able to switch between different
compilers of the same ABI.

Change-Id: Ib49e54dd15e78c2459b17c552a3c31cb3dce63eb
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
Tobias Hunger
2011-11-01 17:19:30 +01:00
parent 08dd5fea41
commit abbfc62f03
5 changed files with 35 additions and 17 deletions

View File

@@ -457,17 +457,7 @@ QString QMakeStep::mkspec()
} }
} }
QtSupport::BaseQtVersion *version = bc->qtVersion(); return static_cast<Qt4BaseTarget *>(target())->mkspec(bc);
// We do not know which abi the Qt version has, so let's stick with the defaults
if (version && version->qtAbis().count() == 1 && version->qtAbis().first().isNull())
return QString();
const QString tcSpec = bc->toolChain() ? bc->toolChain()->mkspec() : QString();
if (!version)
return tcSpec;
if (!tcSpec.isEmpty() && version->hasMkspec(tcSpec))
return tcSpec;
return version->mkspec();
} }
QVariantMap QMakeStep::toMap() const QVariantMap QMakeStep::toMap() const

View File

@@ -310,6 +310,21 @@ ProjectExplorer::ToolChain *Qt4BaseTarget::preferredToolChain(ProjectExplorer::B
return tcs.isEmpty() ? 0 : tcs.at(0); return tcs.isEmpty() ? 0 : tcs.at(0);
} }
QString Qt4BaseTarget::mkspec(const Qt4BuildConfiguration *bc) const
{
QtSupport::BaseQtVersion *version = bc->qtVersion();
// We do not know which abi the Qt version has, so let's stick with the defaults
if (version && version->qtAbis().count() == 1 && version->qtAbis().first().isNull())
return QString();
const QString tcSpec = bc->toolChain() ? bc->toolChain()->mkspec() : QString();
if (!version)
return tcSpec;
if (!tcSpec.isEmpty() && version->hasMkspec(tcSpec))
return tcSpec;
return version->mkspec();
}
void Qt4BaseTarget::removeUnconfiguredCustomExectutableRunConfigurations() void Qt4BaseTarget::removeUnconfiguredCustomExectutableRunConfigurations()
{ {
if (runConfigurations().count()) { if (runConfigurations().count()) {

View File

@@ -78,12 +78,12 @@ public:
// This is the same for almost all Qt4Targets // This is the same for almost all Qt4Targets
// so for now offer a convience function // so for now offer a convience function
Qt4BuildConfiguration *addQt4BuildConfiguration(QString defaultDisplayName, Qt4BuildConfiguration *addQt4BuildConfiguration(QString defaultDisplayName,
QString displayName, QString displayName,
QtSupport::BaseQtVersion *qtversion, QtSupport::BaseQtVersion *qtversion,
QtSupport::BaseQtVersion::QmakeBuildConfigs qmakeBuildConfiguration, QtSupport::BaseQtVersion::QmakeBuildConfigs qmakeBuildConfiguration,
QString additionalArguments, QString additionalArguments,
QString directory, QString directory,
bool importing); bool importing);
virtual void createApplicationProFiles() = 0; virtual void createApplicationProFiles() = 0;
@@ -92,6 +92,8 @@ public:
QList<ProjectExplorer::ToolChain *> possibleToolChains(ProjectExplorer::BuildConfiguration *bc) const; QList<ProjectExplorer::ToolChain *> possibleToolChains(ProjectExplorer::BuildConfiguration *bc) const;
ProjectExplorer::ToolChain *preferredToolChain(ProjectExplorer::BuildConfiguration *) const; ProjectExplorer::ToolChain *preferredToolChain(ProjectExplorer::BuildConfiguration *) const;
virtual QString mkspec(const Qt4BuildConfiguration *bc) const;
signals: signals:
void buildDirectoryInitialized(); void buildDirectoryInitialized();
/// emitted if the build configuration changed in a way that /// emitted if the build configuration changed in a way that

View File

@@ -39,6 +39,7 @@
#include <qt4projectmanager/qt4buildconfiguration.h> #include <qt4projectmanager/qt4buildconfiguration.h>
#include <qt4projectmanager/qt4nodes.h> #include <qt4projectmanager/qt4nodes.h>
#include <qt4projectmanager/qt4project.h> #include <qt4projectmanager/qt4project.h>
#include <qtsupport/baseqtversion.h>
#include <QtCore/QCoreApplication> #include <QtCore/QCoreApplication>
@@ -72,6 +73,14 @@ QList<ProjectExplorer::RunConfiguration *> EmbeddedLinuxTarget::runConfiguration
return result; return result;
} }
QString EmbeddedLinuxTarget::mkspec(const Qt4ProjectManager::Qt4BuildConfiguration *bc) const
{
QtSupport::BaseQtVersion *version = bc->qtVersion();
if (!version)
return QString();
return version->mkspec();
}
void EmbeddedLinuxTarget::createApplicationProFiles() void EmbeddedLinuxTarget::createApplicationProFiles()
{ {
removeUnconfiguredCustomExectutableRunConfigurations(); removeUnconfiguredCustomExectutableRunConfigurations();

View File

@@ -55,6 +55,8 @@ public:
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n); QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n);
QString mkspec(const Qt4ProjectManager::Qt4BuildConfiguration *bc) const;
private: private:
Qt4ProjectManager::Qt4BuildConfigurationFactory *m_buildConfigurationFactory; Qt4ProjectManager::Qt4BuildConfigurationFactory *m_buildConfigurationFactory;