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 <daniel.teske@nokia.com>
This commit is contained in:
Oswald Buddenhagen
2012-06-18 18:00:24 +02:00
parent da26368d9e
commit 0a348dd8e2
3 changed files with 20 additions and 14 deletions

View File

@@ -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<Qt4Project *>(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);
}
}

View File

@@ -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<ProjectExplorer::HeaderPath> 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

View File

@@ -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) {