From 0a348dd8e26c6bb458a215538c7a97652b0d9c01 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 18 Jun 2012 18:00:24 +0200 Subject: [PATCH] use QT_HOST_* where appropriate for x-builds, the host binaries and data may be in a different place than the ones for the target. we have fallback code for qt 4, so we can use the new variables unconditionally. this patch may be incomplete - there are still some uses which *may* need changing. Change-Id: Ia96c4ea99c5c7fc62bbe32d0283c82eef5c1eefd Reviewed-by: Daniel Teske --- .../qt4projectmanager/qt4projectmanager.cpp | 16 +++++++++++----- src/plugins/qtsupport/baseqtversion.cpp | 14 +++++++------- src/shared/proparser/qmakeevaluator.cpp | 4 ++-- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.cpp b/src/plugins/qt4projectmanager/qt4projectmanager.cpp index d7df4ae73f2..6ecd7a78921 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanager.cpp +++ b/src/plugins/qt4projectmanager/qt4projectmanager.cpp @@ -79,6 +79,7 @@ using ProjectExplorer::FormType; using ProjectExplorer::ResourceType; using ProjectExplorer::UnknownFileType; +static const char kHostBins[] = "CurrentProject:QT_HOST_BINS"; static const char kInstallBins[] = "CurrentProject:QT_INSTALL_BINS"; // Known file types of a Qt 4 project @@ -142,8 +143,11 @@ void Qt4Manager::init() this, SLOT(editorChanged(Core::IEditor*))); Core::VariableManager *vm = Core::VariableManager::instance(); + vm->registerVariable(kHostBins, + tr("Full path to the host bin directory of the current project's Qt version.")); vm->registerVariable(kInstallBins, - tr("Full path to the bin directory of the current project's Qt version.")); + tr("Full path to the target bin directory of the current project's Qt version." + " You probably want %1 instead.").arg(QString::fromLatin1(kHostBins))); connect(vm, SIGNAL(variableUpdateRequested(QByteArray)), this, SLOT(updateVariable(QByteArray))); } @@ -189,10 +193,10 @@ void Qt4Manager::editorAboutToClose(Core::IEditor *editor) void Qt4Manager::updateVariable(const QByteArray &variable) { - if (variable == kInstallBins) { + if (variable == kHostBins || variable == kInstallBins) { Qt4Project *qt4pro = qobject_cast(ProjectExplorer::ProjectExplorerPlugin::currentProject()); if (!qt4pro) { - Core::VariableManager::instance()->remove(kInstallBins); + Core::VariableManager::instance()->remove(variable); return; } QString value; @@ -203,8 +207,10 @@ void Qt4Manager::updateVariable(const QByteArray &variable) qtv = QtSupport::QtProfileInformation::qtVersion(ProjectExplorer::ProfileManager::instance()->defaultProfile()); if (qtv) - value = qtv->versionInfo().value(QLatin1String("QT_INSTALL_BINS")); - Core::VariableManager::instance()->insert(kInstallBins, value); + value = qtv->versionInfo().value(variable == kHostBins + ? QLatin1String("QT_HOST_BINS") + : QLatin1String("QT_INSTALL_BINS")); + Core::VariableManager::instance()->insert(variable, value); } } diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 088e041ed8a..af9c8869ac9 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -362,7 +362,7 @@ bool BaseQtVersion::isValid() const return !qmakeCommand().isEmpty() && m_installed - && m_versionInfo.contains(QLatin1String("QT_INSTALL_BINS")) + && m_versionInfo.contains(QLatin1String("QT_HOST_BINS")) && !m_mkspecFullPath.isEmpty() && m_qmakeIsExecutable; } @@ -377,7 +377,7 @@ QString BaseQtVersion::invalidReason() const return QCoreApplication::translate("QtVersion", "qmake does not exist or is not executable"); if (!m_installed) return QCoreApplication::translate("QtVersion", "Qt version is not properly installed, please run make install"); - if (!m_versionInfo.contains(QLatin1String("QT_INSTALL_BINS"))) + if (!m_versionInfo.contains(QLatin1String("QT_HOST_BINS"))) return QCoreApplication::translate("QtVersion", "Could not determine the path to the binaries of the Qt installation, maybe the qmake path is wrong?"); if (m_mkspecUpToDate && m_mkspecFullPath.isEmpty()) @@ -533,7 +533,7 @@ void BaseQtVersion::updateSourcePath() const if (!m_sourcePath.isEmpty()) return; updateVersionInfo(); - const QString installData = m_versionInfo.value(QLatin1String("QT_INSTALL_DATA")); + const QString installData = m_versionInfo.value(QLatin1String("QT_INSTALL_PREFIX")); QString sourcePath = installData; QFile qmakeCache(installData + QLatin1String("/.qmake.cache")); if (qmakeCache.exists()) { @@ -592,7 +592,7 @@ QString BaseQtVersion::findQtBinary(Binaries binary) const { QString baseDir; if (qtVersion() < QtVersionNumber(5, 0, 0)) { - baseDir = versionInfo().value(QLatin1String("QT_INSTALL_BINS")); + baseDir = versionInfo().value(QLatin1String("QT_HOST_BINS")); } else { ensureMkSpecParsed(); switch (binary) { @@ -604,7 +604,7 @@ QString BaseQtVersion::findQtBinary(Binaries binary) const baseDir = m_mkspecValues.value(QLatin1String("QT.designer.bins")); break; case Uic: - baseDir = versionInfo().value(QLatin1String("QT_INSTALL_BINS")); + baseDir = versionInfo().value(QLatin1String("QT_HOST_BINS")); break; default: // Can't happen @@ -953,8 +953,8 @@ QList BaseQtVersion::systemHeaderPathes(const Proje void BaseQtVersion::addToEnvironment(const ProjectExplorer::Profile *p, Utils::Environment &env) const { Q_UNUSED(p); - env.set(QLatin1String("QTDIR"), QDir::toNativeSeparators(versionInfo().value(QLatin1String("QT_INSTALL_DATA")))); - env.prependOrSetPath(versionInfo().value(QLatin1String("QT_INSTALL_BINS"))); + env.set(QLatin1String("QTDIR"), QDir::toNativeSeparators(versionInfo().value(QLatin1String("QT_HOST_DATA")))); + env.prependOrSetPath(versionInfo().value(QLatin1String("QT_HOST_BINS"))); } bool BaseQtVersion::hasGdbDebuggingHelper() const diff --git a/src/shared/proparser/qmakeevaluator.cpp b/src/shared/proparser/qmakeevaluator.cpp index 877510876be..c540e9dff24 100644 --- a/src/shared/proparser/qmakeevaluator.cpp +++ b/src/shared/proparser/qmakeevaluator.cpp @@ -1236,7 +1236,7 @@ QStringList QMakeEvaluator::qmakeMkspecPaths() const if (!m_sourceRoot.isEmpty()) ret << m_sourceRoot + concat; - ret << m_option->propertyValue(ProString("QT_INSTALL_DATA")) + concat; + ret << m_option->propertyValue(ProString("QT_HOST_DATA")) + concat; ret.removeDuplicates(); return ret; @@ -1280,7 +1280,7 @@ QStringList QMakeEvaluator::qmakeFeaturePaths() const } } - feature_bases << (m_option->propertyValue(ProString("QT_INSTALL_DATA")).toQString(m_mtmp) + feature_bases << (m_option->propertyValue(ProString("QT_HOST_DATA")).toQString(m_mtmp) + mkspecs_concat); foreach (const QString &fb, feature_bases) {