2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2009-11-23 12:11:48 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2009-11-23 12:11:48 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2009-11-23 12:11:48 +01: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
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2009-11-23 12:11:48 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2009-11-23 12:11:48 +01:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2009-11-23 12:11:48 +01:00
|
|
|
|
2013-10-16 12:10:22 +02:00
|
|
|
#include "qmakeprojectmanager_global.h"
|
2009-12-02 17:43:43 +01:00
|
|
|
|
2009-11-23 12:11:48 +01:00
|
|
|
#include <projectexplorer/buildconfiguration.h>
|
2011-08-18 16:46:44 +02:00
|
|
|
#include <qtsupport/baseqtversion.h>
|
2010-11-01 14:14:17 +01:00
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
namespace ProjectExplorer { class FileNode; }
|
2009-11-23 12:11:48 +01:00
|
|
|
|
2013-10-16 11:02:37 +02:00
|
|
|
namespace QmakeProjectManager {
|
2009-11-23 13:29:45 +01:00
|
|
|
|
2013-07-22 15:53:57 +02:00
|
|
|
class QmakeBuildInfo;
|
2009-11-25 18:50:20 +01:00
|
|
|
class QMakeStep;
|
2018-05-14 16:39:19 +02:00
|
|
|
class QmakeMakeStep;
|
2013-10-16 14:00:45 +02:00
|
|
|
class QmakeBuildConfigurationFactory;
|
2013-10-29 14:22:31 +01:00
|
|
|
class QmakeProFileNode;
|
2010-01-18 12:11:04 +01:00
|
|
|
|
2013-10-29 15:15:10 +01:00
|
|
|
namespace Internal { class QmakeProjectConfigWidget; }
|
2013-08-16 17:45:16 +02:00
|
|
|
|
2013-10-29 15:58:10 +01:00
|
|
|
class QMAKEPROJECTMANAGER_EXPORT QmakeBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
2009-11-23 12:11:48 +01:00
|
|
|
{
|
2009-11-25 18:49:59 +01:00
|
|
|
Q_OBJECT
|
2010-01-18 12:11:04 +01:00
|
|
|
|
2009-11-23 12:11:48 +01:00
|
|
|
public:
|
2018-05-04 16:52:21 +02:00
|
|
|
QmakeBuildConfiguration(ProjectExplorer::Target *target, Core::Id id);
|
2018-05-07 15:04:50 +02:00
|
|
|
~QmakeBuildConfiguration() override;
|
2009-11-26 14:43:27 +01:00
|
|
|
|
ProjectExplorer/all: Re-organize BuildSteps/{Deploy,Build}Config setup
This follow the rough pattern of recent *RunConfigurationFactory changes
for build and deploy configurations.
- Collapse the two lines of constructors similar to what
890c1906e6fb2ec did for RunConfigurations
* Deploy* was purely mechanical
* Build* ctors are split in connects() in the ctor body
to create "empty shell for clone" etc
and build step additions in initialize() functions which
are only used in the create() case.
-- Allows to collapse the shared 'ctor()' functions, too.
- Move FooBuildConfigurationFactory::create() implementations
to FooBuildConfiguration() constructor. That was a strange
and unneeded ping-pong between factories and objects, and
furthermore allows one level less of indirection (and for a
later, left out here, some reduction of the
FooBuildConfiguration interfaces that were only used to
accommodate the *Factory::create() functions.
- Most {Build,Deploy}Configuration{,Factory} classes had a canHandle(),
but there wasn't one in the base classses. Have one there.
- Most canHandle() functions were checking simple restrictions on
e.g. project or target types, specify those by setters in the
constructors instead and check them in the base canHandle()
- clone() is generally replaced by a creation of a "shell object"
and a fromMap(source->toMap()), implemented in the base, there
are two cases left for Android and Qbs that needed(?) some extra
polish
- generally use canHandle() in base implementation, instead
of doing that in all Derived::canFoo()
- as a result, canCreate/create/canClone/clone reimplementations
are not needed anymore, keep the base implementation for
now (could be inlined into their only users later), but
de-virtualize them.
- Combine Ios{Preset,DSym}BuildStepFactory. There was only one
'dsym' build step they could create.
- Split the 'mangled' id into the ProjectConfiguration subtype
specific constant identifier, and a QString extraId() bit.
Only maintain the mangled id in saved settings.
- Make ProjectConfiguration::m_id a constant member, adapt
all constructors of derived classe.
Not done in this patch:
- Finish possible cosmetic changes on top
- Add a way to specify restrictions to supported Qt versions
(used in Android/Ios), as the base implementation does not
depend on the qtsupport plugin
- Combine the QList<X> availableFoo() + createFoo(X) function
pairs to somthing like a direct
QList<struct { X; std::function<X()>; }> fooCreators()
to avoid e.g. the baseId.withSuffix() <-> id.suffixAfter(base)
pingpong
- Remove the *Factories from the global object pool
- Do something about priority(). Falling back to plain
qmake in android+qmake setup is not helpful.
Change-Id: I2be7d88d554c5aa8b7db8edf5b93278e1ae0112a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-11-29 12:28:40 +01:00
|
|
|
void initialize(const ProjectExplorer::BuildInfo *info) override;
|
2016-01-29 12:28:31 +01:00
|
|
|
ProjectExplorer::NamedWidget *createConfigWidget() override;
|
2013-08-16 17:10:45 +02:00
|
|
|
bool isShadowBuild() const;
|
2009-11-25 18:50:20 +01:00
|
|
|
|
2017-03-18 23:51:44 +02:00
|
|
|
void setSubNodeBuild(QmakeProFileNode *node);
|
|
|
|
|
QmakeProFileNode *subNodeBuild() const;
|
2010-01-13 18:00:02 +01:00
|
|
|
|
2012-05-04 16:25:41 +03:00
|
|
|
ProjectExplorer::FileNode *fileNodeBuild() const;
|
|
|
|
|
void setFileNodeBuild(ProjectExplorer::FileNode *node);
|
|
|
|
|
|
2011-05-20 21:40:53 +02:00
|
|
|
QtSupport::BaseQtVersion::QmakeBuildConfigs qmakeBuildConfiguration() const;
|
|
|
|
|
void setQMakeBuildConfiguration(QtSupport::BaseQtVersion::QmakeBuildConfigs config);
|
2014-10-22 09:16:55 +02:00
|
|
|
|
|
|
|
|
/// suffix should be unique
|
|
|
|
|
static QString shadowBuildDirectory(const QString &profilePath, const ProjectExplorer::Kit *k,
|
2015-10-22 17:26:33 +02:00
|
|
|
const QString &suffix, BuildConfiguration::BuildType type);
|
2010-09-01 12:33:53 +02:00
|
|
|
|
|
|
|
|
/// \internal for qmakestep
|
2010-01-12 17:20:15 +01:00
|
|
|
// used by qmake step to notify that the qmake args have changed
|
2010-03-10 16:55:37 +01:00
|
|
|
// not really nice, the build configuration should save the arguments
|
|
|
|
|
// since they are needed for reevaluation
|
2010-01-12 17:20:15 +01:00
|
|
|
void emitQMakeBuildConfigurationChanged();
|
2010-05-21 14:12:53 +02:00
|
|
|
|
2010-09-01 12:33:53 +02:00
|
|
|
QStringList configCommandLineArguments() const;
|
2009-11-25 18:50:20 +01:00
|
|
|
|
|
|
|
|
// Those functions are used in a few places.
|
2010-01-11 10:22:55 +01:00
|
|
|
// The drawback is that we shouldn't actually depend on them being always there
|
|
|
|
|
// That is generally the stuff that is asked should normally be transferred to
|
2013-10-29 17:37:39 +01:00
|
|
|
// QmakeProject *
|
|
|
|
|
// So that we can later enable people to build qmake the way they would like
|
2009-11-25 18:50:20 +01:00
|
|
|
QMakeStep *qmakeStep() const;
|
2018-05-14 16:39:19 +02:00
|
|
|
QmakeMakeStep *makeStep() const;
|
2009-11-25 18:50:20 +01:00
|
|
|
|
2010-10-05 17:38:45 +02:00
|
|
|
QString makefile() const;
|
2009-11-25 18:50:20 +01:00
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
enum MakefileState { MakefileMatches, MakefileForWrongProject, MakefileIncompatible, MakefileMissing };
|
2018-05-07 17:34:12 +02:00
|
|
|
MakefileState compareToImportFrom(const QString &makefile, QString *errorString = nullptr);
|
|
|
|
|
static Utils::FileName extractSpecFromArguments(
|
|
|
|
|
QString *arguments, const QString &directory, const QtSupport::BaseQtVersion *version,
|
|
|
|
|
QStringList *outArgs = nullptr);
|
2009-11-25 18:50:20 +01:00
|
|
|
|
2016-01-29 12:28:31 +01:00
|
|
|
QVariantMap toMap() const override;
|
2009-12-02 17:43:43 +01:00
|
|
|
|
2018-05-07 15:04:50 +02:00
|
|
|
bool isEnabled() const override;
|
|
|
|
|
QString disabledReason() const override;
|
2013-10-29 18:24:57 +01:00
|
|
|
/// \internal For QmakeProject, since that manages the parsing information
|
2011-01-19 15:46:01 +01:00
|
|
|
void setEnabled(bool enabled);
|
|
|
|
|
|
2016-01-29 12:28:31 +01:00
|
|
|
BuildType buildType() const override;
|
2011-03-03 16:12:00 +01:00
|
|
|
|
2017-10-17 12:27:37 +02:00
|
|
|
void addToEnvironment(Utils::Environment &env) const override;
|
2017-11-28 17:18:38 +01:00
|
|
|
static void setupBuildEnvironment(ProjectExplorer::Kit *k, Utils::Environment &env);
|
2017-10-17 12:27:37 +02:00
|
|
|
|
2012-07-17 15:56:43 +02:00
|
|
|
void emitProFileEvaluateNeeded();
|
2011-01-13 13:38:43 +01:00
|
|
|
|
2009-11-25 18:50:20 +01:00
|
|
|
signals:
|
2012-07-26 16:08:41 +02:00
|
|
|
/// emitted for setQMakeBuildConfig, not emitted for Qt version changes, even
|
2009-12-03 18:37:27 +01:00
|
|
|
/// if those change the qmakebuildconfig
|
|
|
|
|
void qmakeBuildConfigurationChanged();
|
2013-08-16 17:10:45 +02:00
|
|
|
void shadowBuildChanged();
|
2009-12-03 18:37:27 +01:00
|
|
|
|
2010-01-18 12:11:04 +01:00
|
|
|
protected:
|
2016-01-29 12:28:31 +01:00
|
|
|
bool fromMap(const QVariantMap &map) override;
|
2010-01-18 12:11:04 +01:00
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
private:
|
ProjectExplorer/all: Re-organize BuildSteps/{Deploy,Build}Config setup
This follow the rough pattern of recent *RunConfigurationFactory changes
for build and deploy configurations.
- Collapse the two lines of constructors similar to what
890c1906e6fb2ec did for RunConfigurations
* Deploy* was purely mechanical
* Build* ctors are split in connects() in the ctor body
to create "empty shell for clone" etc
and build step additions in initialize() functions which
are only used in the create() case.
-- Allows to collapse the shared 'ctor()' functions, too.
- Move FooBuildConfigurationFactory::create() implementations
to FooBuildConfiguration() constructor. That was a strange
and unneeded ping-pong between factories and objects, and
furthermore allows one level less of indirection (and for a
later, left out here, some reduction of the
FooBuildConfiguration interfaces that were only used to
accommodate the *Factory::create() functions.
- Most {Build,Deploy}Configuration{,Factory} classes had a canHandle(),
but there wasn't one in the base classses. Have one there.
- Most canHandle() functions were checking simple restrictions on
e.g. project or target types, specify those by setters in the
constructors instead and check them in the base canHandle()
- clone() is generally replaced by a creation of a "shell object"
and a fromMap(source->toMap()), implemented in the base, there
are two cases left for Android and Qbs that needed(?) some extra
polish
- generally use canHandle() in base implementation, instead
of doing that in all Derived::canFoo()
- as a result, canCreate/create/canClone/clone reimplementations
are not needed anymore, keep the base implementation for
now (could be inlined into their only users later), but
de-virtualize them.
- Combine Ios{Preset,DSym}BuildStepFactory. There was only one
'dsym' build step they could create.
- Split the 'mangled' id into the ProjectConfiguration subtype
specific constant identifier, and a QString extraId() bit.
Only maintain the mangled id in saved settings.
- Make ProjectConfiguration::m_id a constant member, adapt
all constructors of derived classe.
Not done in this patch:
- Finish possible cosmetic changes on top
- Add a way to specify restrictions to supported Qt versions
(used in Android/Ios), as the base implementation does not
depend on the qtsupport plugin
- Combine the QList<X> availableFoo() + createFoo(X) function
pairs to somthing like a direct
QList<struct { X; std::function<X()>; }> fooCreators()
to avoid e.g. the baseId.withSuffix() <-> id.suffixAfter(base)
pingpong
- Remove the *Factories from the global object pool
- Do something about priority(). Falling back to plain
qmake in android+qmake setup is not helpful.
Change-Id: I2be7d88d554c5aa8b7db8edf5b93278e1ae0112a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-11-29 12:28:40 +01:00
|
|
|
void kitChanged();
|
|
|
|
|
void toolChainUpdated(ProjectExplorer::ToolChain *tc);
|
|
|
|
|
void qtVersionsChanged(const QList<int> &, const QList<int> &, const QList<int> &changed);
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2012-10-18 15:35:10 +02:00
|
|
|
class LastKitState
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
LastKitState();
|
|
|
|
|
explicit LastKitState(ProjectExplorer::Kit *k);
|
2013-03-08 16:11:11 +01:00
|
|
|
bool operator ==(const LastKitState &other) const;
|
|
|
|
|
bool operator !=(const LastKitState &other) const;
|
2012-10-18 15:35:10 +02:00
|
|
|
private:
|
2016-11-29 15:26:48 +01:00
|
|
|
int m_qtVersion = -1;
|
2015-07-07 12:01:22 +02:00
|
|
|
QByteArray m_toolchain;
|
2012-10-18 15:35:10 +02:00
|
|
|
QString m_sysroot;
|
|
|
|
|
QString m_mkspec;
|
|
|
|
|
};
|
|
|
|
|
LastKitState m_lastKitState;
|
|
|
|
|
|
2015-06-18 15:14:06 +02:00
|
|
|
bool m_shadowBuild = true;
|
2016-11-02 12:10:18 +01:00
|
|
|
bool m_isEnabled = true;
|
2018-05-07 17:34:12 +02:00
|
|
|
QtSupport::BaseQtVersion::QmakeBuildConfigs m_qmakeBuildConfiguration = nullptr;
|
2017-03-18 23:51:44 +02:00
|
|
|
QmakeProFileNode *m_subNodeBuild = nullptr;
|
2015-06-18 15:14:06 +02:00
|
|
|
ProjectExplorer::FileNode *m_fileNodeBuild = nullptr;
|
2013-08-16 17:45:16 +02:00
|
|
|
|
2013-10-29 15:15:10 +01:00
|
|
|
friend class Internal::QmakeProjectConfigWidget;
|
2013-10-16 14:00:45 +02:00
|
|
|
friend class QmakeBuildConfigurationFactory;
|
2009-11-23 12:11:48 +01:00
|
|
|
};
|
|
|
|
|
|
2013-10-29 15:58:10 +01:00
|
|
|
class QMAKEPROJECTMANAGER_EXPORT QmakeBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory
|
2010-01-07 18:17:24 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
ProjectExplorer/all: Re-organize BuildSteps/{Deploy,Build}Config setup
This follow the rough pattern of recent *RunConfigurationFactory changes
for build and deploy configurations.
- Collapse the two lines of constructors similar to what
890c1906e6fb2ec did for RunConfigurations
* Deploy* was purely mechanical
* Build* ctors are split in connects() in the ctor body
to create "empty shell for clone" etc
and build step additions in initialize() functions which
are only used in the create() case.
-- Allows to collapse the shared 'ctor()' functions, too.
- Move FooBuildConfigurationFactory::create() implementations
to FooBuildConfiguration() constructor. That was a strange
and unneeded ping-pong between factories and objects, and
furthermore allows one level less of indirection (and for a
later, left out here, some reduction of the
FooBuildConfiguration interfaces that were only used to
accommodate the *Factory::create() functions.
- Most {Build,Deploy}Configuration{,Factory} classes had a canHandle(),
but there wasn't one in the base classses. Have one there.
- Most canHandle() functions were checking simple restrictions on
e.g. project or target types, specify those by setters in the
constructors instead and check them in the base canHandle()
- clone() is generally replaced by a creation of a "shell object"
and a fromMap(source->toMap()), implemented in the base, there
are two cases left for Android and Qbs that needed(?) some extra
polish
- generally use canHandle() in base implementation, instead
of doing that in all Derived::canFoo()
- as a result, canCreate/create/canClone/clone reimplementations
are not needed anymore, keep the base implementation for
now (could be inlined into their only users later), but
de-virtualize them.
- Combine Ios{Preset,DSym}BuildStepFactory. There was only one
'dsym' build step they could create.
- Split the 'mangled' id into the ProjectConfiguration subtype
specific constant identifier, and a QString extraId() bit.
Only maintain the mangled id in saved settings.
- Make ProjectConfiguration::m_id a constant member, adapt
all constructors of derived classe.
Not done in this patch:
- Finish possible cosmetic changes on top
- Add a way to specify restrictions to supported Qt versions
(used in Android/Ios), as the base implementation does not
depend on the qtsupport plugin
- Combine the QList<X> availableFoo() + createFoo(X) function
pairs to somthing like a direct
QList<struct { X; std::function<X()>; }> fooCreators()
to avoid e.g. the baseId.withSuffix() <-> id.suffixAfter(base)
pingpong
- Remove the *Factories from the global object pool
- Do something about priority(). Falling back to plain
qmake in android+qmake setup is not helpful.
Change-Id: I2be7d88d554c5aa8b7db8edf5b93278e1ae0112a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-11-29 12:28:40 +01:00
|
|
|
QmakeBuildConfigurationFactory();
|
2010-01-07 18:17:24 +01:00
|
|
|
|
2016-01-29 12:28:31 +01:00
|
|
|
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const override;
|
2013-08-13 10:52:57 +02:00
|
|
|
QList<ProjectExplorer::BuildInfo *> availableSetups(const ProjectExplorer::Kit *k,
|
2016-01-29 12:28:31 +01:00
|
|
|
const QString &projectPath) const override;
|
2016-05-24 23:21:57 +03:00
|
|
|
private:
|
2013-07-22 15:53:57 +02:00
|
|
|
QmakeBuildInfo *createBuildInfo(const ProjectExplorer::Kit *k, const QString &projectPath,
|
|
|
|
|
ProjectExplorer::BuildConfiguration::BuildType type) const;
|
2010-01-07 18:17:24 +01:00
|
|
|
};
|
|
|
|
|
|
2013-10-16 11:02:37 +02:00
|
|
|
} // namespace QmakeProjectManager
|