forked from qt-creator/qt-creator
Qbs: Let plugins extend the profiles written into qbs.conf
Provide a way for plugins to extend the profiles that Creator will write into the Qbs configuration. This should allow e.g. the Android plugin to add customized settings. Change-Id: I0de596e2c922280b953c43ea0651b08b8936234c Reviewed-by: BogDan Vatra <bogdan@kde.org>
This commit is contained in:
144
src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp
Normal file
144
src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** 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.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** 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
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "defaultpropertyprovider.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/kit.h>
|
||||||
|
#include <projectexplorer/kitinformation.h>
|
||||||
|
#include <projectexplorer/toolchain.h>
|
||||||
|
#include <qtsupport/baseqtversion.h>
|
||||||
|
#include <qtsupport/qtkitinformation.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
#include <QFileInfo>
|
||||||
|
|
||||||
|
// Qt related settings:
|
||||||
|
const char QTCORE_BINPATH[] = "Qt.core.binPath";
|
||||||
|
const char QTCORE_BUILDVARIANT[] = "Qt.core.buildVariant";
|
||||||
|
const char QTCORE_DOCPATH[] = "Qt.core.docPath";
|
||||||
|
const char QTCORE_INCPATH[] = "Qt.core.incPath";
|
||||||
|
const char QTCORE_LIBPATH[] = "Qt.core.libPath";
|
||||||
|
const char QTCORE_VERSION[] = "Qt.core.version";
|
||||||
|
const char QTCORE_NAMESPACE[] = "Qt.core.namespace";
|
||||||
|
const char QTCORE_LIBINFIX[] = "Qt.core.libInfix";
|
||||||
|
const char QTCORE_MKSPEC[] = "Qt.core.mkspecPath";
|
||||||
|
const char QTCORE_FRAMEWORKBUILD[] = "Qt.core.frameworkBuild";
|
||||||
|
|
||||||
|
|
||||||
|
// Toolchain related settings:
|
||||||
|
const char QBS_TARGETOS[] = "qbs.targetOS";
|
||||||
|
const char QBS_SYSROOT[] = "qbs.sysroot";
|
||||||
|
const char QBS_ARCHITECTURE[] = "qbs.architecture";
|
||||||
|
const char QBS_ENDIANNESS[] = "qbs.endianness";
|
||||||
|
const char QBS_TOOLCHAIN[] = "qbs.toolchain";
|
||||||
|
const char CPP_TOOLCHAINPATH[] = "cpp.toolchainInstallPath";
|
||||||
|
const char CPP_COMPILERNAME[] = "cpp.compilerName";
|
||||||
|
|
||||||
|
namespace QbsProjectManager {
|
||||||
|
|
||||||
|
QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, const QVariantMap &defaultData) const
|
||||||
|
{
|
||||||
|
QTC_ASSERT(k, return defaultData);
|
||||||
|
QVariantMap data = defaultData;
|
||||||
|
QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(k);
|
||||||
|
if (qt) {
|
||||||
|
data.insert(QLatin1String(QTCORE_BINPATH), qt->binPath().toUserOutput());
|
||||||
|
QStringList builds;
|
||||||
|
if (qt->hasDebugBuild())
|
||||||
|
builds << QLatin1String("debug");
|
||||||
|
if (qt->hasReleaseBuild())
|
||||||
|
builds << QLatin1String("release");
|
||||||
|
data.insert(QLatin1String(QTCORE_BUILDVARIANT), builds);
|
||||||
|
data.insert(QLatin1String(QTCORE_DOCPATH), qt->docsPath().toUserOutput());
|
||||||
|
data.insert(QLatin1String(QTCORE_INCPATH), qt->headerPath().toUserOutput());
|
||||||
|
data.insert(QLatin1String(QTCORE_LIBPATH), qt->libraryPath().toUserOutput());
|
||||||
|
Utils::FileName mkspecPath = qt->mkspecsPath();
|
||||||
|
mkspecPath.appendPath(qt->mkspec().toString());
|
||||||
|
data.insert(QLatin1String(QTCORE_MKSPEC), mkspecPath.toUserOutput());
|
||||||
|
data.insert(QLatin1String(QTCORE_NAMESPACE), qt->qtNamespace());
|
||||||
|
data.insert(QLatin1String(QTCORE_LIBINFIX), qt->qtLibInfix());
|
||||||
|
data.insert(QLatin1String(QTCORE_VERSION), qt->qtVersionString());
|
||||||
|
if (qt->isFrameworkBuild())
|
||||||
|
data.insert(QLatin1String(QTCORE_FRAMEWORKBUILD), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ProjectExplorer::SysRootKitInformation::hasSysRoot(k))
|
||||||
|
data.insert(QLatin1String(QBS_SYSROOT), ProjectExplorer::SysRootKitInformation::sysRoot(k).toUserOutput());
|
||||||
|
|
||||||
|
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
|
||||||
|
if (tc) {
|
||||||
|
// FIXME/CLARIFY: How to pass the sysroot?
|
||||||
|
ProjectExplorer::Abi targetAbi = tc->targetAbi();
|
||||||
|
QString architecture = ProjectExplorer::Abi::toString(targetAbi.architecture());
|
||||||
|
if (targetAbi.wordWidth() == 64)
|
||||||
|
architecture.append(QLatin1String("_64"));
|
||||||
|
data.insert(QLatin1String(QBS_ARCHITECTURE), architecture);
|
||||||
|
|
||||||
|
if (targetAbi.endianness() == ProjectExplorer::Abi::BigEndian)
|
||||||
|
data.insert(QLatin1String(QBS_ENDIANNESS), QLatin1String("big"));
|
||||||
|
else
|
||||||
|
data.insert(QLatin1String(QBS_ENDIANNESS), QLatin1String("little"));
|
||||||
|
|
||||||
|
if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) {
|
||||||
|
data.insert(QLatin1String(QBS_TARGETOS), QLatin1String("windows"));
|
||||||
|
data.insert(QLatin1String(QBS_TOOLCHAIN),
|
||||||
|
targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor
|
||||||
|
? QStringList() << QLatin1String("mingw") << QLatin1String("gcc")
|
||||||
|
: QStringList() << QLatin1String("msvc"));
|
||||||
|
} else if (targetAbi.os() == ProjectExplorer::Abi::MacOS) {
|
||||||
|
data.insert(QLatin1String(QBS_TARGETOS), QStringList() << QLatin1String("osx")
|
||||||
|
<< QLatin1String("darwin") << QLatin1String("unix"));
|
||||||
|
if (tc->type() != QLatin1String("clang")) {
|
||||||
|
data.insert(QLatin1String(QBS_TOOLCHAIN), QLatin1String("gcc"));
|
||||||
|
} else {
|
||||||
|
data.insert(QLatin1String(QBS_TOOLCHAIN),
|
||||||
|
QStringList() << QLatin1String("clang")
|
||||||
|
<< QLatin1String("llvm")
|
||||||
|
<< QLatin1String("gcc"));
|
||||||
|
}
|
||||||
|
} else if (targetAbi.os() == ProjectExplorer::Abi::LinuxOS) {
|
||||||
|
data.insert(QLatin1String(QBS_TARGETOS), QStringList() << QLatin1String("linux")
|
||||||
|
<< QLatin1String("unix"));
|
||||||
|
if (tc->type() != QLatin1String("clang")) {
|
||||||
|
data.insert(QLatin1String(QBS_TOOLCHAIN), QLatin1String("gcc"));
|
||||||
|
} else {
|
||||||
|
data.insert(QLatin1String(QBS_TOOLCHAIN),
|
||||||
|
QStringList() << QLatin1String("clang")
|
||||||
|
<< QLatin1String("llvm")
|
||||||
|
<< QLatin1String("gcc"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Utils::FileName cxx = tc->compilerCommand();
|
||||||
|
data.insert(QLatin1String(CPP_TOOLCHAINPATH), cxx.toFileInfo().absolutePath());
|
||||||
|
data.insert(QLatin1String(CPP_COMPILERNAME), cxx.toFileInfo().fileName());
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace QbsProjectManager
|
||||||
48
src/plugins/qbsprojectmanager/defaultpropertyprovider.h
Normal file
48
src/plugins/qbsprojectmanager/defaultpropertyprovider.h
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** 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.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** 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
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef DEFAULTPROPERTYPROVIDER_H
|
||||||
|
#define DEFAULTPROPERTYPROVIDER_H
|
||||||
|
|
||||||
|
#include "propertyprovider.h"
|
||||||
|
|
||||||
|
namespace QbsProjectManager {
|
||||||
|
|
||||||
|
class DefaultPropertyProvider : public PropertyProvider
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool canHandle(const ProjectExplorer::Kit *k) const { return k; }
|
||||||
|
QVariantMap properties(const ProjectExplorer::Kit *k, const QVariantMap &defaultData) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace QbsProjectManager
|
||||||
|
|
||||||
|
#endif // DEFAULTPROPERTYPROVIDER_H
|
||||||
53
src/plugins/qbsprojectmanager/propertyprovider.h
Normal file
53
src/plugins/qbsprojectmanager/propertyprovider.h
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** 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.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** 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
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef PROPERTYPROVIDER_H
|
||||||
|
#define PROPERTYPROVIDER_H
|
||||||
|
|
||||||
|
#include "qbsprojectmanager_global.h"
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QVariantMap>
|
||||||
|
|
||||||
|
namespace ProjectExplorer { class Kit; }
|
||||||
|
|
||||||
|
namespace QbsProjectManager {
|
||||||
|
|
||||||
|
class QBSPROJECTMANAGER_EXPORT PropertyProvider : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual bool canHandle(const ProjectExplorer::Kit *k) const = 0;
|
||||||
|
virtual QVariantMap properties(const ProjectExplorer::Kit *k, const QVariantMap &defaultData) const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace QbsProjectManager
|
||||||
|
|
||||||
|
#endif // PROPERTYPROVIDER_H
|
||||||
@@ -29,20 +29,17 @@
|
|||||||
|
|
||||||
#include "qbsprojectmanager.h"
|
#include "qbsprojectmanager.h"
|
||||||
|
|
||||||
|
#include "defaultpropertyprovider.h"
|
||||||
#include "qbslogsink.h"
|
#include "qbslogsink.h"
|
||||||
#include "qbsproject.h"
|
#include "qbsproject.h"
|
||||||
#include "qbsprojectmanagerconstants.h"
|
#include "qbsprojectmanagerconstants.h"
|
||||||
#include "qbsprojectmanagerplugin.h"
|
#include "qbsprojectmanagerplugin.h"
|
||||||
|
|
||||||
#include <projectexplorer/kitinformation.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
#include <projectexplorer/kit.h>
|
||||||
#include <projectexplorer/kitmanager.h>
|
#include <projectexplorer/kitmanager.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
|
||||||
#include <projectexplorer/toolchain.h>
|
|
||||||
#include <qmljstools/qmljstoolsconstants.h>
|
#include <qmljstools/qmljstoolsconstants.h>
|
||||||
#include <qtsupport/baseqtversion.h>
|
|
||||||
#include <qtsupport/qtkitinformation.h>
|
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
|
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
|
|
||||||
@@ -52,28 +49,6 @@
|
|||||||
const char PROFILE_LIST[] = "preferences.qtcreator.kit.";
|
const char PROFILE_LIST[] = "preferences.qtcreator.kit.";
|
||||||
const char PROFILES_PREFIX[] = "profiles.";
|
const char PROFILES_PREFIX[] = "profiles.";
|
||||||
|
|
||||||
// Qt related settings:
|
|
||||||
const char QTCORE_BINPATH[] = ".Qt.core.binPath";
|
|
||||||
const char QTCORE_BUILDVARIANT[] = ".Qt.core.buildVariant";
|
|
||||||
const char QTCORE_DOCPATH[] = ".Qt.core.docPath";
|
|
||||||
const char QTCORE_INCPATH[] = ".Qt.core.incPath";
|
|
||||||
const char QTCORE_LIBPATH[] = ".Qt.core.libPath";
|
|
||||||
const char QTCORE_VERSION[] = ".Qt.core.version";
|
|
||||||
const char QTCORE_NAMESPACE[] = ".Qt.core.namespace";
|
|
||||||
const char QTCORE_LIBINFIX[] = ".Qt.core.libInfix";
|
|
||||||
const char QTCORE_MKSPEC[] = ".Qt.core.mkspecPath";
|
|
||||||
const char QTCORE_FRAMEWORKBUILD[] = ".Qt.core.frameworkBuild";
|
|
||||||
|
|
||||||
|
|
||||||
// Toolchain related settings:
|
|
||||||
const char QBS_TARGETOS[] = ".qbs.targetOS";
|
|
||||||
const char QBS_SYSROOT[] = ".qbs.sysroot";
|
|
||||||
const char QBS_ARCHITECTURE[] = ".qbs.architecture";
|
|
||||||
const char QBS_ENDIANNESS[] = ".qbs.endianness";
|
|
||||||
const char QBS_TOOLCHAIN[] = ".qbs.toolchain";
|
|
||||||
const char CPP_TOOLCHAINPATH[] = ".cpp.toolchainInstallPath";
|
|
||||||
const char CPP_COMPILERNAME[] = ".cpp.compilerName";
|
|
||||||
|
|
||||||
const QChar sep = QChar(QLatin1Char('.'));
|
const QChar sep = QChar(QLatin1Char('.'));
|
||||||
|
|
||||||
namespace QbsProjectManager {
|
namespace QbsProjectManager {
|
||||||
@@ -82,7 +57,8 @@ qbs::Settings *QbsManager::m_settings = 0;
|
|||||||
qbs::Preferences *QbsManager::m_preferences = 0;
|
qbs::Preferences *QbsManager::m_preferences = 0;
|
||||||
|
|
||||||
QbsManager::QbsManager(Internal::QbsProjectManagerPlugin *plugin) :
|
QbsManager::QbsManager(Internal::QbsProjectManagerPlugin *plugin) :
|
||||||
m_plugin(plugin)
|
m_plugin(plugin),
|
||||||
|
m_defaultPropertyProvider(new DefaultPropertyProvider)
|
||||||
{
|
{
|
||||||
if (!m_settings)
|
if (!m_settings)
|
||||||
m_settings = new qbs::Settings(QLatin1String("QtProject"), QLatin1String("qbs"));
|
m_settings = new qbs::Settings(QLatin1String("QtProject"), QLatin1String("qbs"));
|
||||||
@@ -111,6 +87,7 @@ QbsManager::QbsManager(Internal::QbsProjectManagerPlugin *plugin) :
|
|||||||
|
|
||||||
QbsManager::~QbsManager()
|
QbsManager::~QbsManager()
|
||||||
{
|
{
|
||||||
|
delete m_defaultPropertyProvider;
|
||||||
delete m_settings;
|
delete m_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,7 +149,7 @@ qbs::Preferences *QbsManager::preferences()
|
|||||||
|
|
||||||
void QbsManager::addProfile(const QString &name, const QVariantMap &data)
|
void QbsManager::addProfile(const QString &name, const QVariantMap &data)
|
||||||
{
|
{
|
||||||
const QString base = QLatin1String(PROFILES_PREFIX) + name;
|
const QString base = QLatin1String(PROFILES_PREFIX) + name + sep;
|
||||||
const QVariantMap::ConstIterator cend = data.constEnd();
|
const QVariantMap::ConstIterator cend = data.constEnd();
|
||||||
for (QVariantMap::ConstIterator it = data.constBegin(); it != cend; ++it)
|
for (QVariantMap::ConstIterator it = data.constBegin(); it != cend; ++it)
|
||||||
m_settings->setValue(base + it.key(), it.value());
|
m_settings->setValue(base + it.key(), it.value());
|
||||||
@@ -209,79 +186,14 @@ void QbsManager::addProfileFromKit(const ProjectExplorer::Kit *k)
|
|||||||
QString::fromLatin1("qtc_") + k->fileSystemFriendlyName(), usedProfileNames);
|
QString::fromLatin1("qtc_") + k->fileSystemFriendlyName(), usedProfileNames);
|
||||||
setProfileForKit(name, k);
|
setProfileForKit(name, k);
|
||||||
|
|
||||||
QVariantMap data;
|
// set up properties:
|
||||||
QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(k);
|
QVariantMap data = m_defaultPropertyProvider->properties(k, QVariantMap());
|
||||||
if (qt) {
|
QList<PropertyProvider *> providerList = ExtensionSystem::PluginManager::getObjects<PropertyProvider>();
|
||||||
data.insert(QLatin1String(QTCORE_BINPATH), qt->binPath().toUserOutput());
|
foreach (PropertyProvider *provider, providerList) {
|
||||||
QStringList builds;
|
if (provider->canHandle(k))
|
||||||
if (qt->hasDebugBuild())
|
data = provider->properties(k, data);
|
||||||
builds << QLatin1String("debug");
|
|
||||||
if (qt->hasReleaseBuild())
|
|
||||||
builds << QLatin1String("release");
|
|
||||||
data.insert(QLatin1String(QTCORE_BUILDVARIANT), builds);
|
|
||||||
data.insert(QLatin1String(QTCORE_DOCPATH), qt->docsPath().toUserOutput());
|
|
||||||
data.insert(QLatin1String(QTCORE_INCPATH), qt->headerPath().toUserOutput());
|
|
||||||
data.insert(QLatin1String(QTCORE_LIBPATH), qt->libraryPath().toUserOutput());
|
|
||||||
Utils::FileName mkspecPath = qt->mkspecsPath();
|
|
||||||
mkspecPath.appendPath(qt->mkspec().toString());
|
|
||||||
data.insert(QLatin1String(QTCORE_MKSPEC), mkspecPath.toUserOutput());
|
|
||||||
data.insert(QLatin1String(QTCORE_NAMESPACE), qt->qtNamespace());
|
|
||||||
data.insert(QLatin1String(QTCORE_LIBINFIX), qt->qtLibInfix());
|
|
||||||
data.insert(QLatin1String(QTCORE_VERSION), qt->qtVersionString());
|
|
||||||
if (qt->isFrameworkBuild())
|
|
||||||
data.insert(QLatin1String(QTCORE_FRAMEWORKBUILD), true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ProjectExplorer::SysRootKitInformation::hasSysRoot(k))
|
|
||||||
data.insert(QLatin1String(QBS_SYSROOT), ProjectExplorer::SysRootKitInformation::sysRoot(k).toUserOutput());
|
|
||||||
|
|
||||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
|
|
||||||
if (tc) {
|
|
||||||
// FIXME/CLARIFY: How to pass the sysroot?
|
|
||||||
ProjectExplorer::Abi targetAbi = tc->targetAbi();
|
|
||||||
QString architecture = ProjectExplorer::Abi::toString(targetAbi.architecture());
|
|
||||||
if (targetAbi.wordWidth() == 64)
|
|
||||||
architecture.append(QLatin1String("_64"));
|
|
||||||
data.insert(QLatin1String(QBS_ARCHITECTURE), architecture);
|
|
||||||
|
|
||||||
if (targetAbi.endianness() == ProjectExplorer::Abi::BigEndian)
|
|
||||||
data.insert(QLatin1String(QBS_ENDIANNESS), QLatin1String("big"));
|
|
||||||
else
|
|
||||||
data.insert(QLatin1String(QBS_ENDIANNESS), QLatin1String("little"));
|
|
||||||
|
|
||||||
if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) {
|
|
||||||
data.insert(QLatin1String(QBS_TARGETOS), QLatin1String("windows"));
|
|
||||||
data.insert(QLatin1String(QBS_TOOLCHAIN),
|
|
||||||
targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor
|
|
||||||
? QStringList() << QLatin1String("mingw") << QLatin1String("gcc")
|
|
||||||
: QStringList() << QLatin1String("msvc"));
|
|
||||||
} else if (targetAbi.os() == ProjectExplorer::Abi::MacOS) {
|
|
||||||
data.insert(QLatin1String(QBS_TARGETOS), QStringList() << QLatin1String("osx")
|
|
||||||
<< QLatin1String("darwin") << QLatin1String("unix"));
|
|
||||||
if (tc->type() != QLatin1String("clang")) {
|
|
||||||
data.insert(QLatin1String(QBS_TOOLCHAIN), QLatin1String("gcc"));
|
|
||||||
} else {
|
|
||||||
data.insert(QLatin1String(QBS_TOOLCHAIN),
|
|
||||||
QStringList() << QLatin1String("clang")
|
|
||||||
<< QLatin1String("llvm")
|
|
||||||
<< QLatin1String("gcc"));
|
|
||||||
}
|
|
||||||
} else if (targetAbi.os() == ProjectExplorer::Abi::LinuxOS) {
|
|
||||||
data.insert(QLatin1String(QBS_TARGETOS), QStringList() << QLatin1String("linux")
|
|
||||||
<< QLatin1String("unix"));
|
|
||||||
if (tc->type() != QLatin1String("clang")) {
|
|
||||||
data.insert(QLatin1String(QBS_TOOLCHAIN), QLatin1String("gcc"));
|
|
||||||
} else {
|
|
||||||
data.insert(QLatin1String(QBS_TOOLCHAIN),
|
|
||||||
QStringList() << QLatin1String("clang")
|
|
||||||
<< QLatin1String("llvm")
|
|
||||||
<< QLatin1String("gcc"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Utils::FileName cxx = tc->compilerCommand();
|
|
||||||
data.insert(QLatin1String(CPP_TOOLCHAINPATH), cxx.toFileInfo().absolutePath());
|
|
||||||
data.insert(QLatin1String(CPP_COMPILERNAME), cxx.toFileInfo().fileName());
|
|
||||||
}
|
|
||||||
addProfile(name, data);
|
addProfile(name, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ class QbsProject;
|
|||||||
class QbsProjectManagerPlugin;
|
class QbsProjectManagerPlugin;
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|
||||||
|
class DefaultPropertyProvider;
|
||||||
|
|
||||||
class QbsManager : public ProjectExplorer::IProjectManager
|
class QbsManager : public ProjectExplorer::IProjectManager
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -76,7 +78,6 @@ private slots:
|
|||||||
void pushKitsToQbs();
|
void pushKitsToQbs();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void addProfile(const QString &name, const QVariantMap &data);
|
void addProfile(const QString &name, const QVariantMap &data);
|
||||||
void removeCreatorProfiles();
|
void removeCreatorProfiles();
|
||||||
void addProfileFromKit(const ProjectExplorer::Kit *k);
|
void addProfileFromKit(const ProjectExplorer::Kit *k);
|
||||||
@@ -85,6 +86,8 @@ private:
|
|||||||
Internal::QbsLogSink *m_logSink;
|
Internal::QbsLogSink *m_logSink;
|
||||||
static qbs::Settings *m_settings;
|
static qbs::Settings *m_settings;
|
||||||
static qbs::Preferences *m_preferences;
|
static qbs::Preferences *m_preferences;
|
||||||
|
|
||||||
|
DefaultPropertyProvider *m_defaultPropertyProvider;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QbsProjectManager
|
} // namespace QbsProjectManager
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ DEFINES += \
|
|||||||
QBSPROJECTMANAGER_LIBRARY
|
QBSPROJECTMANAGER_LIBRARY
|
||||||
|
|
||||||
HEADERS = \
|
HEADERS = \
|
||||||
|
defaultpropertyprovider.h \
|
||||||
|
propertyprovider.h \
|
||||||
qbsbuildconfiguration.h \
|
qbsbuildconfiguration.h \
|
||||||
qbsbuildconfigurationwidget.h \
|
qbsbuildconfigurationwidget.h \
|
||||||
qbsbuildstep.h \
|
qbsbuildstep.h \
|
||||||
@@ -34,6 +36,7 @@ HEADERS = \
|
|||||||
qbsstep.h
|
qbsstep.h
|
||||||
|
|
||||||
SOURCES = \
|
SOURCES = \
|
||||||
|
defaultpropertyprovider.cpp \
|
||||||
qbsbuildconfiguration.cpp \
|
qbsbuildconfiguration.cpp \
|
||||||
qbsbuildconfigurationwidget.cpp \
|
qbsbuildconfigurationwidget.cpp \
|
||||||
qbsbuildstep.cpp \
|
qbsbuildstep.cpp \
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ QtcPlugin {
|
|||||||
cpp.dynamicLibraries: base.concat(externalQbsDynamicLibraries)
|
cpp.dynamicLibraries: base.concat(externalQbsDynamicLibraries)
|
||||||
|
|
||||||
files: [
|
files: [
|
||||||
|
"propertyprovider.h",
|
||||||
"qbsbuildconfiguration.cpp",
|
"qbsbuildconfiguration.cpp",
|
||||||
"qbsbuildconfiguration.h",
|
"qbsbuildconfiguration.h",
|
||||||
"qbsbuildconfigurationwidget.cpp",
|
"qbsbuildconfigurationwidget.cpp",
|
||||||
|
|||||||
Reference in New Issue
Block a user