Files
qt-creator/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h

161 lines
5.9 KiB
C
Raw Normal View History

/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** 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 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.
**
** 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
**
****************************************************************************/
#pragma once
#include "qmakeprojectmanager_global.h"
#include <projectexplorer/projectconfigurationaspects.h>
#include <projectexplorer/buildconfiguration.h>
#include <qtsupport/baseqtversion.h>
namespace ProjectExplorer { class FileNode; }
namespace QmakeProjectManager {
class QMakeStep;
class QmakeBuildSystem;
class QmakeMakeStep;
class QmakeProFileNode;
class QMAKEPROJECTMANAGER_EXPORT QmakeBuildConfiguration : public ProjectExplorer::BuildConfiguration
{
Q_OBJECT
// used in DebuggerRunConfigurationAspect
Q_PROPERTY(bool linkQmlDebuggingLibrary READ linkQmlDebuggingLibrary NOTIFY qmlDebuggingChanged)
public:
QmakeBuildConfiguration(ProjectExplorer::Target *target, Core::Id id);
~QmakeBuildConfiguration() override;
2009-11-26 14:43:27 +01:00
ProjectExplorer::BuildSystem *buildSystem() const final;
void setSubNodeBuild(QmakeProFileNode *node);
QmakeProFileNode *subNodeBuild() const;
ProjectExplorer::FileNode *fileNodeBuild() const;
void setFileNodeBuild(ProjectExplorer::FileNode *node);
QtSupport::BaseQtVersion::QmakeBuildConfigs qmakeBuildConfiguration() const;
void setQMakeBuildConfiguration(QtSupport::BaseQtVersion::QmakeBuildConfigs config);
/// suffix should be unique
static Utils::FilePath shadowBuildDirectory(const Utils::FilePath &profilePath,
const ProjectExplorer::Kit *k,
const QString &suffix,
BuildConfiguration::BuildType type);
QStringList configCommandLineArguments() const;
// 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
// QmakeProject *
// So that we can later enable people to build qmake the way they would like
QMakeStep *qmakeStep() const;
QmakeMakeStep *makeStep() const;
QmakeBuildSystem *qmakeBuildSystem() const;
QString makefile() const;
enum MakefileState { MakefileMatches, MakefileForWrongProject, MakefileIncompatible, MakefileMissing };
MakefileState compareToImportFrom(const QString &makefile, QString *errorString = nullptr);
static QString extractSpecFromArguments(
QString *arguments, const QString &directory, const QtSupport::BaseQtVersion *version,
QStringList *outArgs = nullptr);
QVariantMap toMap() const override;
BuildType buildType() const override;
void addToEnvironment(Utils::Environment &env) const override;
static void setupBuildEnvironment(ProjectExplorer::Kit *k, Utils::Environment &env);
static QString unalignedBuildDirWarning();
static bool isBuildDirAtSafeLocation(const QString &sourceDir, const QString &buildDir);
bool isBuildDirAtSafeLocation() const;
ProjectExplorer::TriState separateDebugInfo() const;
void forceSeparateDebugInfo(bool sepDebugInfo);
ProjectExplorer::TriState qmlDebugging() const;
bool linkQmlDebuggingLibrary() const;
void forceQmlDebugging(bool enable);
ProjectExplorer::TriState useQtQuickCompiler() const;
void forceQtQuickCompiler(bool enable);
signals:
/// emitted for setQMakeBuildConfig, not emitted for Qt version changes, even
/// if those change the qmakebuildconfig
void qmakeBuildConfigurationChanged();
void separateDebugInfoChanged();
void qmlDebuggingChanged();
void useQtQuickCompilerChanged();
protected:
bool fromMap(const QVariantMap &map) override;
bool regenerateBuildFiles(ProjectExplorer::Node *node = nullptr) override;
private:
void restrictNextBuild(const ProjectExplorer::RunConfiguration *rc) override;
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);
void updateProblemLabel();
class LastKitState
{
public:
LastKitState();
explicit LastKitState(ProjectExplorer::Kit *k);
bool operator ==(const LastKitState &other) const;
bool operator !=(const LastKitState &other) const;
private:
int m_qtVersion = -1;
QByteArray m_toolchain;
QString m_sysroot;
QString m_mkspec;
};
LastKitState m_lastKitState;
QtSupport::BaseQtVersion::QmakeBuildConfigs m_qmakeBuildConfiguration;
QmakeProFileNode *m_subNodeBuild = nullptr;
ProjectExplorer::FileNode *m_fileNodeBuild = nullptr;
QmakeBuildSystem *m_buildSystem = nullptr;
};
class QMAKEPROJECTMANAGER_EXPORT QmakeBuildConfigurationFactory : public ProjectExplorer::BuildConfigurationFactory
{
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();
};
} // namespace QmakeProjectManager