2011-05-04 13:14:46 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2012-01-26 18:33:46 +01:00
|
|
|
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
2011-05-04 13:14:46 +02:00
|
|
|
**
|
2011-11-02 15:59:12 +01:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2011-05-04 13:14:46 +02:00
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
|
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
|
|
|
** Please review the following information to ensure the GNU Lesser General
|
|
|
|
|
** Public License version 2.1 requirements will be met:
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
|
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-11-02 15:59:12 +01:00
|
|
|
** Nokia at qt-info@nokia.com.
|
2011-05-04 13:14:46 +02:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "baseqtversion.h"
|
|
|
|
|
#include "qmlobservertool.h"
|
|
|
|
|
#include "qmldumptool.h"
|
|
|
|
|
#include "qmldebugginglibrary.h"
|
2012-04-24 15:49:09 +02:00
|
|
|
#include "qtprofileinformation.h"
|
2011-05-04 13:14:46 +02:00
|
|
|
|
|
|
|
|
#include "qtversionmanager.h"
|
2011-05-20 21:40:53 +02:00
|
|
|
#include "profilereader.h"
|
2011-05-04 13:14:46 +02:00
|
|
|
#include <projectexplorer/toolchainmanager.h>
|
2011-08-18 13:46:52 +02:00
|
|
|
#include <projectexplorer/toolchain.h>
|
2011-05-04 13:14:46 +02:00
|
|
|
#include <projectexplorer/gnumakeparser.h>
|
2012-04-24 15:49:09 +02:00
|
|
|
#include <projectexplorer/profileinformation.h>
|
2011-05-04 13:14:46 +02:00
|
|
|
#include <projectexplorer/projectexplorer.h>
|
|
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
|
|
|
|
#include <projectexplorer/toolchainmanager.h>
|
2012-05-16 16:24:16 +02:00
|
|
|
#include <qtsupport/debugginghelper.h>
|
2012-01-18 13:50:14 +01:00
|
|
|
#include <qtsupport/qtsupportconstants.h>
|
2011-05-04 13:14:46 +02:00
|
|
|
|
2011-08-16 10:45:23 +02:00
|
|
|
#include <utils/persistentsettings.h>
|
2011-08-17 11:34:57 +02:00
|
|
|
#include <utils/environment.h>
|
2011-05-04 13:14:46 +02:00
|
|
|
#include <utils/synchronousprocess.h>
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QDir>
|
2012-05-29 13:44:28 +02:00
|
|
|
#include <QUrl>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QFileInfo>
|
|
|
|
|
#include <QCoreApplication>
|
|
|
|
|
#include <QProcess>
|
2011-05-04 13:14:46 +02:00
|
|
|
|
2011-05-20 21:40:53 +02:00
|
|
|
using namespace QtSupport;
|
|
|
|
|
using namespace QtSupport::Internal;
|
2011-05-04 13:14:46 +02:00
|
|
|
|
|
|
|
|
static const char QTVERSIONID[] = "Id";
|
|
|
|
|
static const char QTVERSIONNAME[] = "Name";
|
|
|
|
|
static const char QTVERSIONAUTODETECTED[] = "isAutodetected";
|
|
|
|
|
static const char QTVERSIONAUTODETECTIONSOURCE []= "autodetectionSource";
|
|
|
|
|
static const char QTVERSIONQMAKEPATH[] = "QMakePath";
|
|
|
|
|
|
|
|
|
|
///////////////
|
|
|
|
|
// QtVersionNumber
|
|
|
|
|
///////////////
|
|
|
|
|
QtVersionNumber::QtVersionNumber(int ma, int mi, int p)
|
|
|
|
|
: majorVersion(ma), minorVersion(mi), patchVersion(p)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QtVersionNumber::QtVersionNumber(const QString &versionString)
|
|
|
|
|
{
|
|
|
|
|
if (!checkVersionString(versionString)) {
|
|
|
|
|
majorVersion = minorVersion = patchVersion = -1;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QStringList parts = versionString.split(QLatin1Char('.'));
|
|
|
|
|
majorVersion = parts.at(0).toInt();
|
|
|
|
|
minorVersion = parts.at(1).toInt();
|
|
|
|
|
patchVersion = parts.at(2).toInt();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QtVersionNumber::QtVersionNumber()
|
|
|
|
|
{
|
|
|
|
|
majorVersion = minorVersion = patchVersion = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool QtVersionNumber::checkVersionString(const QString &version) const
|
|
|
|
|
{
|
|
|
|
|
int dots = 0;
|
2012-01-06 17:43:27 +01:00
|
|
|
const QString validChars = QLatin1String("0123456789.");
|
2011-05-04 13:14:46 +02:00
|
|
|
foreach (const QChar &c, version) {
|
|
|
|
|
if (!validChars.contains(c))
|
|
|
|
|
return false;
|
2012-01-06 17:43:27 +01:00
|
|
|
if (c == QLatin1Char('.'))
|
2011-05-04 13:14:46 +02:00
|
|
|
++dots;
|
|
|
|
|
}
|
|
|
|
|
if (dots != 2)
|
|
|
|
|
return false;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool QtVersionNumber::operator <(const QtVersionNumber &b) const
|
|
|
|
|
{
|
|
|
|
|
if (majorVersion < b.majorVersion)
|
|
|
|
|
return true;
|
|
|
|
|
if (majorVersion > b.majorVersion)
|
|
|
|
|
return false;
|
|
|
|
|
if (minorVersion < b.minorVersion)
|
|
|
|
|
return true;
|
|
|
|
|
if (minorVersion > b.minorVersion)
|
|
|
|
|
return false;
|
|
|
|
|
if (patchVersion < b.patchVersion)
|
|
|
|
|
return true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool QtVersionNumber::operator >(const QtVersionNumber &b) const
|
|
|
|
|
{
|
|
|
|
|
return b < *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool QtVersionNumber::operator ==(const QtVersionNumber &b) const
|
|
|
|
|
{
|
|
|
|
|
return majorVersion == b.majorVersion
|
|
|
|
|
&& minorVersion == b.minorVersion
|
|
|
|
|
&& patchVersion == b.patchVersion;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool QtVersionNumber::operator !=(const QtVersionNumber &b) const
|
|
|
|
|
{
|
|
|
|
|
return !(*this == b);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool QtVersionNumber::operator <=(const QtVersionNumber &b) const
|
|
|
|
|
{
|
|
|
|
|
return !(*this > b);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool QtVersionNumber::operator >=(const QtVersionNumber &b) const
|
|
|
|
|
{
|
|
|
|
|
return b <= *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////
|
|
|
|
|
// QtConfigWidget
|
|
|
|
|
///////////////
|
|
|
|
|
QtConfigWidget::QtConfigWidget()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////
|
|
|
|
|
// BaseQtVersion
|
|
|
|
|
///////////////
|
|
|
|
|
int BaseQtVersion::getUniqueId()
|
|
|
|
|
{
|
|
|
|
|
return QtVersionManager::instance()->getUniqueId();
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-25 13:19:58 +01:00
|
|
|
BaseQtVersion::BaseQtVersion(const Utils::FileName &qmakeCommand, bool isAutodetected, const QString &autodetectionSource)
|
2011-05-04 13:14:46 +02:00
|
|
|
: m_id(getUniqueId()),
|
|
|
|
|
m_isAutodetected(isAutodetected),
|
|
|
|
|
m_autodetectionSource(autodetectionSource),
|
|
|
|
|
m_hasDebuggingHelper(false),
|
|
|
|
|
m_hasQmlDump(false),
|
|
|
|
|
m_hasQmlDebuggingLibrary(false),
|
|
|
|
|
m_hasQmlObserver(false),
|
|
|
|
|
m_mkspecUpToDate(false),
|
|
|
|
|
m_mkspecReadUpToDate(false),
|
|
|
|
|
m_defaultConfigIsDebug(true),
|
|
|
|
|
m_defaultConfigIsDebugAndRelease(true),
|
|
|
|
|
m_versionInfoUpToDate(false),
|
2011-09-23 17:29:45 +02:00
|
|
|
m_installed(true),
|
2011-05-04 13:14:46 +02:00
|
|
|
m_hasExamples(false),
|
|
|
|
|
m_hasDemos(false),
|
|
|
|
|
m_hasDocumentation(false),
|
2011-07-14 13:35:40 +02:00
|
|
|
m_qmakeIsExecutable(true)
|
2011-05-04 13:14:46 +02:00
|
|
|
{
|
|
|
|
|
ctor(qmakeCommand);
|
2011-05-20 15:52:58 +02:00
|
|
|
setDisplayName(defaultDisplayName(qtVersionString(), qmakeCommand, false));
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BaseQtVersion::BaseQtVersion()
|
|
|
|
|
: m_id(-1), m_isAutodetected(false),
|
|
|
|
|
m_hasDebuggingHelper(false),
|
|
|
|
|
m_hasQmlDump(false),
|
|
|
|
|
m_hasQmlDebuggingLibrary(false),
|
|
|
|
|
m_hasQmlObserver(false),
|
|
|
|
|
m_mkspecUpToDate(false),
|
|
|
|
|
m_mkspecReadUpToDate(false),
|
|
|
|
|
m_defaultConfigIsDebug(true),
|
|
|
|
|
m_defaultConfigIsDebugAndRelease(true),
|
|
|
|
|
m_versionInfoUpToDate(false),
|
2011-09-23 17:29:45 +02:00
|
|
|
m_installed(true),
|
2011-05-04 13:14:46 +02:00
|
|
|
m_hasExamples(false),
|
|
|
|
|
m_hasDemos(false),
|
2011-07-14 13:35:40 +02:00
|
|
|
m_hasDocumentation(false),
|
|
|
|
|
m_qmakeIsExecutable(true)
|
2011-05-04 13:14:46 +02:00
|
|
|
{
|
2011-11-25 13:19:58 +01:00
|
|
|
ctor(Utils::FileName());
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
2011-11-25 13:19:58 +01:00
|
|
|
void BaseQtVersion::ctor(const Utils::FileName &qmakePath)
|
2011-05-04 13:14:46 +02:00
|
|
|
{
|
2011-11-25 13:19:58 +01:00
|
|
|
m_qmakeCommand = qmakePath;
|
2011-05-04 13:14:46 +02:00
|
|
|
m_designerCommand.clear();
|
|
|
|
|
m_linguistCommand.clear();
|
|
|
|
|
m_qmlviewerCommand.clear();
|
|
|
|
|
m_uicCommand.clear();
|
|
|
|
|
m_mkspecUpToDate = false;
|
|
|
|
|
m_mkspecReadUpToDate = false;
|
|
|
|
|
m_versionInfoUpToDate = false;
|
|
|
|
|
m_qtVersionString.clear();
|
|
|
|
|
m_sourcePath.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BaseQtVersion::~BaseQtVersion()
|
|
|
|
|
{
|
2011-05-20 15:52:58 +02:00
|
|
|
}
|
|
|
|
|
|
2011-11-25 13:19:58 +01:00
|
|
|
QString BaseQtVersion::defaultDisplayName(const QString &versionString, const Utils::FileName &qmakePath,
|
2011-05-20 15:52:58 +02:00
|
|
|
bool fromPath)
|
|
|
|
|
{
|
|
|
|
|
QString location;
|
|
|
|
|
if (qmakePath.isEmpty()) {
|
|
|
|
|
location = QCoreApplication::translate("QtVersion", "<unknown>");
|
|
|
|
|
} else {
|
|
|
|
|
// Deduce a description from '/foo/qt-folder/[qtbase]/bin/qmake' -> '/foo/qt-folder'.
|
|
|
|
|
// '/usr' indicates System Qt 4.X on Linux.
|
2011-11-25 13:19:58 +01:00
|
|
|
QDir dir = qmakePath.toFileInfo().absoluteDir();
|
2011-05-20 15:52:58 +02:00
|
|
|
do {
|
|
|
|
|
const QString dirName = dir.dirName();
|
|
|
|
|
if (dirName == QLatin1String("usr")) { // System-installed Qt.
|
|
|
|
|
location = QCoreApplication::translate("QtVersion", "System");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (dirName.compare(QLatin1String("bin"), Qt::CaseInsensitive)
|
|
|
|
|
&& dirName.compare(QLatin1String("qtbase"), Qt::CaseInsensitive)) {
|
|
|
|
|
location = dirName;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} while (dir.cdUp());
|
|
|
|
|
}
|
2011-05-04 13:14:46 +02:00
|
|
|
|
2011-05-20 15:52:58 +02:00
|
|
|
return fromPath ?
|
|
|
|
|
QCoreApplication::translate("QtVersion", "Qt %1 in PATH (%2)").arg(versionString, location) :
|
|
|
|
|
QCoreApplication::translate("QtVersion", "Qt %1 (%2)").arg(versionString, location);
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
2012-01-18 13:50:14 +01:00
|
|
|
Core::FeatureSet BaseQtVersion::availableFeatures() const
|
|
|
|
|
{
|
2012-02-14 13:50:38 +01:00
|
|
|
Core::FeatureSet features = Core::FeatureSet(QtSupport::Constants::FEATURE_QWIDGETS)
|
2012-01-18 13:50:14 +01:00
|
|
|
| Core::FeatureSet(QtSupport::Constants::FEATURE_QT)
|
|
|
|
|
| Core::FeatureSet(QtSupport::Constants::FEATURE_QT_WEBKIT)
|
|
|
|
|
| Core::FeatureSet(QtSupport::Constants::FEATURE_QT_CONSOLE);
|
|
|
|
|
|
2012-02-08 16:04:39 +01:00
|
|
|
if (qtVersion() >= QtSupport::QtVersionNumber(4, 7, 0)) {
|
2012-01-18 13:50:14 +01:00
|
|
|
features |= Core::FeatureSet(QtSupport::Constants::FEATURE_QT_QUICK);
|
2012-02-08 16:04:39 +01:00
|
|
|
features |= Core::FeatureSet(QtSupport::Constants::FEATURE_QT_QUICK_1);
|
|
|
|
|
}
|
|
|
|
|
if (qtVersion() >= QtSupport::QtVersionNumber(4, 7, 1)) {
|
|
|
|
|
features |= Core::FeatureSet(QtSupport::Constants::FEATURE_QT_QUICK_1_1);
|
|
|
|
|
}
|
|
|
|
|
if (qtVersion() >= QtSupport::QtVersionNumber(5, 0, 0)) {
|
|
|
|
|
features |= Core::FeatureSet(QtSupport::Constants::FEATURE_QT_QUICK_2);
|
|
|
|
|
}
|
2012-01-18 13:50:14 +01:00
|
|
|
|
|
|
|
|
return features;
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-08 17:25:35 +01:00
|
|
|
QString BaseQtVersion::platformName() const
|
|
|
|
|
{
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BaseQtVersion::platformDisplayName() const
|
|
|
|
|
{
|
|
|
|
|
return platformName();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool BaseQtVersion::supportsPlatform(const QString &platform) const
|
|
|
|
|
{
|
|
|
|
|
if (platform.isEmpty()) // empty target == target independent
|
|
|
|
|
return true;
|
|
|
|
|
return platform == platformName();
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
QList<ProjectExplorer::Task> BaseQtVersion::validateProfile(const ProjectExplorer::Profile *p)
|
|
|
|
|
{
|
|
|
|
|
QList<ProjectExplorer::Task> result;
|
|
|
|
|
|
|
|
|
|
BaseQtVersion *version = QtProfileInformation::qtVersion(p);
|
|
|
|
|
Q_ASSERT(version == this);
|
|
|
|
|
|
|
|
|
|
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(p);
|
|
|
|
|
if (!tc)
|
|
|
|
|
result << ProjectExplorer::Task(ProjectExplorer::Task::Error,
|
|
|
|
|
QCoreApplication::translate("BaseQtVersion", "No tool chain set up in profile."),
|
|
|
|
|
Utils::FileName(), -1,
|
|
|
|
|
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
|
|
|
|
|
|
|
|
|
if (tc && !version->qtAbis().contains(tc->targetAbi()))
|
|
|
|
|
result << ProjectExplorer::Task(ProjectExplorer::Task::Error,
|
|
|
|
|
QCoreApplication::translate("BaseQtVersion", "Tool chain can not produce code for the Qt version."),
|
|
|
|
|
Utils::FileName(), -1,
|
|
|
|
|
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-04 13:14:46 +02:00
|
|
|
void BaseQtVersion::setId(int id)
|
|
|
|
|
{
|
|
|
|
|
m_id = id;
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-20 21:40:53 +02:00
|
|
|
void BaseQtVersion::restoreLegacySettings(QSettings *s)
|
|
|
|
|
{
|
|
|
|
|
Q_UNUSED(s);
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-04 13:14:46 +02:00
|
|
|
void BaseQtVersion::fromMap(const QVariantMap &map)
|
|
|
|
|
{
|
|
|
|
|
m_id = map.value(QLatin1String(QTVERSIONID)).toInt();
|
|
|
|
|
if (m_id == -1) // this happens on adding from installer, see updateFromInstaller => get a new unique id
|
|
|
|
|
m_id = QtVersionManager::instance()->getUniqueId();
|
|
|
|
|
m_displayName = map.value(QLatin1String(QTVERSIONNAME)).toString();
|
|
|
|
|
m_isAutodetected = map.value(QLatin1String(QTVERSIONAUTODETECTED)).toBool();
|
|
|
|
|
if (m_isAutodetected)
|
|
|
|
|
m_autodetectionSource = map.value(QLatin1String(QTVERSIONAUTODETECTIONSOURCE)).toString();
|
2011-11-25 13:19:58 +01:00
|
|
|
QString string = map.value(QLatin1String(QTVERSIONQMAKEPATH)).toString();
|
2012-01-06 17:43:27 +01:00
|
|
|
if (string.startsWith(QLatin1Char('~')))
|
2011-11-25 13:19:58 +01:00
|
|
|
string.remove(0, 1).prepend(QDir::homePath());
|
|
|
|
|
ctor(Utils::FileName::fromUserInput(string));
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap BaseQtVersion::toMap() const
|
|
|
|
|
{
|
|
|
|
|
QVariantMap result;
|
|
|
|
|
result.insert(QLatin1String(QTVERSIONID), uniqueId());
|
|
|
|
|
result.insert(QLatin1String(QTVERSIONNAME), displayName());
|
|
|
|
|
result.insert(QLatin1String(QTVERSIONAUTODETECTED), isAutodetected());
|
|
|
|
|
if (isAutodetected())
|
|
|
|
|
result.insert(QLatin1String(QTVERSIONAUTODETECTIONSOURCE), autodetectionSource());
|
2011-11-25 13:19:58 +01:00
|
|
|
result.insert(QLatin1String(QTVERSIONQMAKEPATH), qmakeCommand().toString());
|
2011-05-04 13:14:46 +02:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool BaseQtVersion::isValid() const
|
|
|
|
|
{
|
2011-05-12 12:25:25 +02:00
|
|
|
if (uniqueId() == -1 || displayName().isEmpty())
|
2011-05-04 13:14:46 +02:00
|
|
|
return false;
|
|
|
|
|
updateVersionInfo();
|
|
|
|
|
updateMkspec();
|
|
|
|
|
|
|
|
|
|
return !qmakeCommand().isEmpty()
|
2011-09-23 17:29:45 +02:00
|
|
|
&& m_installed
|
2012-01-06 17:43:27 +01:00
|
|
|
&& m_versionInfo.contains(QLatin1String("QT_INSTALL_BINS"))
|
2011-09-06 15:19:05 +00:00
|
|
|
&& !m_mkspecFullPath.isEmpty()
|
2011-05-04 13:14:46 +02:00
|
|
|
&& m_qmakeIsExecutable;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BaseQtVersion::invalidReason() const
|
|
|
|
|
{
|
|
|
|
|
if (displayName().isEmpty())
|
|
|
|
|
return QCoreApplication::translate("QtVersion", "Qt version has no name");
|
|
|
|
|
if (qmakeCommand().isEmpty())
|
|
|
|
|
return QCoreApplication::translate("QtVersion", "No qmake path set");
|
|
|
|
|
if (!m_qmakeIsExecutable)
|
|
|
|
|
return QCoreApplication::translate("QtVersion", "qmake does not exist or is not executable");
|
2011-09-23 17:29:45 +02:00
|
|
|
if (!m_installed)
|
2011-05-04 13:14:46 +02:00
|
|
|
return QCoreApplication::translate("QtVersion", "Qt version is not properly installed, please run make install");
|
2012-01-06 17:43:27 +01:00
|
|
|
if (!m_versionInfo.contains(QLatin1String("QT_INSTALL_BINS")))
|
2011-05-04 13:14:46 +02:00
|
|
|
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())
|
|
|
|
|
return QCoreApplication::translate("QtVersion", "The default mkspec symlink is broken.");
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-19 17:54:24 +02:00
|
|
|
QString BaseQtVersion::warningReason() const
|
|
|
|
|
{
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
ProjectExplorer::ToolChain *BaseQtVersion::preferredToolChain(const Utils::FileName &ms) const
|
2011-05-04 13:14:46 +02:00
|
|
|
{
|
2012-04-24 15:49:09 +02:00
|
|
|
const Utils::FileName spec = ms.isEmpty() ? mkspec() : ms;
|
|
|
|
|
QList<ProjectExplorer::ToolChain *> tcList = ProjectExplorer::ToolChainManager::instance()->toolChains();
|
|
|
|
|
ProjectExplorer::ToolChain *possibleTc = 0;
|
|
|
|
|
foreach (ProjectExplorer::ToolChain *tc, tcList) {
|
|
|
|
|
if (!qtAbis().contains(tc->targetAbi()))
|
|
|
|
|
continue;
|
|
|
|
|
if (tc->suggestedMkspecList().contains(spec))
|
|
|
|
|
return tc; // perfect match
|
|
|
|
|
possibleTc = tc; // possible match
|
|
|
|
|
}
|
|
|
|
|
return possibleTc;
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
Utils::FileName BaseQtVersion::qmakeCommand() const
|
2011-05-04 13:14:46 +02:00
|
|
|
{
|
2012-04-24 15:49:09 +02:00
|
|
|
return m_qmakeCommand;
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
2011-09-06 15:19:05 +00:00
|
|
|
QList<ProjectExplorer::Abi> BaseQtVersion::qtAbis() const
|
|
|
|
|
{
|
|
|
|
|
if (m_qtAbis.isEmpty())
|
|
|
|
|
m_qtAbis = detectQtAbis();
|
|
|
|
|
if (m_qtAbis.isEmpty())
|
|
|
|
|
m_qtAbis.append(ProjectExplorer::Abi()); // add empty ABI by default: This is compatible with all TCs.
|
|
|
|
|
return m_qtAbis;
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-04 13:14:46 +02:00
|
|
|
bool BaseQtVersion::equals(BaseQtVersion *other)
|
|
|
|
|
{
|
|
|
|
|
if (type() != other->type())
|
|
|
|
|
return false;
|
|
|
|
|
if (uniqueId() != other->uniqueId())
|
|
|
|
|
return false;
|
|
|
|
|
if (displayName() != other->displayName())
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int BaseQtVersion::uniqueId() const
|
|
|
|
|
{
|
|
|
|
|
return m_id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool BaseQtVersion::isAutodetected() const
|
|
|
|
|
{
|
|
|
|
|
return m_isAutodetected;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BaseQtVersion::autodetectionSource() const
|
|
|
|
|
{
|
|
|
|
|
return m_autodetectionSource;
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-12 11:53:58 +02:00
|
|
|
void BaseQtVersion::setAutoDetectionSource(const QString &autodetectionSource)
|
|
|
|
|
{
|
|
|
|
|
m_autodetectionSource = autodetectionSource;
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-04 13:14:46 +02:00
|
|
|
QString BaseQtVersion::displayName() const
|
|
|
|
|
{
|
|
|
|
|
return m_displayName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BaseQtVersion::setDisplayName(const QString &name)
|
|
|
|
|
{
|
|
|
|
|
m_displayName = name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BaseQtVersion::toHtml(bool verbose) const
|
|
|
|
|
{
|
|
|
|
|
QString rc;
|
|
|
|
|
QTextStream str(&rc);
|
|
|
|
|
str << "<html><body><table>";
|
|
|
|
|
str << "<tr><td><b>" << QCoreApplication::translate("BaseQtVersion", "Name:")
|
|
|
|
|
<< "</b></td><td>" << displayName() << "</td></tr>";
|
|
|
|
|
if (!isValid()) {
|
2012-01-06 17:43:27 +01:00
|
|
|
str << "<tr><td colspan=2><b>"
|
|
|
|
|
<< QCoreApplication::translate("BaseQtVersion", "Invalid Qt version")
|
|
|
|
|
<< "</b></td></tr>";
|
2011-05-04 13:14:46 +02:00
|
|
|
} else {
|
2012-01-06 17:43:27 +01:00
|
|
|
str << "<tr><td><b>" << QCoreApplication::translate("BaseQtVersion", "ABI:")
|
|
|
|
|
<< "</b></td>";
|
|
|
|
|
const QList<ProjectExplorer::Abi> abis = qtAbis();
|
|
|
|
|
for (int i = 0; i < abis.size(); ++i) {
|
|
|
|
|
if (i)
|
|
|
|
|
str << "<tr><td></td>";
|
|
|
|
|
str << "<td>" << abis.at(i).toString() << "</td></tr>";
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
str << "<tr><td><b>" << QCoreApplication::translate("BaseQtVersion", "Source:")
|
2011-11-25 13:19:58 +01:00
|
|
|
<< "</b></td><td>" << sourcePath().toUserOutput() << "</td></tr>";
|
2011-05-04 13:14:46 +02:00
|
|
|
str << "<tr><td><b>" << QCoreApplication::translate("BaseQtVersion", "mkspec:")
|
2011-11-25 13:19:58 +01:00
|
|
|
<< "</b></td><td>" << mkspec().toUserOutput() << "</td></tr>";
|
2011-05-04 13:14:46 +02:00
|
|
|
str << "<tr><td><b>" << QCoreApplication::translate("BaseQtVersion", "qmake:")
|
2011-11-25 13:19:58 +01:00
|
|
|
<< "</b></td><td>" << m_qmakeCommand.toUserOutput() << "</td></tr>";
|
2011-05-04 13:14:46 +02:00
|
|
|
ensureMkSpecParsed();
|
|
|
|
|
if (!mkspecPath().isEmpty()) {
|
|
|
|
|
if (m_defaultConfigIsDebug || m_defaultConfigIsDebugAndRelease) {
|
|
|
|
|
str << "<tr><td><b>" << QCoreApplication::translate("BaseQtVersion", "Default:") << "</b></td><td>"
|
|
|
|
|
<< (m_defaultConfigIsDebug ? "debug" : "release");
|
|
|
|
|
if (m_defaultConfigIsDebugAndRelease)
|
|
|
|
|
str << " debug_and_release";
|
|
|
|
|
str << "</td></tr>";
|
|
|
|
|
} // default config.
|
|
|
|
|
}
|
|
|
|
|
str << "<tr><td><b>" << QCoreApplication::translate("BaseQtVersion", "Version:")
|
|
|
|
|
<< "</b></td><td>" << qtVersionString() << "</td></tr>";
|
|
|
|
|
if (verbose) {
|
|
|
|
|
const QHash<QString,QString> vInfo = versionInfo();
|
|
|
|
|
if (!vInfo.isEmpty()) {
|
|
|
|
|
const QHash<QString,QString>::const_iterator vcend = vInfo.constEnd();
|
2012-05-29 13:44:28 +02:00
|
|
|
for (QHash<QString,QString>::const_iterator it = vInfo.constBegin(); it != vcend; ++it) {
|
|
|
|
|
const QString &variableName = it.key();
|
|
|
|
|
const QString &value = it.value();
|
|
|
|
|
if (!variableName.endsWith(QLatin1String("/raw")) && !variableName.endsWith(QLatin1String("/get"))) {
|
|
|
|
|
const bool isPath = !value.isEmpty() &&
|
|
|
|
|
(variableName == QLatin1String("QMAKE_MKSPECS")
|
|
|
|
|
|| variableName.contains(QLatin1String("HOST"))
|
|
|
|
|
|| variableName.contains(QLatin1String("INSTALL")));
|
|
|
|
|
str << "<tr><td><pre>" << variableName << "</pre></td><td>";
|
|
|
|
|
if (isPath) {
|
|
|
|
|
str << "<a href=\"" << QUrl::fromLocalFile(value).toString()
|
|
|
|
|
<< "\">" << QDir::toNativeSeparators(value) << "</a>";
|
|
|
|
|
} else {
|
|
|
|
|
str << it.value() ;
|
|
|
|
|
}
|
|
|
|
|
str << "</td></tr>";
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
str << "</table></body></html>";
|
|
|
|
|
return rc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BaseQtVersion::updateSourcePath() const
|
|
|
|
|
{
|
|
|
|
|
if (!m_sourcePath.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
updateVersionInfo();
|
2012-01-06 17:43:27 +01:00
|
|
|
const QString installData = m_versionInfo.value(QLatin1String("QT_INSTALL_DATA"));
|
2011-11-25 13:19:58 +01:00
|
|
|
QString sourcePath = installData;
|
2011-05-04 13:14:46 +02:00
|
|
|
QFile qmakeCache(installData + QLatin1String("/.qmake.cache"));
|
|
|
|
|
if (qmakeCache.exists()) {
|
|
|
|
|
qmakeCache.open(QIODevice::ReadOnly | QIODevice::Text);
|
|
|
|
|
QTextStream stream(&qmakeCache);
|
|
|
|
|
while (!stream.atEnd()) {
|
|
|
|
|
QString line = stream.readLine().trimmed();
|
|
|
|
|
if (line.startsWith(QLatin1String("QT_SOURCE_TREE"))) {
|
2011-11-25 13:19:58 +01:00
|
|
|
sourcePath = line.split(QLatin1Char('=')).at(1).trimmed();
|
|
|
|
|
if (sourcePath.startsWith(QLatin1String("$$quote("))) {
|
|
|
|
|
sourcePath.remove(0, 8);
|
|
|
|
|
sourcePath.chop(1);
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-11-25 13:19:58 +01:00
|
|
|
m_sourcePath = Utils::FileName::fromUserInput(sourcePath);
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
2011-11-25 13:19:58 +01:00
|
|
|
Utils::FileName BaseQtVersion::sourcePath() const
|
2011-05-04 13:14:46 +02:00
|
|
|
{
|
|
|
|
|
updateSourcePath();
|
|
|
|
|
return m_sourcePath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BaseQtVersion::designerCommand() const
|
|
|
|
|
{
|
|
|
|
|
if (!isValid())
|
|
|
|
|
return QString();
|
|
|
|
|
if (m_designerCommand.isNull())
|
2011-08-25 19:01:15 +02:00
|
|
|
m_designerCommand = findQtBinary(Designer);
|
2011-05-04 13:14:46 +02:00
|
|
|
return m_designerCommand;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BaseQtVersion::linguistCommand() const
|
|
|
|
|
{
|
|
|
|
|
if (!isValid())
|
|
|
|
|
return QString();
|
|
|
|
|
if (m_linguistCommand.isNull())
|
2011-08-25 19:01:15 +02:00
|
|
|
m_linguistCommand = findQtBinary(Linguist);
|
2011-05-04 13:14:46 +02:00
|
|
|
return m_linguistCommand;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BaseQtVersion::qmlviewerCommand() const
|
|
|
|
|
{
|
|
|
|
|
if (!isValid())
|
|
|
|
|
return QString();
|
|
|
|
|
|
2011-08-25 19:01:15 +02:00
|
|
|
if (m_qmlviewerCommand.isNull())
|
|
|
|
|
m_qmlviewerCommand = findQtBinary(QmlViewer);
|
2011-05-04 13:14:46 +02:00
|
|
|
return m_qmlviewerCommand;
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-08 17:42:22 +01:00
|
|
|
QString BaseQtVersion::findQtBinary(Binaries binary) const
|
2011-05-04 13:14:46 +02:00
|
|
|
{
|
2011-08-25 19:01:15 +02:00
|
|
|
QString baseDir;
|
|
|
|
|
if (qtVersion() < QtVersionNumber(5, 0, 0)) {
|
|
|
|
|
baseDir = versionInfo().value(QLatin1String("QT_INSTALL_BINS"));
|
|
|
|
|
} else {
|
|
|
|
|
ensureMkSpecParsed();
|
|
|
|
|
switch (binary) {
|
|
|
|
|
case QmlViewer:
|
2012-03-07 10:34:17 +01:00
|
|
|
baseDir = m_mkspecValues.value(QLatin1String("QT.qml.bins"));
|
2011-08-25 19:01:15 +02:00
|
|
|
break;
|
|
|
|
|
case Designer:
|
|
|
|
|
case Linguist:
|
2012-01-06 17:43:27 +01:00
|
|
|
baseDir = m_mkspecValues.value(QLatin1String("QT.designer.bins"));
|
2011-08-25 19:01:15 +02:00
|
|
|
break;
|
|
|
|
|
case Uic:
|
|
|
|
|
baseDir = versionInfo().value(QLatin1String("QT_INSTALL_BINS"));
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
// Can't happen
|
|
|
|
|
Q_ASSERT(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (baseDir.isEmpty())
|
2011-05-04 13:14:46 +02:00
|
|
|
return QString();
|
2012-01-06 17:43:27 +01:00
|
|
|
if (!baseDir.endsWith(QLatin1Char('/')))
|
2011-08-25 19:01:15 +02:00
|
|
|
baseDir += QLatin1Char('/');
|
2011-05-04 13:14:46 +02:00
|
|
|
|
2011-08-25 19:01:15 +02:00
|
|
|
QStringList possibleCommands;
|
|
|
|
|
switch (binary) {
|
2011-09-15 14:45:17 +02:00
|
|
|
case QmlViewer: {
|
|
|
|
|
if (qtVersion() < QtVersionNumber(5, 0, 0)) {
|
2011-12-19 11:30:17 +01:00
|
|
|
#if defined(Q_OS_WIN)
|
|
|
|
|
possibleCommands << QLatin1String("qmlviewer.exe");
|
|
|
|
|
#elif defined(Q_OS_MAC)
|
|
|
|
|
possibleCommands << QLatin1String("QMLViewer.app/Contents/MacOS/QMLViewer");
|
|
|
|
|
#else
|
|
|
|
|
possibleCommands << QLatin1String("qmlviewer");
|
|
|
|
|
#endif
|
2011-09-15 14:45:17 +02:00
|
|
|
} else {
|
|
|
|
|
#if defined(Q_OS_WIN)
|
|
|
|
|
possibleCommands << QLatin1String("qmlscene.exe");
|
2011-08-25 19:01:15 +02:00
|
|
|
#else
|
2011-09-15 14:45:17 +02:00
|
|
|
possibleCommands << QLatin1String("qmlscene");
|
2011-08-25 19:01:15 +02:00
|
|
|
#endif
|
2011-09-15 14:45:17 +02:00
|
|
|
}
|
|
|
|
|
}
|
2011-08-25 19:01:15 +02:00
|
|
|
break;
|
|
|
|
|
case Designer:
|
2011-12-19 11:30:17 +01:00
|
|
|
#if defined(Q_OS_WIN)
|
|
|
|
|
possibleCommands << QLatin1String("designer.exe");
|
|
|
|
|
#elif defined(Q_OS_MAC)
|
|
|
|
|
possibleCommands << QLatin1String("Designer.app/Contents/MacOS/Designer");
|
|
|
|
|
#else
|
|
|
|
|
possibleCommands << QLatin1String("designer");
|
|
|
|
|
#endif
|
2011-08-25 19:01:15 +02:00
|
|
|
break;
|
|
|
|
|
case Linguist:
|
2011-12-19 11:30:17 +01:00
|
|
|
#if defined(Q_OS_WIN)
|
|
|
|
|
possibleCommands << QLatin1String("linguist.exe");
|
|
|
|
|
#elif defined(Q_OS_MAC)
|
|
|
|
|
possibleCommands << QLatin1String("Linguist.app/Contents/MacOS/Linguist");
|
|
|
|
|
#else
|
|
|
|
|
possibleCommands << QLatin1String("linguist");
|
|
|
|
|
#endif
|
2011-08-25 19:01:15 +02:00
|
|
|
break;
|
|
|
|
|
case Uic:
|
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
|
possibleCommands << QLatin1String("uic.exe");
|
|
|
|
|
#else
|
|
|
|
|
possibleCommands << QLatin1String("uic-qt4") << QLatin1String("uic4") << QLatin1String("uic");
|
|
|
|
|
#endif
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
Q_ASSERT(false);
|
|
|
|
|
}
|
2011-05-04 13:14:46 +02:00
|
|
|
foreach (const QString &possibleCommand, possibleCommands) {
|
2011-08-25 19:01:15 +02:00
|
|
|
const QString fullPath = baseDir + possibleCommand;
|
2011-05-04 13:14:46 +02:00
|
|
|
if (QFileInfo(fullPath).isFile())
|
|
|
|
|
return QDir::cleanPath(fullPath);
|
|
|
|
|
}
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BaseQtVersion::uicCommand() const
|
|
|
|
|
{
|
|
|
|
|
if (!isValid())
|
|
|
|
|
return QString();
|
|
|
|
|
if (!m_uicCommand.isNull())
|
|
|
|
|
return m_uicCommand;
|
2011-08-25 19:01:15 +02:00
|
|
|
m_uicCommand = findQtBinary(Uic);
|
2011-05-04 13:14:46 +02:00
|
|
|
return m_uicCommand;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BaseQtVersion::updateMkspec() const
|
|
|
|
|
{
|
|
|
|
|
if (uniqueId() == -1 || m_mkspecUpToDate)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
m_mkspecUpToDate = true;
|
|
|
|
|
m_mkspecFullPath = mkspecFromVersionInfo(versionInfo());
|
|
|
|
|
|
|
|
|
|
m_mkspec = m_mkspecFullPath;
|
|
|
|
|
if (m_mkspecFullPath.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
|
2012-06-12 21:55:22 +09:00
|
|
|
Utils::FileName baseMkspecDir = mkspecDirectoryFromVersionInfo(versionInfo());
|
2011-05-04 13:14:46 +02:00
|
|
|
|
2011-11-25 13:19:58 +01:00
|
|
|
if (m_mkspec.isChildOf(baseMkspecDir)) {
|
|
|
|
|
m_mkspec = m_mkspec.relativeChildPath(baseMkspecDir);
|
2011-05-04 13:14:46 +02:00
|
|
|
// qDebug() << "Setting mkspec to"<<mkspec;
|
|
|
|
|
} else {
|
2012-01-06 17:43:27 +01:00
|
|
|
Utils::FileName sourceMkSpecPath = sourcePath().appendPath(QLatin1String("mkspecs"));
|
2011-11-25 13:19:58 +01:00
|
|
|
if (m_mkspec.isChildOf(sourceMkSpecPath)) {
|
|
|
|
|
m_mkspec = m_mkspec.relativeChildPath(sourceMkSpecPath);
|
2011-05-04 13:14:46 +02:00
|
|
|
} else {
|
|
|
|
|
// Do nothing
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BaseQtVersion::ensureMkSpecParsed() const
|
|
|
|
|
{
|
|
|
|
|
if (m_mkspecReadUpToDate)
|
|
|
|
|
return;
|
|
|
|
|
m_mkspecReadUpToDate = true;
|
|
|
|
|
|
|
|
|
|
if (mkspecPath().isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
|
2012-05-02 15:20:08 +02:00
|
|
|
QMakeGlobals option;
|
2011-05-04 13:14:46 +02:00
|
|
|
option.properties = versionInfo();
|
|
|
|
|
ProMessageHandler msgHandler(true);
|
|
|
|
|
ProFileCacheManager::instance()->incRefCount();
|
|
|
|
|
ProFileParser parser(ProFileCacheManager::instance()->cache(), &msgHandler);
|
|
|
|
|
ProFileEvaluator evaluator(&option, &parser, &msgHandler);
|
2012-01-06 17:43:27 +01:00
|
|
|
if (ProFile *pro = parser.parsedProFile(mkspecPath().toString() + QLatin1String("/qmake.conf"))) {
|
2011-05-04 13:14:46 +02:00
|
|
|
evaluator.setCumulative(false);
|
|
|
|
|
evaluator.accept(pro, ProFileEvaluator::LoadProOnly);
|
|
|
|
|
pro->deref();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
parseMkSpec(&evaluator);
|
|
|
|
|
|
|
|
|
|
ProFileCacheManager::instance()->decRefCount();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BaseQtVersion::parseMkSpec(ProFileEvaluator *evaluator) const
|
|
|
|
|
{
|
2012-01-06 17:43:27 +01:00
|
|
|
QStringList configValues = evaluator->values(QLatin1String("CONFIG"));
|
2011-05-04 13:14:46 +02:00
|
|
|
m_defaultConfigIsDebugAndRelease = false;
|
2011-05-12 12:25:25 +02:00
|
|
|
foreach (const QString &value, configValues) {
|
2012-01-06 17:43:27 +01:00
|
|
|
if (value == QLatin1String("debug"))
|
2011-05-04 13:14:46 +02:00
|
|
|
m_defaultConfigIsDebug = true;
|
2012-01-06 17:43:27 +01:00
|
|
|
else if (value == QLatin1String("release"))
|
2011-05-04 13:14:46 +02:00
|
|
|
m_defaultConfigIsDebug = false;
|
2012-01-06 17:43:27 +01:00
|
|
|
else if (value == QLatin1String("build_all"))
|
2011-05-04 13:14:46 +02:00
|
|
|
m_defaultConfigIsDebugAndRelease = true;
|
|
|
|
|
}
|
2012-01-06 17:43:27 +01:00
|
|
|
const QString designerBins = QLatin1String("QT.designer.bins");
|
2012-03-07 10:34:17 +01:00
|
|
|
const QString declarativeBins = QLatin1String("QT.qml.bins");
|
2012-01-06 17:43:27 +01:00
|
|
|
m_mkspecValues.insert(designerBins, evaluator->value(designerBins));
|
|
|
|
|
m_mkspecValues.insert(declarativeBins, evaluator->value(declarativeBins));
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
2011-11-25 13:19:58 +01:00
|
|
|
Utils::FileName BaseQtVersion::mkspec() const
|
2011-05-04 13:14:46 +02:00
|
|
|
{
|
|
|
|
|
updateMkspec();
|
|
|
|
|
return m_mkspec;
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-30 00:23:47 +02:00
|
|
|
Utils::FileName BaseQtVersion::mkspecFor(ProjectExplorer::ToolChain *tc) const
|
|
|
|
|
{
|
|
|
|
|
if (!tc)
|
|
|
|
|
return mkspec();
|
|
|
|
|
|
|
|
|
|
const QList<Utils::FileName> tcSpecList = tc->suggestedMkspecList();
|
|
|
|
|
foreach (const Utils::FileName &tcSpec, tcSpecList) {
|
|
|
|
|
if (hasMkspec(tcSpec))
|
|
|
|
|
return tcSpec;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return mkspec();
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-25 13:19:58 +01:00
|
|
|
Utils::FileName BaseQtVersion::mkspecPath() const
|
2011-05-04 13:14:46 +02:00
|
|
|
{
|
|
|
|
|
updateMkspec();
|
|
|
|
|
return m_mkspecFullPath;
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-25 13:19:58 +01:00
|
|
|
bool BaseQtVersion::hasMkspec(const Utils::FileName &spec) const
|
2011-04-07 13:12:55 +02:00
|
|
|
{
|
|
|
|
|
updateVersionInfo();
|
|
|
|
|
QFileInfo fi;
|
2012-01-06 17:43:27 +01:00
|
|
|
fi.setFile(QDir::fromNativeSeparators(m_versionInfo.value(QLatin1String("QMAKE_MKSPECS")))
|
|
|
|
|
+ QLatin1Char('/') + spec.toString());
|
2011-04-07 13:12:55 +02:00
|
|
|
if (fi.isDir())
|
|
|
|
|
return true;
|
2011-11-25 13:19:58 +01:00
|
|
|
fi.setFile(sourcePath().toString() + QLatin1String("/mkspecs/") + spec.toString());
|
2011-04-07 13:12:55 +02:00
|
|
|
return fi.isDir();
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-04 13:14:46 +02:00
|
|
|
BaseQtVersion::QmakeBuildConfigs BaseQtVersion::defaultBuildConfig() const
|
|
|
|
|
{
|
|
|
|
|
ensureMkSpecParsed();
|
|
|
|
|
BaseQtVersion::QmakeBuildConfigs result = BaseQtVersion::QmakeBuildConfig(0);
|
|
|
|
|
|
|
|
|
|
if (m_defaultConfigIsDebugAndRelease)
|
|
|
|
|
result = BaseQtVersion::BuildAll;
|
|
|
|
|
if (m_defaultConfigIsDebug)
|
|
|
|
|
result = result | BaseQtVersion::DebugBuild;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BaseQtVersion::qtVersionString() const
|
|
|
|
|
{
|
2012-03-30 16:44:28 +02:00
|
|
|
updateVersionInfo();
|
2011-05-04 13:14:46 +02:00
|
|
|
return m_qtVersionString;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QtVersionNumber BaseQtVersion::qtVersion() const
|
|
|
|
|
{
|
|
|
|
|
return QtVersionNumber(qtVersionString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BaseQtVersion::updateVersionInfo() const
|
|
|
|
|
{
|
|
|
|
|
if (m_versionInfoUpToDate)
|
|
|
|
|
return;
|
2011-07-14 13:35:40 +02:00
|
|
|
if (!m_qmakeIsExecutable) {
|
|
|
|
|
qWarning("Cannot update Qt version information: %s cannot be run.",
|
2011-11-25 13:19:58 +01:00
|
|
|
qPrintable(qmakeCommand().toString()));
|
2011-07-14 13:35:40 +02:00
|
|
|
return;
|
|
|
|
|
}
|
2011-05-04 13:14:46 +02:00
|
|
|
|
|
|
|
|
// extract data from qmake executable
|
|
|
|
|
m_versionInfo.clear();
|
2011-09-23 17:29:45 +02:00
|
|
|
m_installed = true;
|
2011-05-04 13:14:46 +02:00
|
|
|
m_hasExamples = false;
|
|
|
|
|
m_hasDocumentation = false;
|
|
|
|
|
m_hasDebuggingHelper = false;
|
|
|
|
|
m_hasQmlDump = false;
|
|
|
|
|
m_hasQmlDebuggingLibrary = false;
|
|
|
|
|
m_hasQmlObserver = false;
|
|
|
|
|
|
2011-07-14 13:35:40 +02:00
|
|
|
if (!queryQMakeVariables(qmakeCommand(), &m_versionInfo, &m_qmakeIsExecutable))
|
2011-05-04 13:14:46 +02:00
|
|
|
return;
|
|
|
|
|
|
2012-01-06 17:43:27 +01:00
|
|
|
const QString installDataKey = QLatin1String("QT_INSTALL_DATA");
|
|
|
|
|
const QString installBinsKey = QLatin1String("QT_INSTALL_BINS");
|
|
|
|
|
const QString installHeadersKey = QLatin1String("QT_INSTALL_HEADERS");
|
|
|
|
|
if (m_versionInfo.contains(installDataKey)) {
|
|
|
|
|
const QString qtInstallData = m_versionInfo.value(installDataKey);
|
|
|
|
|
const QString qtInstallBins = m_versionInfo.value(installBinsKey);
|
|
|
|
|
const QString qtHeaderData = m_versionInfo.value(installHeadersKey);
|
2011-05-04 13:14:46 +02:00
|
|
|
if (!qtInstallData.isEmpty()) {
|
2012-05-16 16:24:16 +02:00
|
|
|
m_hasDebuggingHelper = !QtSupport::DebuggingHelperLibrary::debuggingHelperLibraryByInstallData(qtInstallData).isEmpty();
|
2011-05-04 13:14:46 +02:00
|
|
|
m_hasQmlDump
|
2011-12-14 13:20:29 +01:00
|
|
|
= !QmlDumpTool::toolForQtPaths(qtInstallData, qtInstallBins, qtHeaderData, false).isEmpty()
|
|
|
|
|
|| !QmlDumpTool::toolForQtPaths(qtInstallData, qtInstallBins, qtHeaderData, true).isEmpty();
|
2011-05-04 13:14:46 +02:00
|
|
|
m_hasQmlDebuggingLibrary
|
|
|
|
|
= !QmlDebuggingLibrary::libraryByInstallData(qtInstallData, false).isEmpty()
|
|
|
|
|
|| !QmlDebuggingLibrary::libraryByInstallData(qtInstallData, true).isEmpty();
|
|
|
|
|
m_hasQmlObserver = !QmlObserverTool::toolByInstallData(qtInstallData).isEmpty();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Now check for a qt that is configured with a prefix but not installed
|
2012-01-06 17:43:27 +01:00
|
|
|
if (m_versionInfo.contains(installBinsKey)) {
|
|
|
|
|
QFileInfo fi(m_versionInfo.value(installBinsKey));
|
2011-05-04 13:14:46 +02:00
|
|
|
if (!fi.exists())
|
2011-09-23 17:29:45 +02:00
|
|
|
m_installed = false;
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
2012-01-06 17:43:27 +01:00
|
|
|
if (m_versionInfo.contains(installHeadersKey)) {
|
|
|
|
|
const QFileInfo fi(m_versionInfo.value(installHeadersKey));
|
2011-05-04 13:14:46 +02:00
|
|
|
if (!fi.exists())
|
2011-09-23 17:29:45 +02:00
|
|
|
m_installed = false;
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
2012-01-06 17:43:27 +01:00
|
|
|
const QString installDocsKey = QLatin1String("QT_INSTALL_DOCS");
|
|
|
|
|
if (m_versionInfo.contains(installDocsKey)) {
|
|
|
|
|
const QFileInfo fi(m_versionInfo.value(installDocsKey));
|
2011-05-04 13:14:46 +02:00
|
|
|
if (fi.exists())
|
|
|
|
|
m_hasDocumentation = true;
|
|
|
|
|
}
|
2012-01-06 17:43:27 +01:00
|
|
|
const QString installExamplesKey = QLatin1String("QT_INSTALL_EXAMPLES");
|
|
|
|
|
if (m_versionInfo.contains(installExamplesKey)) {
|
|
|
|
|
const QFileInfo fi(m_versionInfo.value(installExamplesKey));
|
2011-05-04 13:14:46 +02:00
|
|
|
if (fi.exists())
|
|
|
|
|
m_hasExamples = true;
|
|
|
|
|
}
|
2012-01-06 17:43:27 +01:00
|
|
|
const QString installDemosKey = QLatin1String("QT_INSTALL_DEMOS");
|
|
|
|
|
if (m_versionInfo.contains(installDemosKey)) {
|
|
|
|
|
const QFileInfo fi(m_versionInfo.value(installDemosKey));
|
2011-05-04 13:14:46 +02:00
|
|
|
if (fi.exists())
|
|
|
|
|
m_hasDemos = true;
|
|
|
|
|
}
|
2012-03-30 16:44:28 +02:00
|
|
|
m_qtVersionString = m_versionInfo.value(QLatin1String("QT_VERSION"), QString());
|
2011-05-04 13:14:46 +02:00
|
|
|
|
|
|
|
|
m_versionInfoUpToDate = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QHash<QString,QString> BaseQtVersion::versionInfo() const
|
|
|
|
|
{
|
|
|
|
|
updateVersionInfo();
|
|
|
|
|
return m_versionInfo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool BaseQtVersion::hasDocumentation() const
|
|
|
|
|
{
|
|
|
|
|
updateVersionInfo();
|
|
|
|
|
return m_hasDocumentation;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BaseQtVersion::documentationPath() const
|
|
|
|
|
{
|
|
|
|
|
updateVersionInfo();
|
2012-01-06 17:43:27 +01:00
|
|
|
return m_versionInfo.value(QLatin1String("QT_INSTALL_DOCS"));
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool BaseQtVersion::hasDemos() const
|
|
|
|
|
{
|
|
|
|
|
updateVersionInfo();
|
|
|
|
|
return m_hasDemos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BaseQtVersion::demosPath() const
|
|
|
|
|
{
|
|
|
|
|
updateVersionInfo();
|
2012-01-06 17:43:27 +01:00
|
|
|
return m_versionInfo.value(QLatin1String("QT_INSTALL_DEMOS"));
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BaseQtVersion::frameworkInstallPath() const
|
|
|
|
|
{
|
|
|
|
|
#ifdef Q_OS_MAC
|
|
|
|
|
updateVersionInfo();
|
2012-01-06 17:43:27 +01:00
|
|
|
return m_versionInfo.value(QLatin1String("QT_INSTALL_LIBS"));
|
2011-05-04 13:14:46 +02:00
|
|
|
#else
|
|
|
|
|
return QString();
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool BaseQtVersion::hasExamples() const
|
|
|
|
|
{
|
|
|
|
|
updateVersionInfo();
|
|
|
|
|
return m_hasExamples;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BaseQtVersion::examplesPath() const
|
|
|
|
|
{
|
|
|
|
|
updateVersionInfo();
|
2012-01-06 17:43:27 +01:00
|
|
|
return m_versionInfo.value(QLatin1String("QT_INSTALL_EXAMPLES"));
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
QList<ProjectExplorer::HeaderPath> BaseQtVersion::systemHeaderPathes(const ProjectExplorer::Profile *p) const
|
2011-05-04 13:14:46 +02:00
|
|
|
{
|
2012-04-24 15:49:09 +02:00
|
|
|
Q_UNUSED(p);
|
2011-05-04 13:14:46 +02:00
|
|
|
QList<ProjectExplorer::HeaderPath> result;
|
2011-11-25 13:19:58 +01:00
|
|
|
result.append(ProjectExplorer::HeaderPath(mkspecPath().toString(), ProjectExplorer::HeaderPath::GlobalHeaderPath));
|
2011-05-04 13:14:46 +02:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
void BaseQtVersion::addToEnvironment(const ProjectExplorer::Profile *p, Utils::Environment &env) const
|
2011-05-04 13:14:46 +02:00
|
|
|
{
|
2012-04-24 15:49:09 +02:00
|
|
|
Q_UNUSED(p);
|
2012-01-06 17:43:27 +01:00
|
|
|
env.set(QLatin1String("QTDIR"), QDir::toNativeSeparators(versionInfo().value(QLatin1String("QT_INSTALL_DATA"))));
|
|
|
|
|
env.prependOrSetPath(versionInfo().value(QLatin1String("QT_INSTALL_BINS")));
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool BaseQtVersion::hasGdbDebuggingHelper() const
|
|
|
|
|
{
|
|
|
|
|
updateVersionInfo();
|
|
|
|
|
return m_hasDebuggingHelper;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool BaseQtVersion::hasQmlDump() const
|
|
|
|
|
{
|
|
|
|
|
updateVersionInfo();
|
|
|
|
|
return m_hasQmlDump;
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-13 11:47:53 +01:00
|
|
|
bool BaseQtVersion::needsQmlDump() const
|
|
|
|
|
{
|
|
|
|
|
updateVersionInfo();
|
|
|
|
|
return qtVersion() < QtVersionNumber(4, 8, 0);
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-04 13:14:46 +02:00
|
|
|
bool BaseQtVersion::hasQmlDebuggingLibrary() const
|
|
|
|
|
{
|
|
|
|
|
updateVersionInfo();
|
|
|
|
|
return m_hasQmlDebuggingLibrary;
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-14 15:00:42 +02:00
|
|
|
bool BaseQtVersion::needsQmlDebuggingLibrary() const
|
|
|
|
|
{
|
|
|
|
|
updateVersionInfo();
|
|
|
|
|
return qtVersion() < QtVersionNumber(4, 8, 0);
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-04 13:14:46 +02:00
|
|
|
bool BaseQtVersion::hasQmlObserver() const
|
|
|
|
|
{
|
|
|
|
|
updateVersionInfo();
|
|
|
|
|
return m_hasQmlObserver;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Utils::Environment BaseQtVersion::qmlToolsEnvironment() const
|
|
|
|
|
{
|
|
|
|
|
// FIXME: This seems broken!
|
|
|
|
|
Utils::Environment environment = Utils::Environment::systemEnvironment();
|
2012-04-24 15:49:09 +02:00
|
|
|
#if 0 // FIXME: Fix this!
|
2011-05-04 13:14:46 +02:00
|
|
|
addToEnvironment(environment);
|
2012-04-24 15:49:09 +02:00
|
|
|
#endif
|
2011-05-04 13:14:46 +02:00
|
|
|
|
|
|
|
|
// add preferred tool chain, as that is how the tools are built, compare QtVersion::buildDebuggingHelperLibrary
|
2011-11-08 12:04:55 +01:00
|
|
|
if (!qtAbis().isEmpty()) {
|
|
|
|
|
QList<ProjectExplorer::ToolChain *> alltc =
|
|
|
|
|
ProjectExplorer::ToolChainManager::instance()->findToolChains(qtAbis().at(0));
|
|
|
|
|
if (!alltc.isEmpty())
|
|
|
|
|
alltc.first()->addToEnvironment(environment);
|
|
|
|
|
}
|
2011-05-04 13:14:46 +02:00
|
|
|
|
|
|
|
|
return environment;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BaseQtVersion::gdbDebuggingHelperLibrary() const
|
|
|
|
|
{
|
2012-01-06 17:43:27 +01:00
|
|
|
QString qtInstallData = versionInfo().value(QLatin1String("QT_INSTALL_DATA"));
|
2011-05-04 13:14:46 +02:00
|
|
|
if (qtInstallData.isEmpty())
|
|
|
|
|
return QString();
|
2012-05-16 16:24:16 +02:00
|
|
|
return QtSupport::DebuggingHelperLibrary::debuggingHelperLibraryByInstallData(qtInstallData);
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BaseQtVersion::qmlDumpTool(bool debugVersion) const
|
|
|
|
|
{
|
2012-01-06 17:43:27 +01:00
|
|
|
const QString qtInstallData = versionInfo().value(QLatin1String("QT_INSTALL_DATA"));
|
2011-05-04 13:14:46 +02:00
|
|
|
if (qtInstallData.isEmpty())
|
|
|
|
|
return QString();
|
2012-01-06 17:43:27 +01:00
|
|
|
const QString qtInstallBins = versionInfo().value(QLatin1String("QT_INSTALL_BINS"));
|
|
|
|
|
const QString qtHeaderData = versionInfo().value(QLatin1String("QT_INSTALL_HEADERS"));
|
2011-12-14 13:20:29 +01:00
|
|
|
return QmlDumpTool::toolForQtPaths(qtInstallData, qtInstallBins, qtHeaderData, debugVersion);
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BaseQtVersion::qmlDebuggingHelperLibrary(bool debugVersion) const
|
|
|
|
|
{
|
2012-01-06 17:43:27 +01:00
|
|
|
QString qtInstallData = versionInfo().value(QLatin1String("QT_INSTALL_DATA"));
|
2011-05-04 13:14:46 +02:00
|
|
|
if (qtInstallData.isEmpty())
|
|
|
|
|
return QString();
|
|
|
|
|
return QmlDebuggingLibrary::libraryByInstallData(qtInstallData, debugVersion);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BaseQtVersion::qmlObserverTool() const
|
|
|
|
|
{
|
2012-01-06 17:43:27 +01:00
|
|
|
QString qtInstallData = versionInfo().value(QLatin1String("QT_INSTALL_DATA"));
|
2011-05-04 13:14:46 +02:00
|
|
|
if (qtInstallData.isEmpty())
|
|
|
|
|
return QString();
|
|
|
|
|
return QmlObserverTool::toolByInstallData(qtInstallData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QStringList BaseQtVersion::debuggingHelperLibraryLocations() const
|
|
|
|
|
{
|
2012-01-06 17:43:27 +01:00
|
|
|
QString qtInstallData = versionInfo().value(QLatin1String("QT_INSTALL_DATA"));
|
2011-05-04 13:14:46 +02:00
|
|
|
if (qtInstallData.isEmpty())
|
|
|
|
|
return QStringList();
|
2012-05-16 16:24:16 +02:00
|
|
|
return QtSupport::DebuggingHelperLibrary::debuggingHelperLibraryDirectories(qtInstallData);
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool BaseQtVersion::supportsBinaryDebuggingHelper() const
|
|
|
|
|
{
|
|
|
|
|
if (!isValid())
|
|
|
|
|
return false;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BaseQtVersion::recheckDumper()
|
|
|
|
|
{
|
|
|
|
|
m_versionInfoUpToDate = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool BaseQtVersion::supportsShadowBuilds() const
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
QList<ProjectExplorer::Task> BaseQtVersion::reportIssuesImpl(const QString &proFile, const QString &buildDir) const
|
2011-05-04 13:14:46 +02:00
|
|
|
{
|
|
|
|
|
QList<ProjectExplorer::Task> results;
|
|
|
|
|
|
|
|
|
|
QString tmpBuildDir = QDir(buildDir).absolutePath();
|
|
|
|
|
if (!tmpBuildDir.endsWith(QLatin1Char('/')))
|
|
|
|
|
tmpBuildDir.append(QLatin1Char('/'));
|
|
|
|
|
|
|
|
|
|
if (!isValid()) {
|
|
|
|
|
//: %1: Reason for being invalid
|
|
|
|
|
const QString msg = QCoreApplication::translate("Qt4ProjectManager::QtVersion", "The Qt version is invalid: %1").arg(invalidReason());
|
2012-01-26 13:38:25 +01:00
|
|
|
results.append(ProjectExplorer::Task(ProjectExplorer::Task::Error, msg, Utils::FileName(), -1,
|
|
|
|
|
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
2011-11-25 13:19:58 +01:00
|
|
|
QFileInfo qmakeInfo = qmakeCommand().toFileInfo();
|
2011-05-04 13:14:46 +02:00
|
|
|
if (!qmakeInfo.exists() ||
|
|
|
|
|
!qmakeInfo.isExecutable()) {
|
|
|
|
|
//: %1: Path to qmake executable
|
|
|
|
|
const QString msg = QCoreApplication::translate("Qt4ProjectManager::QtVersion",
|
2011-11-25 13:19:58 +01:00
|
|
|
"The qmake command \"%1\" was not found or is not executable.").arg(qmakeCommand().toUserOutput());
|
2012-01-26 13:38:25 +01:00
|
|
|
results.append(ProjectExplorer::Task(ProjectExplorer::Task::Error, msg, Utils::FileName(), -1,
|
|
|
|
|
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString sourcePath = QFileInfo(proFile).absolutePath();
|
2012-01-06 17:43:27 +01:00
|
|
|
const QChar slash = QLatin1Char('/');
|
|
|
|
|
if (!sourcePath.endsWith(slash))
|
|
|
|
|
sourcePath.append(slash);
|
2011-05-04 13:14:46 +02:00
|
|
|
if ((tmpBuildDir.startsWith(sourcePath)) && (tmpBuildDir != sourcePath)) {
|
|
|
|
|
const QString msg = QCoreApplication::translate("Qt4ProjectManager::QtVersion",
|
|
|
|
|
"Qmake does not support build directories below the source directory.");
|
2012-01-26 13:38:25 +01:00
|
|
|
results.append(ProjectExplorer::Task(ProjectExplorer::Task::Warning, msg, Utils::FileName(), -1,
|
|
|
|
|
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
|
2012-01-06 17:43:27 +01:00
|
|
|
} else if (tmpBuildDir.count(slash) != sourcePath.count(slash) && qtVersion() < QtVersionNumber(4,8, 0)) {
|
2011-05-04 13:14:46 +02:00
|
|
|
const QString msg = QCoreApplication::translate("Qt4ProjectManager::QtVersion",
|
|
|
|
|
"The build directory needs to be at the same level as the source directory.");
|
|
|
|
|
|
2012-01-26 13:38:25 +01:00
|
|
|
results.append(ProjectExplorer::Task(ProjectExplorer::Task::Warning, msg, Utils::FileName(), -1,
|
|
|
|
|
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return results;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QList<ProjectExplorer::Task>
|
2012-04-24 15:49:09 +02:00
|
|
|
BaseQtVersion::reportIssues(const QString &proFile, const QString &buildDir) const
|
2011-05-04 13:14:46 +02:00
|
|
|
{
|
|
|
|
|
QList<ProjectExplorer::Task> results = reportIssuesImpl(proFile, buildDir);
|
|
|
|
|
qSort(results);
|
|
|
|
|
return results;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProjectExplorer::IOutputParser *BaseQtVersion::createOutputParser() const
|
|
|
|
|
{
|
|
|
|
|
return new ProjectExplorer::GnuMakeParser;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QtConfigWidget *BaseQtVersion::createConfigurationWidget() const
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-25 13:19:58 +01:00
|
|
|
bool BaseQtVersion::queryQMakeVariables(const Utils::FileName &binary, QHash<QString, QString> *versionInfo)
|
2011-07-14 13:35:40 +02:00
|
|
|
{
|
|
|
|
|
bool qmakeIsExecutable;
|
|
|
|
|
return BaseQtVersion::queryQMakeVariables(binary, versionInfo, &qmakeIsExecutable);
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-25 13:19:58 +01:00
|
|
|
bool BaseQtVersion::queryQMakeVariables(const Utils::FileName &binary, QHash<QString, QString> *versionInfo,
|
2011-07-14 13:35:40 +02:00
|
|
|
bool *qmakeIsExecutable)
|
2011-05-04 13:14:46 +02:00
|
|
|
{
|
|
|
|
|
const int timeOutMS = 30000; // Might be slow on some machines.
|
2011-11-25 13:19:58 +01:00
|
|
|
const QFileInfo qmake = binary.toFileInfo();
|
2011-07-14 13:35:40 +02:00
|
|
|
*qmakeIsExecutable = qmake.exists() && qmake.isExecutable() && !qmake.isDir();
|
|
|
|
|
if (!*qmakeIsExecutable)
|
2011-05-04 13:14:46 +02:00
|
|
|
return false;
|
2012-03-06 17:48:01 +01:00
|
|
|
|
2011-05-04 13:14:46 +02:00
|
|
|
QProcess process;
|
2012-03-06 17:48:01 +01:00
|
|
|
process.start(qmake.absoluteFilePath(), QStringList(QLatin1String("-query")), QIODevice::ReadOnly);
|
2011-05-04 13:14:46 +02:00
|
|
|
if (!process.waitForStarted()) {
|
2011-07-14 13:35:40 +02:00
|
|
|
*qmakeIsExecutable = false;
|
2011-11-25 13:19:58 +01:00
|
|
|
qWarning("Cannot start '%s': %s", qPrintable(binary.toUserOutput()), qPrintable(process.errorString()));
|
2011-05-04 13:14:46 +02:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (!process.waitForFinished(timeOutMS)) {
|
|
|
|
|
Utils::SynchronousProcess::stopProcess(process);
|
2011-11-25 13:19:58 +01:00
|
|
|
qWarning("Timeout running '%s' (%dms).", qPrintable(binary.toUserOutput()), timeOutMS);
|
2011-05-04 13:14:46 +02:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (process.exitStatus() != QProcess::NormalExit) {
|
2011-07-14 13:35:40 +02:00
|
|
|
*qmakeIsExecutable = false;
|
2011-11-25 13:19:58 +01:00
|
|
|
qWarning("'%s' crashed.", qPrintable(binary.toUserOutput()));
|
2011-05-04 13:14:46 +02:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
QByteArray output = process.readAllStandardOutput();
|
|
|
|
|
QTextStream stream(&output);
|
|
|
|
|
while (!stream.atEnd()) {
|
|
|
|
|
const QString line = stream.readLine();
|
|
|
|
|
const int index = line.indexOf(QLatin1Char(':'));
|
|
|
|
|
if (index != -1) {
|
2012-04-12 16:16:41 +02:00
|
|
|
const QString name = line.left(index);
|
2011-05-04 13:14:46 +02:00
|
|
|
const QString value = QDir::fromNativeSeparators(line.mid(index+1));
|
2012-04-12 16:16:41 +02:00
|
|
|
if (value != QLatin1String("**Unknown**")) {
|
|
|
|
|
versionInfo->insert(name, value);
|
|
|
|
|
if (name.startsWith(QLatin1String("QT_")) && !name.contains(QLatin1Char('/'))) {
|
|
|
|
|
if (name.startsWith(QLatin1String("QT_INSTALL_"))) {
|
|
|
|
|
versionInfo->insert(name + QLatin1String("/raw"), value);
|
|
|
|
|
versionInfo->insert(name + QLatin1String("/get"), value);
|
|
|
|
|
} else if (name.startsWith(QLatin1String("QT_HOST_"))) {
|
|
|
|
|
versionInfo->insert(name + QLatin1String("/get"), value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-12 21:55:22 +09:00
|
|
|
Utils::FileName BaseQtVersion::mkspecDirectoryFromVersionInfo(const QHash<QString, QString> &versionInfo)
|
2011-05-04 13:14:46 +02:00
|
|
|
{
|
2012-01-06 17:43:27 +01:00
|
|
|
Utils::FileName baseMkspecDir = Utils::FileName::fromUserInput(versionInfo.value(QLatin1String("QMAKE_MKSPECS")));
|
2012-06-12 21:55:22 +09:00
|
|
|
if (baseMkspecDir.isEmpty()) {
|
|
|
|
|
baseMkspecDir = Utils::FileName::fromUserInput(versionInfo.value(QLatin1String("QT_HOST_DATA")));
|
|
|
|
|
if (baseMkspecDir.isEmpty())
|
|
|
|
|
baseMkspecDir = Utils::FileName::fromUserInput(versionInfo.value(QLatin1String("QT_INSTALL_DATA")));
|
|
|
|
|
if (!baseMkspecDir.isEmpty())
|
|
|
|
|
baseMkspecDir.appendPath("mkspecs");
|
|
|
|
|
}
|
|
|
|
|
return baseMkspecDir;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Utils::FileName BaseQtVersion::mkspecFromVersionInfo(const QHash<QString, QString> &versionInfo)
|
|
|
|
|
{
|
|
|
|
|
Utils::FileName baseMkspecDir = mkspecDirectoryFromVersionInfo(versionInfo);
|
2011-05-04 13:14:46 +02:00
|
|
|
if (baseMkspecDir.isEmpty())
|
2011-11-25 13:19:58 +01:00
|
|
|
return Utils::FileName();
|
2011-05-04 13:14:46 +02:00
|
|
|
|
2012-01-06 17:43:27 +01:00
|
|
|
Utils::FileName mkspecFullPath = Utils::FileName::fromString(baseMkspecDir.toString() + QLatin1String("/default"));
|
2011-05-04 13:14:46 +02:00
|
|
|
|
|
|
|
|
// qDebug() << "default mkspec is located at" << mkspecFullPath;
|
|
|
|
|
|
|
|
|
|
#ifdef Q_OS_WIN
|
2011-11-25 13:19:58 +01:00
|
|
|
QFile f2(mkspecFullPath.toString() + "/qmake.conf");
|
2011-05-04 13:14:46 +02:00
|
|
|
if (f2.exists() && f2.open(QIODevice::ReadOnly)) {
|
|
|
|
|
while (!f2.atEnd()) {
|
|
|
|
|
QByteArray line = f2.readLine();
|
|
|
|
|
if (line.startsWith("QMAKESPEC_ORIGINAL")) {
|
|
|
|
|
const QList<QByteArray> &temp = line.split('=');
|
|
|
|
|
if (temp.size() == 2) {
|
|
|
|
|
QString possibleFullPath = temp.at(1).trimmed();
|
|
|
|
|
// We sometimes get a mix of different slash styles here...
|
|
|
|
|
possibleFullPath = possibleFullPath.replace('\\', '/');
|
|
|
|
|
if (QFileInfo(possibleFullPath).exists()) // Only if the path exists
|
2011-11-25 13:19:58 +01:00
|
|
|
mkspecFullPath = Utils::FileName::fromUserInput(possibleFullPath);
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
f2.close();
|
|
|
|
|
}
|
|
|
|
|
#elif defined(Q_OS_MAC)
|
2011-11-25 13:19:58 +01:00
|
|
|
QFile f2(mkspecFullPath.toString() + "/qmake.conf");
|
2011-05-04 13:14:46 +02:00
|
|
|
if (f2.exists() && f2.open(QIODevice::ReadOnly)) {
|
|
|
|
|
while (!f2.atEnd()) {
|
|
|
|
|
QByteArray line = f2.readLine();
|
|
|
|
|
if (line.startsWith("MAKEFILE_GENERATOR")) {
|
|
|
|
|
const QList<QByteArray> &temp = line.split('=');
|
|
|
|
|
if (temp.size() == 2) {
|
|
|
|
|
const QByteArray &value = temp.at(1);
|
|
|
|
|
if (value.contains("XCODE")) {
|
|
|
|
|
// we don't want to generate xcode projects...
|
|
|
|
|
// qDebug() << "default mkspec is xcode, falling back to g++";
|
2011-11-25 13:19:58 +01:00
|
|
|
mkspecFullPath = baseMkspecDir.appendPath("macx-g++");
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
//resolve mkspec link
|
2011-11-25 13:19:58 +01:00
|
|
|
mkspecFullPath = Utils::FileName::fromString(mkspecFullPath.toFileInfo().canonicalFilePath());
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
f2.close();
|
|
|
|
|
}
|
|
|
|
|
#else
|
2011-11-25 13:19:58 +01:00
|
|
|
mkspecFullPath = Utils::FileName::fromString(mkspecFullPath.toFileInfo().canonicalFilePath());
|
2011-05-04 13:14:46 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return mkspecFullPath;
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-13 15:07:32 +01:00
|
|
|
Utils::FileName BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionInfo, const QString &versionString)
|
2011-05-04 13:14:46 +02:00
|
|
|
{
|
|
|
|
|
QStringList dirs;
|
|
|
|
|
dirs << versionInfo.value(QLatin1String("QT_INSTALL_LIBS"))
|
|
|
|
|
<< versionInfo.value(QLatin1String("QT_INSTALL_BINS"));
|
|
|
|
|
|
|
|
|
|
QFileInfoList staticLibs;
|
|
|
|
|
foreach (const QString &dir, dirs) {
|
|
|
|
|
if (dir.isEmpty())
|
|
|
|
|
continue;
|
|
|
|
|
QDir d(dir);
|
|
|
|
|
QFileInfoList infoList = d.entryInfoList();
|
|
|
|
|
foreach (const QFileInfo &info, infoList) {
|
|
|
|
|
const QString file = info.fileName();
|
|
|
|
|
if (info.isDir()
|
|
|
|
|
&& file.startsWith(QLatin1String("QtCore"))
|
|
|
|
|
&& file.endsWith(QLatin1String(".framework"))) {
|
|
|
|
|
// handle Framework
|
2012-01-13 15:07:32 +01:00
|
|
|
Utils::FileName lib(info);
|
|
|
|
|
lib.appendPath(file.left(file.lastIndexOf(QLatin1Char('.'))));
|
|
|
|
|
return lib;
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
if (info.isReadable()) {
|
|
|
|
|
if (file.startsWith(QLatin1String("libQtCore"))
|
|
|
|
|
|| file.startsWith(QLatin1String("QtCore"))) {
|
|
|
|
|
// Only handle static libs if we can not find dynamic ones:
|
2012-01-06 17:43:27 +01:00
|
|
|
if (file.endsWith(QLatin1String(".a")) || file.endsWith(QLatin1String(".lib")))
|
2011-05-04 13:14:46 +02:00
|
|
|
staticLibs.append(info);
|
|
|
|
|
else if (file.endsWith(QLatin1String(".dll"))
|
|
|
|
|
|| file.endsWith(QString::fromLatin1(".so.") + versionString)
|
2012-04-18 20:30:57 +03:00
|
|
|
|| file.endsWith(QLatin1String(".so"))
|
2011-05-04 13:14:46 +02:00
|
|
|
|| file.endsWith(QLatin1Char('.') + versionString + QLatin1String(".dylib")))
|
2012-01-13 15:07:32 +01:00
|
|
|
return Utils::FileName(info);
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Return path to first static library found:
|
|
|
|
|
if (!staticLibs.isEmpty())
|
2012-01-13 15:07:32 +01:00
|
|
|
return Utils::FileName(staticLibs.at(0));
|
|
|
|
|
return Utils::FileName();
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
2012-01-13 15:07:32 +01:00
|
|
|
QList<ProjectExplorer::Abi> BaseQtVersion::qtAbisFromLibrary(const Utils::FileName &coreLibrary)
|
2011-05-04 13:14:46 +02:00
|
|
|
{
|
2011-09-06 15:19:05 +00:00
|
|
|
return ProjectExplorer::Abi::abisOfBinary(coreLibrary);
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|