forked from qt-creator/qt-creator
More import fixes and tweaks
Don't add -spec foo to the additional Arguments if foo is the same as the default mkspec. This makes the common case better, while breaking if you have QMAKESPEC set in teh environment and used -spec foo to override it.
This commit is contained in:
@@ -66,6 +66,18 @@ ProjectLoadWizard::ProjectLoadWizard(Qt4Project *project, QWidget *parent, Qt::W
|
|||||||
QtVersionManager::scanMakeFile(directory, m_importVersion->defaultBuildConfig());
|
QtVersionManager::scanMakeFile(directory, m_importVersion->defaultBuildConfig());
|
||||||
m_importBuildConfig = result.first;
|
m_importBuildConfig = result.first;
|
||||||
m_additionalArguments = result.second;
|
m_additionalArguments = result.second;
|
||||||
|
|
||||||
|
QString versionSpec = m_importVersion->sourcePath() + "/mkspecs/" + m_importVersion->mkspec();
|
||||||
|
QString parsedSpec = Qt4Project::extractSpecFromArgumentList(m_additionalArguments);
|
||||||
|
QString parsedSpecOrginal = parsedSpec;
|
||||||
|
if (QFileInfo(parsedSpec).isRelative())
|
||||||
|
parsedSpec = QDir::cleanPath(directory + "/" + parsedSpec);
|
||||||
|
m_additionalArguments = Qt4Project::removeSpecFromArgumentList(m_additionalArguments);
|
||||||
|
if (parsedSpec != versionSpec) {
|
||||||
|
m_additionalArguments.prepend(parsedSpecOrginal);
|
||||||
|
m_additionalArguments.prepend("-spec");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// So now we have the version and the configuration for that version
|
// So now we have the version and the configuration for that version
|
||||||
|
|||||||
@@ -1106,7 +1106,7 @@ void Qt4Project::invalidateCachedTargetInformation()
|
|||||||
// intelligent matching for -cache, but i guess people rarely
|
// intelligent matching for -cache, but i guess people rarely
|
||||||
// do use that.
|
// do use that.
|
||||||
|
|
||||||
QStringList removeSpecFromArgumentList(const QStringList &old)
|
QStringList Qt4Project::removeSpecFromArgumentList(const QStringList &old)
|
||||||
{
|
{
|
||||||
if (!old.contains("-spec") && !old.contains("-platform") && !old.contains("-cache"))
|
if (!old.contains("-spec") && !old.contains("-platform") && !old.contains("-cache"))
|
||||||
return old;
|
return old;
|
||||||
@@ -1128,7 +1128,7 @@ QStringList removeSpecFromArgumentList(const QStringList &old)
|
|||||||
return newList;
|
return newList;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString extractSpecFromArgumentList(const QStringList &list)
|
QString Qt4Project::extractSpecFromArgumentList(const QStringList &list)
|
||||||
{
|
{
|
||||||
int index = list.indexOf("-spec");
|
int index = list.indexOf("-spec");
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
@@ -1157,7 +1157,7 @@ bool Qt4Project::compareBuildConfigurationToImportFrom(const QString &buildConfi
|
|||||||
// and compare that on its own
|
// and compare that on its own
|
||||||
QString actualSpec = extractSpecFromArgumentList(qmakeStep()->value(buildConfiguration, "qmakeArgs").toStringList());
|
QString actualSpec = extractSpecFromArgumentList(qmakeStep()->value(buildConfiguration, "qmakeArgs").toStringList());
|
||||||
if (actualSpec.isEmpty())
|
if (actualSpec.isEmpty())
|
||||||
actualSpec = qtVersion(buildConfiguration)->mkspec();
|
actualSpec = version->mkspec();
|
||||||
QString parsedSpec = extractSpecFromArgumentList(result.second);
|
QString parsedSpec = extractSpecFromArgumentList(result.second);
|
||||||
|
|
||||||
// Now to convert the actualSpec to a absolute path, we go through a few hops
|
// Now to convert the actualSpec to a absolute path, we go through a few hops
|
||||||
@@ -1180,7 +1180,6 @@ bool Qt4Project::compareBuildConfigurationToImportFrom(const QString &buildConfi
|
|||||||
if (QFileInfo(parsedSpec).isRelative())
|
if (QFileInfo(parsedSpec).isRelative())
|
||||||
parsedSpec = QDir::cleanPath(workingDirectory + "/" + parsedSpec);
|
parsedSpec = QDir::cleanPath(workingDirectory + "/" + parsedSpec);
|
||||||
|
|
||||||
|
|
||||||
qDebug()<<"before:"<<qmakeStep()->value(buildConfiguration, "qmakeArgs").toStringList();
|
qDebug()<<"before:"<<qmakeStep()->value(buildConfiguration, "qmakeArgs").toStringList();
|
||||||
QStringList actualArgs = removeSpecFromArgumentList(qmakeStep()->value(buildConfiguration, "qmakeArgs").toStringList());
|
QStringList actualArgs = removeSpecFromArgumentList(qmakeStep()->value(buildConfiguration, "qmakeArgs").toStringList());
|
||||||
qDebug()<<"after:"<<actualArgs;
|
qDebug()<<"after:"<<actualArgs;
|
||||||
|
|||||||
@@ -198,6 +198,8 @@ public:
|
|||||||
|
|
||||||
bool compareBuildConfigurationToImportFrom(const QString &buildConfiguration, const QString &workingDirectory);
|
bool compareBuildConfigurationToImportFrom(const QString &buildConfiguration, const QString &workingDirectory);
|
||||||
|
|
||||||
|
static QStringList removeSpecFromArgumentList(const QStringList &old);
|
||||||
|
static QString extractSpecFromArgumentList(const QStringList &list);
|
||||||
signals:
|
signals:
|
||||||
void targetInformationChanged();
|
void targetInformationChanged();
|
||||||
|
|
||||||
|
|||||||
@@ -231,8 +231,7 @@ void Qt4ProjectConfigWidget::shadowBuildLineEditTextChanged()
|
|||||||
|
|
||||||
void Qt4ProjectConfigWidget::importLabelClicked()
|
void Qt4ProjectConfigWidget::importLabelClicked()
|
||||||
{
|
{
|
||||||
if (m_ui->shadowBuildCheckBox->isChecked()) {
|
QString directory = m_pro->buildDirectory(m_buildConfiguration);
|
||||||
QString directory = m_ui->shadowBuildDirEdit->path();
|
|
||||||
if (!directory.isEmpty()) {
|
if (!directory.isEmpty()) {
|
||||||
QString qtPath = QtVersionManager::findQtVersionFromMakefile(directory);
|
QString qtPath = QtVersionManager::findQtVersionFromMakefile(directory);
|
||||||
if (!qtPath.isEmpty()) {
|
if (!qtPath.isEmpty()) {
|
||||||
@@ -248,6 +247,17 @@ void Qt4ProjectConfigWidget::importLabelClicked()
|
|||||||
QtVersion::QmakeBuildConfig qmakeBuildConfig = result.first;
|
QtVersion::QmakeBuildConfig qmakeBuildConfig = result.first;
|
||||||
QStringList additionalArguments = result.second;
|
QStringList additionalArguments = result.second;
|
||||||
|
|
||||||
|
QString versionSpec = version->sourcePath() + "/mkspecs/" + version->mkspec();
|
||||||
|
QString parsedSpec = Qt4Project::extractSpecFromArgumentList(additionalArguments);
|
||||||
|
QString parsedSpecOrginal = parsedSpec;
|
||||||
|
if (QFileInfo(parsedSpec).isRelative())
|
||||||
|
parsedSpec = QDir::cleanPath(directory + "/" + parsedSpec);
|
||||||
|
additionalArguments = Qt4Project::removeSpecFromArgumentList(additionalArguments);
|
||||||
|
if (parsedSpec != versionSpec) {
|
||||||
|
additionalArguments.prepend(parsedSpecOrginal);
|
||||||
|
additionalArguments.prepend("-spec");
|
||||||
|
}
|
||||||
|
|
||||||
// So we got all the information now apply it...
|
// So we got all the information now apply it...
|
||||||
m_pro->setQtVersion(m_buildConfiguration, version->uniqueId());
|
m_pro->setQtVersion(m_buildConfiguration, version->uniqueId());
|
||||||
// Combo box will be updated at the end
|
// Combo box will be updated at the end
|
||||||
@@ -274,7 +284,6 @@ void Qt4ProjectConfigWidget::importLabelClicked()
|
|||||||
makeStep->setValue(m_buildConfiguration, "makeargs", makeCmdArguments);
|
makeStep->setValue(m_buildConfiguration, "makeargs", makeCmdArguments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
setupQtVersionsComboBox();
|
setupQtVersionsComboBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user