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
|
|
|
|
2013-10-16 12:10:22 +02:00
|
|
|
#include "qmakebuildconfiguration.h"
|
2010-01-07 18:17:24 +01:00
|
|
|
|
2013-07-22 15:53:57 +02:00
|
|
|
#include "qmakebuildinfo.h"
|
2013-10-11 23:05:04 +08:00
|
|
|
#include "qmakekitinformation.h"
|
2013-10-16 12:10:22 +02:00
|
|
|
#include "qmakeproject.h"
|
|
|
|
|
#include "qmakeprojectconfigwidget.h"
|
|
|
|
|
#include "qmakeprojectmanagerconstants.h"
|
|
|
|
|
#include "qmakenodes.h"
|
2010-03-17 17:45:33 +01:00
|
|
|
#include "qmakestep.h"
|
2018-05-17 09:37:56 +02:00
|
|
|
#include "qmakemakestep.h"
|
2015-03-04 17:14:28 +01:00
|
|
|
#include "makefileparse.h"
|
2009-11-23 12:11:48 +01:00
|
|
|
|
2014-10-22 09:16:55 +02:00
|
|
|
#include <coreplugin/documentmanager.h>
|
2013-07-22 15:53:57 +02:00
|
|
|
#include <coreplugin/icore.h>
|
2014-10-22 09:16:55 +02:00
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
#include <projectexplorer/buildsteplist.h>
|
2014-10-22 09:16:55 +02:00
|
|
|
#include <projectexplorer/kit.h>
|
2010-07-16 14:00:41 +02:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2014-10-22 09:16:55 +02:00
|
|
|
#include <projectexplorer/projectmacroexpander.h>
|
2012-04-24 15:49:09 +02:00
|
|
|
#include <projectexplorer/target.h>
|
2011-05-30 16:45:32 +02:00
|
|
|
#include <projectexplorer/toolchain.h>
|
2012-10-18 15:35:10 +02:00
|
|
|
#include <projectexplorer/toolchainmanager.h>
|
2012-09-03 18:31:44 +02:00
|
|
|
#include <qtsupport/qtkitinformation.h>
|
2011-08-18 16:46:44 +02:00
|
|
|
#include <qtsupport/qtversionmanager.h>
|
2015-02-04 09:32:46 +01:00
|
|
|
#include <utils/mimetypes/mimedatabase.h>
|
2013-07-22 15:53:57 +02:00
|
|
|
#include <utils/qtcassert.h>
|
2014-10-22 09:16:55 +02:00
|
|
|
#include <utils/qtcprocess.h>
|
|
|
|
|
#include <utils/qtcassert.h>
|
2014-06-25 15:42:11 +02:00
|
|
|
#include <android/androidmanager.h>
|
2010-02-19 10:51:40 +01:00
|
|
|
|
2014-10-22 09:16:55 +02:00
|
|
|
#include <QDebug>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QInputDialog>
|
2015-03-04 17:14:28 +01:00
|
|
|
#include <QLoggingCategory>
|
2010-01-07 18:17:24 +01:00
|
|
|
|
2014-10-22 09:16:55 +02:00
|
|
|
#include <limits>
|
|
|
|
|
|
|
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
using namespace QtSupport;
|
|
|
|
|
using namespace Utils;
|
|
|
|
|
using namespace QmakeProjectManager::Internal;
|
|
|
|
|
|
2013-10-16 11:02:37 +02:00
|
|
|
namespace QmakeProjectManager {
|
2009-11-25 18:50:20 +01:00
|
|
|
|
2013-08-13 10:52:57 +02:00
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
// Helpers:
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
2015-10-22 17:26:33 +02:00
|
|
|
QString QmakeBuildConfiguration::shadowBuildDirectory(const QString &proFilePath, const Kit *k,
|
|
|
|
|
const QString &suffix,
|
|
|
|
|
BuildConfiguration::BuildType buildType)
|
2014-10-22 09:16:55 +02:00
|
|
|
{
|
|
|
|
|
if (proFilePath.isEmpty())
|
|
|
|
|
return QString();
|
|
|
|
|
|
|
|
|
|
const QString projectName = QFileInfo(proFilePath).completeBaseName();
|
2016-08-08 18:35:32 +02:00
|
|
|
ProjectMacroExpander expander(proFilePath, projectName, k, suffix, buildType);
|
2014-10-22 09:16:55 +02:00
|
|
|
QString projectDir = Project::projectDirectory(FileName::fromString(proFilePath)).toString();
|
|
|
|
|
QString buildPath = expander.expand(Core::DocumentManager::buildDirectory());
|
|
|
|
|
return FileUtils::resolvePath(projectDir, buildPath);
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-22 01:04:35 +01:00
|
|
|
static FileName defaultBuildDirectory(const QString &projectPath,
|
|
|
|
|
const Kit *k,
|
|
|
|
|
const QString &suffix,
|
|
|
|
|
BuildConfiguration::BuildType type)
|
2013-08-13 10:52:57 +02:00
|
|
|
{
|
2016-01-22 01:04:35 +01:00
|
|
|
return FileName::fromString(QmakeBuildConfiguration::shadowBuildDirectory(projectPath, k,
|
|
|
|
|
suffix, type));
|
2013-08-13 10:52:57 +02:00
|
|
|
}
|
|
|
|
|
|
2012-08-29 23:17:42 +02:00
|
|
|
const char USE_SHADOW_BUILD_KEY[] = "Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild";
|
|
|
|
|
const char BUILD_CONFIGURATION_KEY[] = "Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration";
|
2010-01-19 13:41:02 +01:00
|
|
|
|
2010-01-19 16:33:44 +01:00
|
|
|
enum { debug = 0 };
|
2009-11-23 12:11:48 +01:00
|
|
|
|
2018-05-04 16:52:21 +02:00
|
|
|
QmakeBuildConfiguration::QmakeBuildConfiguration(Target *target, Core::Id id)
|
|
|
|
|
: BuildConfiguration(target, id)
|
2009-11-23 12:11:48 +01:00
|
|
|
{
|
2016-12-05 09:37:40 +01:00
|
|
|
connect(this, &BuildConfiguration::buildDirectoryChanged,
|
|
|
|
|
this, &QmakeBuildConfiguration::emitProFileEvaluateNeeded);
|
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
|
|
|
connect(this, &BuildConfiguration::environmentChanged,
|
|
|
|
|
this, &QmakeBuildConfiguration::emitProFileEvaluateNeeded);
|
|
|
|
|
connect(target, &Target::kitChanged,
|
|
|
|
|
this, &QmakeBuildConfiguration::kitChanged);
|
|
|
|
|
MacroExpander *expander = macroExpander();
|
|
|
|
|
expander->registerVariable("Qmake:Makefile", "Qmake makefile", [this]() -> QString {
|
|
|
|
|
const QString file = makefile();
|
|
|
|
|
if (!file.isEmpty())
|
|
|
|
|
return file;
|
|
|
|
|
return QLatin1String("Makefile");
|
|
|
|
|
});
|
|
|
|
|
connect(ToolChainManager::instance(), &ToolChainManager::toolChainUpdated,
|
|
|
|
|
this, &QmakeBuildConfiguration::toolChainUpdated);
|
|
|
|
|
connect(QtVersionManager::instance(), &QtVersionManager::qtVersionsChanged,
|
|
|
|
|
this, &QmakeBuildConfiguration::qtVersionsChanged);
|
2009-11-23 12:11:48 +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 QmakeBuildConfiguration::initialize(const BuildInfo *info)
|
2009-12-08 12:21:11 +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
|
|
|
BuildConfiguration::initialize(info);
|
2009-12-08 12:21:11 +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
|
|
|
BuildStepList *buildSteps = stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
|
|
|
|
auto qmakeStep = new QMakeStep(buildSteps);
|
|
|
|
|
buildSteps->appendStep(qmakeStep);
|
2018-05-14 16:39:19 +02:00
|
|
|
buildSteps->appendStep(new QmakeMakeStep(buildSteps));
|
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
|
|
|
|
|
|
|
|
BuildStepList *cleanSteps = stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
|
2018-05-14 16:39:19 +02:00
|
|
|
cleanSteps->appendStep(new QmakeMakeStep(cleanSteps));
|
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
|
|
|
|
|
|
|
|
const QmakeBuildInfo *qmakeInfo = static_cast<const QmakeBuildInfo *>(info);
|
|
|
|
|
BaseQtVersion *version = QtKitInformation::qtVersion(target()->kit());
|
|
|
|
|
|
|
|
|
|
BaseQtVersion::QmakeBuildConfigs config = version->defaultBuildConfig();
|
|
|
|
|
if (qmakeInfo->buildType == BuildConfiguration::Debug)
|
|
|
|
|
config |= BaseQtVersion::DebugBuild;
|
|
|
|
|
else
|
|
|
|
|
config &= ~BaseQtVersion::DebugBuild;
|
|
|
|
|
|
|
|
|
|
QString additionalArguments = qmakeInfo->additionalArguments;
|
|
|
|
|
if (!additionalArguments.isEmpty())
|
|
|
|
|
qmakeStep->setUserArguments(additionalArguments);
|
|
|
|
|
qmakeStep->setLinkQmlDebuggingLibrary(qmakeInfo->config.linkQmlDebuggingQQ2);
|
|
|
|
|
qmakeStep->setSeparateDebugInfo(qmakeInfo->config.separateDebugInfo);
|
|
|
|
|
qmakeStep->setUseQtQuickCompiler(qmakeInfo->config.useQtQuickCompiler);
|
|
|
|
|
|
|
|
|
|
setQMakeBuildConfiguration(config);
|
|
|
|
|
|
|
|
|
|
FileName directory = qmakeInfo->buildDirectory;
|
|
|
|
|
if (directory.isEmpty()) {
|
|
|
|
|
directory = defaultBuildDirectory(target()->project()->projectFilePath().toString(),
|
|
|
|
|
target()->kit(), qmakeInfo->displayName, buildType());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setBuildDirectory(directory);
|
|
|
|
|
updateCacheAndEmitEnvironmentChanged();
|
2009-11-23 12:11:48 +01:00
|
|
|
}
|
|
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
QmakeBuildConfiguration::~QmakeBuildConfiguration()
|
2009-11-23 12:11:48 +01:00
|
|
|
{
|
2010-01-18 12:11:04 +01:00
|
|
|
}
|
2009-11-23 12:11:48 +01:00
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
QVariantMap QmakeBuildConfiguration::toMap() const
|
2010-01-18 12:11:04 +01:00
|
|
|
{
|
|
|
|
|
QVariantMap map(BuildConfiguration::toMap());
|
|
|
|
|
map.insert(QLatin1String(USE_SHADOW_BUILD_KEY), m_shadowBuild);
|
|
|
|
|
map.insert(QLatin1String(BUILD_CONFIGURATION_KEY), int(m_qmakeBuildConfiguration));
|
|
|
|
|
return map;
|
2009-11-23 12:11:48 +01:00
|
|
|
}
|
2009-11-25 18:50:20 +01:00
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
bool QmakeBuildConfiguration::fromMap(const QVariantMap &map)
|
2009-12-08 12:21:11 +01:00
|
|
|
{
|
2010-02-08 15:50:06 +01:00
|
|
|
if (!BuildConfiguration::fromMap(map))
|
|
|
|
|
return false;
|
|
|
|
|
|
2010-03-25 11:55:29 +01:00
|
|
|
m_shadowBuild = map.value(QLatin1String(USE_SHADOW_BUILD_KEY), true).toBool();
|
2012-08-29 23:17:42 +02:00
|
|
|
m_qmakeBuildConfiguration = BaseQtVersion::QmakeBuildConfigs(map.value(QLatin1String(BUILD_CONFIGURATION_KEY)).toInt());
|
2011-03-23 13:32:42 +01:00
|
|
|
|
2012-10-18 15:35:10 +02:00
|
|
|
m_lastKitState = LastKitState(target()->kit());
|
2010-02-08 15:50:06 +01:00
|
|
|
return true;
|
2009-12-08 12:21:11 +01:00
|
|
|
}
|
|
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
void QmakeBuildConfiguration::kitChanged()
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
2012-10-18 15:35:10 +02:00
|
|
|
LastKitState newState = LastKitState(target()->kit());
|
|
|
|
|
if (newState != m_lastKitState) {
|
|
|
|
|
// This only checks if the ids have changed!
|
2013-10-16 14:00:45 +02:00
|
|
|
// For that reason the QmakeBuildConfiguration is also connected
|
2012-10-18 15:35:10 +02:00
|
|
|
// to the toolchain and qtversion managers
|
|
|
|
|
emitProFileEvaluateNeeded();
|
|
|
|
|
m_lastKitState = newState;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-22 01:04:35 +01:00
|
|
|
void QmakeBuildConfiguration::toolChainUpdated(ToolChain *tc)
|
2012-10-18 15:35:10 +02:00
|
|
|
{
|
2016-12-16 00:43:14 +01:00
|
|
|
if (ToolChainKitInformation::toolChain(target()->kit(), ProjectExplorer::Constants::CXX_LANGUAGE_ID) == tc)
|
2012-10-18 15:35:10 +02:00
|
|
|
emitProFileEvaluateNeeded();
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
void QmakeBuildConfiguration::qtVersionsChanged(const QList<int> &,const QList<int> &, const QList<int> &changed)
|
2012-10-18 15:35:10 +02:00
|
|
|
{
|
|
|
|
|
if (changed.contains(QtKitInformation::qtVersionId(target()->kit())))
|
|
|
|
|
emitProFileEvaluateNeeded();
|
2009-12-03 18:37:27 +01:00
|
|
|
}
|
|
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
NamedWidget *QmakeBuildConfiguration::createConfigWidget()
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
2013-10-29 15:15:10 +01:00
|
|
|
return new QmakeProjectConfigWidget(this);
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
2010-01-13 18:00:02 +01:00
|
|
|
/// If only a sub tree should be build this function returns which sub node
|
|
|
|
|
/// should be build
|
2013-10-16 14:00:45 +02:00
|
|
|
/// \see QMakeBuildConfiguration::setSubNodeBuild
|
2013-10-29 14:22:31 +01:00
|
|
|
QmakeProFileNode *QmakeBuildConfiguration::subNodeBuild() const
|
2010-01-13 18:00:02 +01:00
|
|
|
{
|
|
|
|
|
return m_subNodeBuild;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// A sub node build on builds a sub node of the project
|
|
|
|
|
/// That is triggered by a right click in the project explorer tree
|
|
|
|
|
/// The sub node to be build is set via this function immediately before
|
|
|
|
|
/// calling BuildManager::buildProject( BuildConfiguration * )
|
|
|
|
|
/// and reset immediately afterwards
|
|
|
|
|
/// That is m_subNodesBuild is set only temporarly
|
2013-10-29 14:22:31 +01:00
|
|
|
void QmakeBuildConfiguration::setSubNodeBuild(QmakeProFileNode *node)
|
2010-01-13 18:00:02 +01:00
|
|
|
{
|
|
|
|
|
m_subNodeBuild = node;
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
FileNode *QmakeBuildConfiguration::fileNodeBuild() const
|
2012-05-04 16:25:41 +03:00
|
|
|
{
|
|
|
|
|
return m_fileNodeBuild;
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
void QmakeBuildConfiguration::setFileNodeBuild(FileNode *node)
|
2012-05-04 16:25:41 +03:00
|
|
|
{
|
|
|
|
|
m_fileNodeBuild = node;
|
|
|
|
|
}
|
|
|
|
|
|
2009-12-07 15:55:00 +01:00
|
|
|
/// returns whether this is a shadow build configuration or not
|
|
|
|
|
/// note, even if shadowBuild() returns true, it might be using the
|
2010-01-11 10:22:55 +01:00
|
|
|
/// source directory as the shadow build directory, thus it
|
|
|
|
|
/// still is a in-source build
|
2013-10-16 14:00:45 +02:00
|
|
|
bool QmakeBuildConfiguration::isShadowBuild() const
|
2009-12-07 15:55:00 +01:00
|
|
|
{
|
2014-05-02 12:53:36 +02:00
|
|
|
return buildDirectory() != target()->project()->projectDirectory();
|
2009-12-07 15:55:00 +01:00
|
|
|
}
|
|
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
QString QmakeBuildConfiguration::makefile() const
|
2010-10-05 17:38:45 +02:00
|
|
|
{
|
2017-02-10 11:16:18 +01:00
|
|
|
return static_cast<QmakeProject *>(target()->project())->rootProFile()->makefile();
|
2009-11-25 18:50:20 +01:00
|
|
|
}
|
|
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
BaseQtVersion::QmakeBuildConfigs QmakeBuildConfiguration::qmakeBuildConfiguration() const
|
2009-12-03 18:37:27 +01:00
|
|
|
{
|
2009-12-08 12:21:11 +01:00
|
|
|
return m_qmakeBuildConfiguration;
|
2009-12-03 18:37:27 +01:00
|
|
|
}
|
|
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
void QmakeBuildConfiguration::setQMakeBuildConfiguration(BaseQtVersion::QmakeBuildConfigs config)
|
2009-12-03 18:37:27 +01:00
|
|
|
{
|
2009-12-08 12:21:11 +01:00
|
|
|
if (m_qmakeBuildConfiguration == config)
|
2009-12-03 18:37:27 +01:00
|
|
|
return;
|
2009-12-08 12:21:11 +01:00
|
|
|
m_qmakeBuildConfiguration = config;
|
2010-03-10 16:55:37 +01:00
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
emit qmakeBuildConfigurationChanged();
|
2012-07-17 15:56:43 +02:00
|
|
|
emitProFileEvaluateNeeded();
|
2014-06-19 15:29:11 +02:00
|
|
|
emit buildTypeChanged();
|
2009-12-03 18:37:27 +01:00
|
|
|
}
|
|
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
void QmakeBuildConfiguration::emitProFileEvaluateNeeded()
|
2010-09-01 12:33:53 +02:00
|
|
|
{
|
2012-07-17 15:56:43 +02:00
|
|
|
Target *t = target();
|
|
|
|
|
Project *p = t->project();
|
|
|
|
|
if (t->activeBuildConfiguration() == this && p->activeTarget() == t)
|
2013-10-29 14:22:31 +01:00
|
|
|
static_cast<QmakeProject *>(p)->scheduleAsyncUpdate();
|
2010-09-01 12:33:53 +02:00
|
|
|
}
|
|
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
void QmakeBuildConfiguration::emitQMakeBuildConfigurationChanged()
|
2010-01-12 17:20:15 +01:00
|
|
|
{
|
|
|
|
|
emit qmakeBuildConfigurationChanged();
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
QStringList QmakeBuildConfiguration::configCommandLineArguments() const
|
2009-12-03 18:37:27 +01:00
|
|
|
{
|
2010-09-01 12:33:53 +02:00
|
|
|
QStringList result;
|
2012-09-04 18:04:16 +02:00
|
|
|
BaseQtVersion *version = QtKitInformation::qtVersion(target()->kit());
|
2012-08-29 23:17:42 +02:00
|
|
|
BaseQtVersion::QmakeBuildConfigs defaultBuildConfiguration =
|
2013-09-26 18:38:44 +02:00
|
|
|
version ? version->defaultBuildConfig() : BaseQtVersion::QmakeBuildConfigs(BaseQtVersion::DebugBuild | BaseQtVersion::BuildAll);
|
2012-08-29 23:17:42 +02:00
|
|
|
BaseQtVersion::QmakeBuildConfigs userBuildConfiguration = m_qmakeBuildConfiguration;
|
|
|
|
|
if ((defaultBuildConfiguration & BaseQtVersion::BuildAll) && !(userBuildConfiguration & BaseQtVersion::BuildAll))
|
2012-01-13 14:20:45 +01:00
|
|
|
result << QLatin1String("CONFIG-=debug_and_release");
|
2010-09-01 12:33:53 +02:00
|
|
|
|
2012-08-29 23:17:42 +02:00
|
|
|
if (!(defaultBuildConfiguration & BaseQtVersion::BuildAll) && (userBuildConfiguration & BaseQtVersion::BuildAll))
|
2012-01-13 14:20:45 +01:00
|
|
|
result << QLatin1String("CONFIG+=debug_and_release");
|
2012-08-29 23:17:42 +02:00
|
|
|
if ((defaultBuildConfiguration & BaseQtVersion::DebugBuild) && !(userBuildConfiguration & BaseQtVersion::DebugBuild))
|
2012-01-13 14:20:45 +01:00
|
|
|
result << QLatin1String("CONFIG+=release");
|
2012-08-29 23:17:42 +02:00
|
|
|
if (!(defaultBuildConfiguration & BaseQtVersion::DebugBuild) && (userBuildConfiguration & BaseQtVersion::DebugBuild))
|
2012-01-13 14:20:45 +01:00
|
|
|
result << QLatin1String("CONFIG+=debug");
|
2010-09-01 12:33:53 +02:00
|
|
|
return result;
|
2009-12-03 18:37:27 +01:00
|
|
|
}
|
2009-11-25 18:50:20 +01:00
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
QMakeStep *QmakeBuildConfiguration::qmakeStep() const
|
2009-11-25 18:50:20 +01:00
|
|
|
{
|
|
|
|
|
QMakeStep *qs = 0;
|
2012-03-15 17:17:40 +01:00
|
|
|
BuildStepList *bsl = stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD));
|
2010-07-16 14:00:41 +02:00
|
|
|
Q_ASSERT(bsl);
|
|
|
|
|
for (int i = 0; i < bsl->count(); ++i)
|
|
|
|
|
if ((qs = qobject_cast<QMakeStep *>(bsl->at(i))) != 0)
|
2009-11-25 18:50:20 +01:00
|
|
|
return qs;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-14 16:39:19 +02:00
|
|
|
QmakeMakeStep *QmakeBuildConfiguration::makeStep() const
|
2009-11-25 18:50:20 +01:00
|
|
|
{
|
2018-05-14 16:39:19 +02:00
|
|
|
QmakeMakeStep *ms = 0;
|
2012-03-15 17:17:40 +01:00
|
|
|
BuildStepList *bsl = stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD));
|
2010-07-16 14:00:41 +02:00
|
|
|
Q_ASSERT(bsl);
|
|
|
|
|
for (int i = 0; i < bsl->count(); ++i)
|
2018-05-14 16:39:19 +02:00
|
|
|
if ((ms = qobject_cast<QmakeMakeStep *>(bsl->at(i))) != 0)
|
2010-07-16 14:00:41 +02:00
|
|
|
return ms;
|
2009-11-25 18:50:20 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-29 23:17:42 +02:00
|
|
|
// Returns true if both are equal.
|
2015-07-24 15:21:00 +02:00
|
|
|
QmakeBuildConfiguration::MakefileState QmakeBuildConfiguration::compareToImportFrom(const QString &makefile, QString *errorString)
|
2009-11-25 18:50:20 +01:00
|
|
|
{
|
2015-03-04 17:14:28 +01:00
|
|
|
const QLoggingCategory &logs = MakeFileParse::logging();
|
|
|
|
|
qCDebug(logs) << "QMakeBuildConfiguration::compareToImport";
|
|
|
|
|
|
2009-11-25 18:50:20 +01:00
|
|
|
QMakeStep *qs = qmakeStep();
|
2015-03-04 17:14:28 +01:00
|
|
|
MakeFileParse parse(makefile);
|
|
|
|
|
|
|
|
|
|
if (parse.makeFileState() == MakeFileParse::MakefileMissing) {
|
|
|
|
|
qCDebug(logs) << "**Makefile missing";
|
|
|
|
|
return MakefileMissing;
|
|
|
|
|
}
|
|
|
|
|
if (parse.makeFileState() == MakeFileParse::CouldNotParse) {
|
|
|
|
|
qCDebug(logs) << "**Makefile incompatible";
|
2015-07-24 15:21:00 +02:00
|
|
|
if (errorString)
|
|
|
|
|
*errorString = tr("Could not parse Makefile.");
|
2015-03-04 17:14:28 +01:00
|
|
|
return MakefileIncompatible;
|
2009-11-25 18:50:20 +01:00
|
|
|
}
|
2009-11-26 16:49:45 +01:00
|
|
|
|
2015-03-04 17:14:28 +01:00
|
|
|
if (!qs) {
|
|
|
|
|
qCDebug(logs) << "**No qmake step";
|
|
|
|
|
return MakefileMissing;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BaseQtVersion *version = QtKitInformation::qtVersion(target()->kit());
|
|
|
|
|
if (!version) {
|
|
|
|
|
qCDebug(logs) << "**No qt version in kit";
|
|
|
|
|
return MakefileForWrongProject;
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-10 08:59:57 +03:00
|
|
|
const Utils::FileName projectPath =
|
|
|
|
|
m_subNodeBuild ? m_subNodeBuild->filePath() : qs->project()->projectFilePath();
|
|
|
|
|
if (parse.srcProFile() != projectPath.toString()) {
|
2015-03-04 17:14:28 +01:00
|
|
|
qCDebug(logs) << "**Different profile used to generate the Makefile:"
|
2018-06-10 08:59:57 +03:00
|
|
|
<< parse.srcProFile() << " expected profile:" << projectPath;
|
2015-07-24 15:21:00 +02:00
|
|
|
if (errorString)
|
|
|
|
|
*errorString = tr("The Makefile is for a different project.");
|
2015-03-04 17:14:28 +01:00
|
|
|
return MakefileIncompatible;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (version->qmakeCommand() != parse.qmakePath()) {
|
|
|
|
|
qCDebug(logs) << "**Different Qt versions, buildconfiguration:" << version->qmakeCommand().toString()
|
|
|
|
|
<< " Makefile:"<< parse.qmakePath().toString();
|
|
|
|
|
return MakefileForWrongProject;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// same qtversion
|
|
|
|
|
BaseQtVersion::QmakeBuildConfigs buildConfig = parse.effectiveBuildConfig(version->defaultBuildConfig());
|
|
|
|
|
if (qmakeBuildConfiguration() != buildConfig) {
|
|
|
|
|
qCDebug(logs) << "**Different qmake buildconfigurations buildconfiguration:"
|
|
|
|
|
<< qmakeBuildConfiguration() << " Makefile:" << buildConfig;
|
2015-07-24 15:21:00 +02:00
|
|
|
if (errorString)
|
|
|
|
|
*errorString = tr("The build type has changed.");
|
2015-03-04 17:14:28 +01:00
|
|
|
return MakefileIncompatible;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// The qmake Build Configuration are the same,
|
|
|
|
|
// now compare arguments lists
|
|
|
|
|
// we have to compare without the spec/platform cmd argument
|
|
|
|
|
// and compare that on its own
|
|
|
|
|
QString workingDirectory = QFileInfo(makefile).absolutePath();
|
|
|
|
|
QStringList actualArgs;
|
2018-06-07 14:41:34 +03:00
|
|
|
QString userArgs = macroExpander()->expandProcessArgs(qs->userArguments());
|
2015-03-04 17:14:28 +01:00
|
|
|
// This copies the settings from userArgs to actualArgs (minus some we
|
|
|
|
|
// are not interested in), splitting them up into individual strings:
|
|
|
|
|
extractSpecFromArguments(&userArgs, workingDirectory, version, &actualArgs);
|
|
|
|
|
FileName actualSpec = qs->mkspec();
|
|
|
|
|
|
|
|
|
|
QString qmakeArgs = parse.unparsedArguments();
|
|
|
|
|
QStringList parsedArgs;
|
|
|
|
|
FileName parsedSpec = extractSpecFromArguments(&qmakeArgs, workingDirectory, version, &parsedArgs);
|
|
|
|
|
|
|
|
|
|
qCDebug(logs) << " Actual args:" << actualArgs;
|
|
|
|
|
qCDebug(logs) << " Parsed args:" << parsedArgs;
|
|
|
|
|
qCDebug(logs) << " Actual spec:" << actualSpec.toString();
|
|
|
|
|
qCDebug(logs) << " Parsed spec:" << parsedSpec.toString();
|
|
|
|
|
qCDebug(logs) << " Actual config:" << qs->deducedArguments();
|
|
|
|
|
qCDebug(logs) << " Parsed config:" << parse.config();
|
|
|
|
|
|
|
|
|
|
// Comparing the sorted list is obviously wrong
|
|
|
|
|
// Though haven written a more complete version
|
|
|
|
|
// that managed had around 200 lines and yet faild
|
|
|
|
|
// to be actually foolproof at all, I think it's
|
|
|
|
|
// not feasible without actually taking the qmake
|
|
|
|
|
// command line parsing code
|
|
|
|
|
|
|
|
|
|
// Things, sorting gets wrong:
|
|
|
|
|
// parameters to positional parameters matter
|
|
|
|
|
// e.g. -o -spec is different from -spec -o
|
|
|
|
|
// -o 1 -spec 2 is diffrent from -spec 1 -o 2
|
|
|
|
|
// variable assignment order matters
|
|
|
|
|
// variable assignment vs -after
|
|
|
|
|
// -norecursive vs. recursive
|
|
|
|
|
actualArgs.sort();
|
|
|
|
|
parsedArgs.sort();
|
|
|
|
|
if (actualArgs != parsedArgs) {
|
2015-07-24 15:21:00 +02:00
|
|
|
qCDebug(logs) << "**Mismatched args";
|
|
|
|
|
if (errorString)
|
|
|
|
|
*errorString = tr("The qmake arguments have changed.");
|
2015-03-04 17:14:28 +01:00
|
|
|
return MakefileIncompatible;
|
2011-09-01 16:16:59 +02:00
|
|
|
}
|
2015-03-04 17:14:28 +01:00
|
|
|
|
|
|
|
|
if (parse.config() != qs->deducedArguments()) {
|
|
|
|
|
qCDebug(logs) << "**Mismatched config";
|
2015-07-24 15:21:00 +02:00
|
|
|
if (errorString)
|
|
|
|
|
*errorString = tr("The qmake arguments have changed.");
|
2015-03-04 17:14:28 +01:00
|
|
|
return MakefileIncompatible;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Specs match exactly
|
|
|
|
|
if (actualSpec == parsedSpec) {
|
|
|
|
|
qCDebug(logs) << "**Matched specs (1)";
|
|
|
|
|
return MakefileMatches;
|
|
|
|
|
}
|
|
|
|
|
// Actual spec is the default one
|
|
|
|
|
// qDebug() << "AS vs VS" << actualSpec << version->mkspec();
|
|
|
|
|
if ((actualSpec == version->mkspec() || actualSpec == FileName::fromLatin1("default"))
|
|
|
|
|
&& (parsedSpec == version->mkspec() || parsedSpec == FileName::fromLatin1("default") || parsedSpec.isEmpty())) {
|
|
|
|
|
qCDebug(logs) << "**Matched specs (2)";
|
|
|
|
|
return MakefileMatches;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qCDebug(logs) << "**Incompatible specs";
|
2015-07-24 15:21:00 +02:00
|
|
|
if (errorString)
|
|
|
|
|
*errorString = tr("The mkspec has changed.");
|
2015-03-04 17:14:28 +01:00
|
|
|
return MakefileIncompatible;
|
2010-08-30 13:24:34 +02:00
|
|
|
}
|
|
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
FileName QmakeBuildConfiguration::extractSpecFromArguments(QString *args,
|
2012-08-29 23:17:42 +02:00
|
|
|
const QString &directory, const BaseQtVersion *version,
|
|
|
|
|
QStringList *outArgs)
|
2009-11-26 16:49:45 +01:00
|
|
|
{
|
2012-08-29 23:17:42 +02:00
|
|
|
FileName parsedSpec;
|
2010-10-19 11:14:03 +02:00
|
|
|
|
2009-11-26 16:49:45 +01:00
|
|
|
bool ignoreNext = false;
|
2010-10-19 11:14:03 +02:00
|
|
|
bool nextIsSpec = false;
|
2012-08-29 23:17:42 +02:00
|
|
|
for (QtcProcess::ArgIterator ait(args); ait.next(); ) {
|
2009-11-26 16:49:45 +01:00
|
|
|
if (ignoreNext) {
|
|
|
|
|
ignoreNext = false;
|
2010-10-19 11:14:03 +02:00
|
|
|
ait.deleteArg();
|
|
|
|
|
} else if (nextIsSpec) {
|
|
|
|
|
nextIsSpec = false;
|
2012-08-29 23:17:42 +02:00
|
|
|
parsedSpec = FileName::fromUserInput(ait.value());
|
2010-10-19 11:14:03 +02:00
|
|
|
ait.deleteArg();
|
|
|
|
|
} else if (ait.value() == QLatin1String("-spec") || ait.value() == QLatin1String("-platform")) {
|
|
|
|
|
nextIsSpec = true;
|
|
|
|
|
ait.deleteArg();
|
|
|
|
|
} else if (ait.value() == QLatin1String("-cache")) {
|
|
|
|
|
// We ignore -cache, because qmake contained a bug that it didn't
|
|
|
|
|
// mention the -cache in the Makefile.
|
|
|
|
|
// That means changing the -cache option in the additional arguments
|
|
|
|
|
// does not automatically rerun qmake. Alas, we could try more
|
|
|
|
|
// intelligent matching for -cache, but i guess people rarely
|
|
|
|
|
// do use that.
|
2009-11-26 16:49:45 +01:00
|
|
|
ignoreNext = true;
|
2010-10-19 11:14:03 +02:00
|
|
|
ait.deleteArg();
|
|
|
|
|
} else if (outArgs && ait.isSimple()) {
|
|
|
|
|
outArgs->append(ait.value());
|
2009-11-26 16:49:45 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-19 11:14:03 +02:00
|
|
|
if (parsedSpec.isEmpty())
|
2012-08-29 23:17:42 +02:00
|
|
|
return FileName();
|
2009-11-26 16:49:45 +01:00
|
|
|
|
2012-08-29 23:17:42 +02:00
|
|
|
FileName baseMkspecDir = FileName::fromUserInput(
|
2012-07-06 13:29:45 +02:00
|
|
|
version->qmakeProperty("QT_HOST_DATA") + QLatin1String("/mkspecs"));
|
2016-01-22 01:04:35 +01:00
|
|
|
baseMkspecDir = FileName::fromString(baseMkspecDir.toFileInfo().canonicalFilePath());
|
2009-11-26 16:49:45 +01:00
|
|
|
|
|
|
|
|
// if the path is relative it can be
|
|
|
|
|
// relative to the working directory (as found in the Makefiles)
|
|
|
|
|
// or relatively to the mkspec directory
|
|
|
|
|
// if it is the former we need to get the canonical form
|
|
|
|
|
// for the other one we don't need to do anything
|
2011-11-25 13:19:58 +01:00
|
|
|
if (parsedSpec.toFileInfo().isRelative()) {
|
2014-10-24 10:28:28 +02:00
|
|
|
if (QFileInfo::exists(directory + QLatin1Char('/') + parsedSpec.toString()))
|
2012-08-29 23:17:42 +02:00
|
|
|
parsedSpec = FileName::fromUserInput(directory + QLatin1Char('/') + parsedSpec.toString());
|
Remove braces for single lines of conditions
#!/usr/bin/env ruby
Dir.glob('**/*.cpp') { |file|
# skip ast (excluding paste, astpath, and canv'ast'imer)
next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
s = File.read(file)
next if s.include?('qlalr')
orig = s.dup
s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
res = $&
if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
res
else
res.gsub!('} else', 'else')
res.gsub!(/\n +} *\n/m, "\n")
res.gsub(/ *{$/, '')
end
}
s.gsub!(/ *$/, '')
File.open(file, 'wb').write(s) if s != orig
}
Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
Reviewed-by: hjk <qthjk@ovi.com>
2013-01-08 03:32:53 +02:00
|
|
|
else
|
2012-08-29 23:17:42 +02:00
|
|
|
parsedSpec = FileName::fromUserInput(baseMkspecDir.toString() + QLatin1Char('/') + parsedSpec.toString());
|
2009-11-26 16:49:45 +01:00
|
|
|
}
|
|
|
|
|
|
2011-11-25 13:19:58 +01:00
|
|
|
QFileInfo f2 = parsedSpec.toFileInfo();
|
2009-11-26 16:49:45 +01:00
|
|
|
while (f2.isSymLink()) {
|
2012-08-29 23:17:42 +02:00
|
|
|
parsedSpec = FileName::fromString(f2.symLinkTarget());
|
2011-11-25 13:19:58 +01:00
|
|
|
f2.setFile(parsedSpec.toString());
|
2009-11-26 16:49:45 +01:00
|
|
|
}
|
|
|
|
|
|
2011-11-25 13:19:58 +01:00
|
|
|
if (parsedSpec.isChildOf(baseMkspecDir)) {
|
|
|
|
|
parsedSpec = parsedSpec.relativeChildPath(baseMkspecDir);
|
2009-11-26 16:49:45 +01:00
|
|
|
} else {
|
2012-08-29 23:17:42 +02:00
|
|
|
FileName sourceMkSpecPath = FileName::fromString(version->sourcePath().toString()
|
|
|
|
|
+ QLatin1String("/mkspecs"));
|
Remove braces for single lines of conditions
#!/usr/bin/env ruby
Dir.glob('**/*.cpp') { |file|
# skip ast (excluding paste, astpath, and canv'ast'imer)
next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
s = File.read(file)
next if s.include?('qlalr')
orig = s.dup
s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
res = $&
if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
res
else
res.gsub!('} else', 'else')
res.gsub!(/\n +} *\n/m, "\n")
res.gsub(/ *{$/, '')
end
}
s.gsub!(/ *$/, '')
File.open(file, 'wb').write(s) if s != orig
}
Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
Reviewed-by: hjk <qthjk@ovi.com>
2013-01-08 03:32:53 +02:00
|
|
|
if (parsedSpec.isChildOf(sourceMkSpecPath))
|
2011-11-25 13:19:58 +01:00
|
|
|
parsedSpec = parsedSpec.relativeChildPath(sourceMkSpecPath);
|
2009-11-26 16:49:45 +01:00
|
|
|
}
|
|
|
|
|
return parsedSpec;
|
2009-12-02 17:43:43 +01:00
|
|
|
}
|
2010-01-07 18:17:24 +01:00
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
bool QmakeBuildConfiguration::isEnabled() const
|
2011-01-19 15:46:01 +01:00
|
|
|
{
|
|
|
|
|
return m_isEnabled;
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
QString QmakeBuildConfiguration::disabledReason() const
|
2011-05-26 15:56:36 +02:00
|
|
|
{
|
|
|
|
|
if (!m_isEnabled)
|
|
|
|
|
return tr("Parsing the .pro file");
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
void QmakeBuildConfiguration::setEnabled(bool enabled)
|
2011-01-19 15:46:01 +01:00
|
|
|
{
|
|
|
|
|
if (m_isEnabled == enabled)
|
|
|
|
|
return;
|
|
|
|
|
m_isEnabled = enabled;
|
|
|
|
|
emit enabledChanged();
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-07 18:17:24 +01:00
|
|
|
/*!
|
2013-10-16 14:00:45 +02:00
|
|
|
\class QmakeBuildConfigurationFactory
|
2010-01-07 18:17:24 +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
|
|
|
QmakeBuildConfigurationFactory::QmakeBuildConfigurationFactory()
|
2010-01-07 18:17:24 +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
|
|
|
registerBuildConfiguration<QmakeBuildConfiguration>(Constants::QMAKE_BC_ID);
|
|
|
|
|
setSupportedProjectType(Constants::QMAKEPROJECT_ID);
|
|
|
|
|
setSupportedProjectMimeTypeName(Constants::PROFILE_MIMETYPE);
|
2010-01-07 18:17:24 +01:00
|
|
|
}
|
|
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
QmakeBuildInfo *QmakeBuildConfigurationFactory::createBuildInfo(const Kit *k,
|
2013-07-22 15:53:57 +02:00
|
|
|
const QString &projectPath,
|
|
|
|
|
BuildConfiguration::BuildType type) const
|
2012-04-04 16:06:35 +02:00
|
|
|
{
|
2016-01-22 01:04:35 +01:00
|
|
|
BaseQtVersion *version = QtKitInformation::qtVersion(k);
|
2013-07-22 15:53:57 +02:00
|
|
|
QmakeBuildInfo *info = new QmakeBuildInfo(this);
|
2013-12-16 12:16:35 +04:00
|
|
|
QString suffix;
|
|
|
|
|
if (type == BuildConfiguration::Release) {
|
2013-07-22 15:53:57 +02:00
|
|
|
//: The name of the release build configuration created by default for a qmake project.
|
|
|
|
|
info->displayName = tr("Release");
|
2013-12-16 12:16:35 +04:00
|
|
|
//: Non-ASCII characters in directory suffix may cause build issues.
|
|
|
|
|
suffix = tr("Release", "Shadow build directory suffix");
|
2015-11-10 12:35:41 +01:00
|
|
|
if (version && version->isQtQuickCompilerSupported())
|
|
|
|
|
info->config.useQtQuickCompiler = true;
|
2013-12-16 12:16:35 +04:00
|
|
|
} else {
|
2015-02-20 15:10:56 +01:00
|
|
|
if (type == BuildConfiguration::Debug) {
|
|
|
|
|
//: The name of the debug build configuration created by default for a qmake project.
|
|
|
|
|
info->displayName = tr("Debug");
|
|
|
|
|
//: Non-ASCII characters in directory suffix may cause build issues.
|
|
|
|
|
suffix = tr("Debug", "Shadow build directory suffix");
|
|
|
|
|
} else if (type == BuildConfiguration::Profile) {
|
|
|
|
|
//: The name of the profile build configuration created by default for a qmake project.
|
|
|
|
|
info->displayName = tr("Profile");
|
|
|
|
|
//: Non-ASCII characters in directory suffix may cause build issues.
|
|
|
|
|
suffix = tr("Profile", "Shadow build directory suffix");
|
|
|
|
|
info->config.separateDebugInfo = true;
|
2015-11-10 12:35:41 +01:00
|
|
|
if (version && version->isQtQuickCompilerSupported())
|
|
|
|
|
info->config.useQtQuickCompiler = true;
|
2015-02-20 15:10:56 +01:00
|
|
|
}
|
2015-11-10 12:35:41 +01:00
|
|
|
if (version && version->isQmlDebuggingSupported())
|
2015-10-01 15:41:04 +02:00
|
|
|
info->config.linkQmlDebuggingQQ2 = true;
|
2013-12-16 12:16:35 +04:00
|
|
|
}
|
2015-08-21 15:45:04 +02:00
|
|
|
info->typeName = info->displayName;
|
2013-07-22 15:53:57 +02:00
|
|
|
// Leave info->buildDirectory unset;
|
|
|
|
|
info->kitId = k->id();
|
2014-10-20 17:23:07 +02:00
|
|
|
|
|
|
|
|
// check if this project is in the source directory:
|
2016-01-22 01:04:35 +01:00
|
|
|
FileName projectFilePath = FileName::fromString(projectPath);
|
2015-03-07 19:36:27 +02:00
|
|
|
if (version && version->isInSourceDirectory(projectFilePath)) {
|
2014-10-20 17:23:07 +02:00
|
|
|
// assemble build directory
|
|
|
|
|
QString projectDirectory = projectFilePath.toFileInfo().absolutePath();
|
|
|
|
|
QDir qtSourceDir = QDir(version->sourcePath().toString());
|
|
|
|
|
QString relativeProjectPath = qtSourceDir.relativeFilePath(projectDirectory);
|
2017-01-23 17:40:16 +01:00
|
|
|
QString qtBuildDir = version->qmakeProperty("QT_INSTALL_PREFIX");
|
2014-10-20 17:23:07 +02:00
|
|
|
QString absoluteBuildPath = QDir::cleanPath(qtBuildDir + QLatin1Char('/') + relativeProjectPath);
|
|
|
|
|
|
2016-01-22 01:04:35 +01:00
|
|
|
info->buildDirectory = FileName::fromString(absoluteBuildPath);
|
2014-10-20 17:23:07 +02:00
|
|
|
} else {
|
2015-10-22 17:26:33 +02:00
|
|
|
info->buildDirectory = defaultBuildDirectory(projectPath, k, suffix, type);
|
2014-10-20 17:23:07 +02:00
|
|
|
}
|
2015-10-22 16:55:17 +02:00
|
|
|
info->buildType = type;
|
2013-07-22 15:53:57 +02:00
|
|
|
return info;
|
2012-04-04 16:06:35 +02:00
|
|
|
}
|
|
|
|
|
|
2015-12-07 14:39:15 +01:00
|
|
|
static QList<BuildConfiguration::BuildType> availableBuildTypes(const BaseQtVersion *version)
|
|
|
|
|
{
|
|
|
|
|
QList<BuildConfiguration::BuildType> types = {BuildConfiguration::Debug,
|
|
|
|
|
BuildConfiguration::Release};
|
|
|
|
|
if (version && version->qtVersion().majorVersion > 4)
|
|
|
|
|
types << BuildConfiguration::Profile;
|
|
|
|
|
return types;
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
QList<BuildInfo *> QmakeBuildConfigurationFactory::availableBuilds(const Target *parent) const
|
2010-01-07 18:17:24 +01:00
|
|
|
{
|
2016-01-22 01:04:35 +01:00
|
|
|
QList<BuildInfo *> result;
|
2015-08-21 15:45:04 +02:00
|
|
|
|
|
|
|
|
const QString projectFilePath = parent->project()->projectFilePath().toString();
|
|
|
|
|
|
2015-12-07 14:39:15 +01:00
|
|
|
foreach (BuildConfiguration::BuildType buildType,
|
2016-01-22 01:04:35 +01:00
|
|
|
availableBuildTypes(QtKitInformation::qtVersion(parent->kit()))) {
|
2015-12-07 14:39:15 +01:00
|
|
|
QmakeBuildInfo *info = createBuildInfo(parent->kit(), projectFilePath, buildType);
|
2015-08-21 15:45:04 +02:00
|
|
|
info->displayName.clear(); // ask for a name
|
|
|
|
|
info->buildDirectory.clear(); // This depends on the displayName
|
|
|
|
|
result << info;
|
|
|
|
|
}
|
2013-07-22 15:53:57 +02:00
|
|
|
|
|
|
|
|
return result;
|
2010-01-18 12:11:04 +01:00
|
|
|
}
|
|
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
QList<BuildInfo *> QmakeBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
2013-08-13 10:52:57 +02:00
|
|
|
{
|
2016-01-22 01:04:35 +01:00
|
|
|
QList<BuildInfo *> result;
|
|
|
|
|
BaseQtVersion *qtVersion = QtKitInformation::qtVersion(k);
|
2015-03-13 16:00:55 +01:00
|
|
|
if (!qtVersion || !qtVersion->isValid())
|
2015-03-09 14:56:07 +01:00
|
|
|
return result;
|
2015-12-07 14:39:15 +01:00
|
|
|
|
|
|
|
|
foreach (BuildConfiguration::BuildType buildType, availableBuildTypes(qtVersion))
|
|
|
|
|
result << createBuildInfo(k, projectPath, buildType);
|
|
|
|
|
|
2013-08-13 10:52:57 +02:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
BuildConfiguration::BuildType QmakeBuildConfiguration::buildType() const
|
2011-03-03 16:12:00 +01:00
|
|
|
{
|
2015-12-03 11:13:42 +01:00
|
|
|
QMakeStep *qs = qmakeStep();
|
2012-08-29 23:17:42 +02:00
|
|
|
if (qmakeBuildConfiguration() & BaseQtVersion::DebugBuild)
|
2011-03-03 16:12:00 +01:00
|
|
|
return Debug;
|
2015-12-03 11:13:42 +01:00
|
|
|
else if (qs && qs->separateDebugInfo())
|
2015-02-20 15:10:56 +01:00
|
|
|
return Profile;
|
2011-03-03 16:12:00 +01:00
|
|
|
else
|
|
|
|
|
return Release;
|
|
|
|
|
}
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2017-10-17 12:27:37 +02:00
|
|
|
void QmakeBuildConfiguration::addToEnvironment(Environment &env) const
|
|
|
|
|
{
|
2017-11-28 17:18:38 +01:00
|
|
|
setupBuildEnvironment(target()->kit(), env);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmakeBuildConfiguration::setupBuildEnvironment(Kit *k, Environment &env)
|
|
|
|
|
{
|
|
|
|
|
prependCompilerPathToEnvironment(k, env);
|
|
|
|
|
const BaseQtVersion *qt = QtKitInformation::qtVersion(k);
|
|
|
|
|
if (qt && !qt->binPath().isEmpty())
|
2017-10-17 13:48:24 +02:00
|
|
|
env.prependOrSetPath(qt->binPath().toString());
|
2017-10-17 12:27:37 +02:00
|
|
|
}
|
|
|
|
|
|
2016-11-29 15:26:48 +01:00
|
|
|
QmakeBuildConfiguration::LastKitState::LastKitState() { }
|
2012-10-18 15:35:10 +02:00
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
QmakeBuildConfiguration::LastKitState::LastKitState(Kit *k)
|
2012-10-18 15:35:10 +02:00
|
|
|
: m_qtVersion(QtKitInformation::qtVersionId(k)),
|
|
|
|
|
m_sysroot(SysRootKitInformation::sysRoot(k).toString()),
|
|
|
|
|
m_mkspec(QmakeKitInformation::mkspec(k).toString())
|
|
|
|
|
{
|
2016-12-16 00:43:14 +01:00
|
|
|
ToolChain *tc = ToolChainKitInformation::toolChain(k, ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
2015-07-07 12:01:22 +02:00
|
|
|
m_toolchain = tc ? tc->id() : QByteArray();
|
2012-10-18 15:35:10 +02:00
|
|
|
}
|
|
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
bool QmakeBuildConfiguration::LastKitState::operator ==(const LastKitState &other) const
|
2012-10-18 15:35:10 +02:00
|
|
|
{
|
|
|
|
|
return m_qtVersion == other.m_qtVersion
|
|
|
|
|
&& m_toolchain == other.m_toolchain
|
|
|
|
|
&& m_sysroot == other.m_sysroot
|
|
|
|
|
&& m_mkspec == other.m_mkspec;
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
bool QmakeBuildConfiguration::LastKitState::operator !=(const LastKitState &other) const
|
2012-10-18 15:35:10 +02:00
|
|
|
{
|
|
|
|
|
return !operator ==(other);
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-16 11:02:37 +02:00
|
|
|
} // namespace QmakeProjectManager
|