2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2012-04-24 15:49:09 +02:00
|
|
|
**
|
2013-01-28 17:12:19 +01:00
|
|
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2012-04-24 15:49:09 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2012-04-24 15:49:09 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2012-04-24 15:49:09 +02:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, 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, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2012-04-24 15:49:09 +02:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
#include "qmakekitinformation.h"
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
#include "qmakekitconfigwidget.h"
|
2012-04-24 15:49:09 +02:00
|
|
|
|
|
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2013-03-25 17:13:18 +01:00
|
|
|
#include <projectexplorer/toolchain.h>
|
2012-12-17 16:26:14 +01:00
|
|
|
#include <projectexplorer/toolchainmanager.h>
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
#include <qtsupport/qtkitinformation.h>
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2013-08-29 13:14:19 +02:00
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
using namespace Utils;
|
|
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
namespace Qt4ProjectManager {
|
2013-08-29 13:14:19 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
QmakeKitInformation::QmakeKitInformation()
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
2012-09-03 18:31:44 +02:00
|
|
|
setObjectName(QLatin1String("QmakeKitInformation"));
|
2013-09-09 17:10:41 +02:00
|
|
|
setId(QmakeKitInformation::id());
|
2013-08-28 18:57:25 +02:00
|
|
|
setPriority(24000);
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
2013-08-29 13:14:19 +02:00
|
|
|
QVariant QmakeKitInformation::defaultValue(Kit *k) const
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
2012-09-03 18:31:44 +02:00
|
|
|
Q_UNUSED(k);
|
2012-06-20 15:43:01 +02:00
|
|
|
return QString();
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
2013-08-29 13:14:19 +02:00
|
|
|
QList<Task> QmakeKitInformation::validate(const Kit *k) const
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
2013-08-29 13:14:19 +02:00
|
|
|
QList<Task> result;
|
2012-09-03 18:31:44 +02:00
|
|
|
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2013-08-29 13:14:19 +02:00
|
|
|
FileName mkspec = QmakeKitInformation::mkspec(k);
|
2012-04-24 15:49:09 +02:00
|
|
|
if (!version && !mkspec.isEmpty())
|
2013-08-29 13:14:19 +02:00
|
|
|
result << Task(Task::Warning, tr("No Qt version set, so mkspec is ignored."),
|
|
|
|
|
FileName(), -1, Constants::TASK_CATEGORY_BUILDSYSTEM);
|
2012-04-24 15:49:09 +02:00
|
|
|
if (version && !version->hasMkspec(mkspec))
|
2013-08-29 13:14:19 +02:00
|
|
|
result << Task(Task::Error, tr("Mkspec not found for Qt version."),
|
|
|
|
|
FileName(), -1, Constants::TASK_CATEGORY_BUILDSYSTEM);
|
2012-04-24 15:49:09 +02:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-29 13:14:19 +02:00
|
|
|
void QmakeKitInformation::setup(Kit *k)
|
2012-12-17 16:26:14 +01:00
|
|
|
{
|
|
|
|
|
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
|
|
|
|
|
if (!version)
|
|
|
|
|
return;
|
|
|
|
|
|
2013-08-29 13:14:19 +02:00
|
|
|
FileName spec = QmakeKitInformation::mkspec(k);
|
2012-12-17 16:26:14 +01:00
|
|
|
if (spec.isEmpty())
|
|
|
|
|
spec = version->mkspec();
|
|
|
|
|
|
2013-08-29 13:14:19 +02:00
|
|
|
ToolChain *tc = ToolChainKitInformation::toolChain(k);
|
2012-12-17 16:26:14 +01:00
|
|
|
|
2013-08-15 13:17:18 +02:00
|
|
|
if (!tc || (!tc->suggestedMkspecList().empty() && !tc->suggestedMkspecList().contains(spec))) {
|
2013-08-29 13:14:19 +02:00
|
|
|
ToolChain *possibleTc = 0;
|
|
|
|
|
foreach (ToolChain *current, ToolChainManager::toolChains()) {
|
2013-03-05 13:17:47 +01:00
|
|
|
if (version->qtAbis().contains(current->targetAbi())) {
|
|
|
|
|
possibleTc = current;
|
|
|
|
|
if (current->suggestedMkspecList().contains(spec))
|
|
|
|
|
break;
|
2012-12-17 16:26:14 +01:00
|
|
|
}
|
|
|
|
|
}
|
2013-08-29 13:14:19 +02:00
|
|
|
ToolChainKitInformation::setToolChain(k, possibleTc);
|
2012-12-17 16:26:14 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-29 13:14:19 +02:00
|
|
|
KitConfigWidget *QmakeKitInformation::createConfigWidget(Kit *k) const
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
2013-09-09 17:10:41 +02:00
|
|
|
return new Internal::QmakeKitConfigWidget(k, this);
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
2013-08-29 13:14:19 +02:00
|
|
|
KitInformation::ItemList QmakeKitInformation::toUserOutput(const Kit *k) const
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
2012-09-03 18:31:44 +02:00
|
|
|
return ItemList() << qMakePair(tr("mkspec"), mkspec(k).toUserOutput());
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
2013-09-09 17:10:41 +02:00
|
|
|
Core::Id QmakeKitInformation::id()
|
|
|
|
|
{
|
|
|
|
|
return "QtPM4.mkSpecInformation";
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-29 13:14:19 +02:00
|
|
|
FileName QmakeKitInformation::mkspec(const Kit *k)
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
2012-09-03 18:31:44 +02:00
|
|
|
if (!k)
|
2013-08-29 13:14:19 +02:00
|
|
|
return FileName();
|
2013-09-09 17:10:41 +02:00
|
|
|
return FileName::fromString(k->value(QmakeKitInformation::id()).toString());
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
2013-08-29 13:14:19 +02:00
|
|
|
FileName QmakeKitInformation::effectiveMkspec(const Kit *k)
|
2012-06-20 15:43:01 +02:00
|
|
|
{
|
2012-09-03 18:31:44 +02:00
|
|
|
if (!k)
|
2013-08-29 13:14:19 +02:00
|
|
|
return FileName();
|
|
|
|
|
FileName spec = mkspec(k);
|
2012-06-20 15:43:01 +02:00
|
|
|
if (spec.isEmpty())
|
2012-09-03 18:31:44 +02:00
|
|
|
return defaultMkspec(k);
|
2012-06-20 15:43:01 +02:00
|
|
|
return spec;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-29 13:14:19 +02:00
|
|
|
void QmakeKitInformation::setMkspec(Kit *k, const FileName &fn)
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
2013-09-09 17:10:41 +02:00
|
|
|
k->setValue(QmakeKitInformation::id(), fn == defaultMkspec(k) ? QString() : fn.toString());
|
2012-06-20 15:43:01 +02:00
|
|
|
}
|
|
|
|
|
|
2013-08-29 13:14:19 +02:00
|
|
|
FileName QmakeKitInformation::defaultMkspec(const Kit *k)
|
2012-06-20 15:43:01 +02:00
|
|
|
{
|
2012-09-03 18:31:44 +02:00
|
|
|
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
|
2012-06-20 15:43:01 +02:00
|
|
|
if (!version) // No version, so no qmake
|
2013-08-29 13:14:19 +02:00
|
|
|
return FileName();
|
2012-06-20 15:43:01 +02:00
|
|
|
|
2013-08-29 13:14:19 +02:00
|
|
|
return version->mkspecFor(ToolChainKitInformation::toolChain(k));
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Qt4ProjectManager
|