2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
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
|
|
|
|
2022-09-25 22:42:53 +02:00
|
|
|
#include "makefileparse.h"
|
|
|
|
|
#include "qmakebuildconfiguration.h"
|
2013-07-22 15:53:57 +02:00
|
|
|
#include "qmakebuildinfo.h"
|
2013-10-11 23:05:04 +08:00
|
|
|
#include "qmakekitinformation.h"
|
2022-09-25 22:42:53 +02:00
|
|
|
#include "qmakenodes.h"
|
2013-10-16 12:10:22 +02:00
|
|
|
#include "qmakeproject.h"
|
|
|
|
|
#include "qmakeprojectmanagerconstants.h"
|
2022-09-25 22:42:53 +02:00
|
|
|
#include "qmakeprojectmanagertr.h"
|
2019-03-04 17:29:57 +01:00
|
|
|
#include "qmakesettings.h"
|
2010-03-17 17:45:33 +01:00
|
|
|
#include "qmakestep.h"
|
2018-12-05 13:00:36 +01:00
|
|
|
|
|
|
|
|
#include <android/androidconstants.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
|
|
|
|
2019-11-28 16:58:42 +01:00
|
|
|
#include <projectexplorer/buildaspects.h>
|
2019-01-29 16:51:17 +01:00
|
|
|
#include <projectexplorer/buildinfo.h>
|
2018-07-03 15:09:51 +02:00
|
|
|
#include <projectexplorer/buildmanager.h>
|
2019-12-04 15:33:07 +01:00
|
|
|
#include <projectexplorer/buildpropertiessettings.h>
|
2010-07-16 14:00:41 +02:00
|
|
|
#include <projectexplorer/buildsteplist.h>
|
2014-10-22 09:16:55 +02:00
|
|
|
#include <projectexplorer/kit.h>
|
2021-04-23 05:06:22 +02:00
|
|
|
#include <projectexplorer/makestep.h>
|
2010-07-16 14:00:41 +02:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2023-02-08 20:23:54 +01:00
|
|
|
#include <projectexplorer/projectexplorertr.h>
|
2022-07-27 12:27:41 +02:00
|
|
|
#include <projectexplorer/runconfiguration.h>
|
2012-04-24 15:49:09 +02:00
|
|
|
#include <projectexplorer/target.h>
|
2019-12-19 17:59:01 +01:00
|
|
|
#include <projectexplorer/toolchain.h>
|
2018-07-03 15:09:51 +02:00
|
|
|
|
2019-11-28 16:58:42 +01:00
|
|
|
#include <qtsupport/qtbuildaspects.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>
|
2018-07-03 15:09:51 +02:00
|
|
|
|
2023-05-03 17:05:35 +02:00
|
|
|
#include <utils/process.h>
|
2013-07-22 15:53:57 +02:00
|
|
|
#include <utils/qtcassert.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
|
|
|
|
2019-12-04 15:33:07 +01:00
|
|
|
QmakeExtraBuildInfo::QmakeExtraBuildInfo()
|
|
|
|
|
{
|
2023-07-17 16:38:40 +02:00
|
|
|
const BuildPropertiesSettings &settings = buildPropertiesSettings();
|
|
|
|
|
config.separateDebugInfo = settings.separateDebugInfo();
|
|
|
|
|
config.linkQmlDebuggingQQ2 = settings.qmlDebugging();
|
|
|
|
|
config.useQtQuickCompiler = settings.qtQuickCompiler();
|
2019-12-04 15:33:07 +01:00
|
|
|
}
|
|
|
|
|
|
2013-08-13 10:52:57 +02:00
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
// Helpers:
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
2019-12-04 13:19:34 +01:00
|
|
|
FilePath QmakeBuildConfiguration::shadowBuildDirectory(const FilePath &proFilePath, const Kit *k,
|
|
|
|
|
const QString &suffix,
|
|
|
|
|
BuildConfiguration::BuildType buildType)
|
2014-10-22 09:16:55 +02:00
|
|
|
{
|
|
|
|
|
if (proFilePath.isEmpty())
|
2019-12-04 13:19:34 +01:00
|
|
|
return {};
|
2014-10-22 09:16:55 +02:00
|
|
|
|
2021-06-04 07:59:00 +02:00
|
|
|
const QString projectName = proFilePath.completeBaseName();
|
2022-06-03 13:32:49 +02:00
|
|
|
return buildDirectoryFromTemplate(Project::projectDirectory(proFilePath), proFilePath,
|
|
|
|
|
projectName, k, suffix, buildType, "qmake");
|
2013-08-13 10:52:57 +02:00
|
|
|
}
|
|
|
|
|
|
2012-08-29 23:17:42 +02:00
|
|
|
const char BUILD_CONFIGURATION_KEY[] = "Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration";
|
2010-01-19 13:41:02 +01:00
|
|
|
|
2022-09-30 12:42:20 +02:00
|
|
|
QmakeBuildConfiguration::QmakeBuildConfiguration(Target *target, Id id)
|
2018-05-04 16:52:21 +02:00
|
|
|
: BuildConfiguration(target, id)
|
2009-11-23 12:11:48 +01:00
|
|
|
{
|
2022-09-25 22:42:53 +02:00
|
|
|
setConfigWidgetDisplayName(Tr::tr("General"));
|
2019-11-26 17:11:01 +01:00
|
|
|
setConfigWidgetHasFrame(true);
|
2019-12-06 18:42:11 +01:00
|
|
|
|
2019-10-25 09:55:32 +02:00
|
|
|
m_buildSystem = new QmakeBuildSystem(this);
|
|
|
|
|
|
2019-12-20 17:05:30 +01:00
|
|
|
appendInitialBuildStep(Constants::QMAKE_BS_ID);
|
|
|
|
|
appendInitialBuildStep(Constants::MAKESTEP_BS_ID);
|
2019-12-06 18:42:11 +01:00
|
|
|
appendInitialCleanStep(Constants::MAKESTEP_BS_ID);
|
|
|
|
|
|
2019-12-06 17:32:07 +01:00
|
|
|
setInitializer([this, target](const BuildInfo &info) {
|
2023-07-13 19:03:26 +02:00
|
|
|
QMakeStep *qmakeStep = buildSteps()->firstOfType<QMakeStep>();
|
2019-12-20 17:05:30 +01:00
|
|
|
QTC_ASSERT(qmakeStep, return);
|
2019-12-09 12:59:38 +01:00
|
|
|
|
2019-12-06 17:32:07 +01:00
|
|
|
const QmakeExtraBuildInfo qmakeExtra = info.extraInfo.value<QmakeExtraBuildInfo>();
|
2022-01-21 16:06:36 +01:00
|
|
|
QtVersion *version = QtKitAspect::qtVersion(target->kit());
|
2019-12-09 12:59:38 +01:00
|
|
|
|
2022-01-21 16:06:36 +01:00
|
|
|
QtVersion::QmakeBuildConfigs config = version->defaultBuildConfig();
|
2019-12-06 17:32:07 +01:00
|
|
|
if (info.buildType == BuildConfiguration::Debug)
|
2022-01-21 16:06:36 +01:00
|
|
|
config |= QtVersion::DebugBuild;
|
2019-12-09 12:59:38 +01:00
|
|
|
else
|
2022-01-21 16:06:36 +01:00
|
|
|
config &= ~QtVersion::DebugBuild;
|
2019-12-09 12:59:38 +01:00
|
|
|
|
|
|
|
|
QString additionalArguments = qmakeExtra.additionalArguments;
|
|
|
|
|
if (!additionalArguments.isEmpty())
|
2023-07-13 19:03:26 +02:00
|
|
|
qmakeStep->userArguments.setArguments(additionalArguments);
|
2019-12-09 12:59:38 +01:00
|
|
|
|
2023-07-13 19:17:55 +02:00
|
|
|
separateDebugInfo.setValue(qmakeExtra.config.separateDebugInfo);
|
|
|
|
|
qmlDebugging.setValue(qmakeExtra.config.linkQmlDebuggingQQ2);
|
|
|
|
|
useQtQuickCompiler.setValue(qmakeExtra.config.useQtQuickCompiler);
|
2019-12-09 12:59:38 +01:00
|
|
|
|
|
|
|
|
setQMakeBuildConfiguration(config);
|
|
|
|
|
|
2019-12-06 17:32:07 +01:00
|
|
|
FilePath directory = info.buildDirectory;
|
2019-12-09 12:59:38 +01:00
|
|
|
if (directory.isEmpty()) {
|
|
|
|
|
directory = shadowBuildDirectory(target->project()->projectFilePath(),
|
2019-12-06 17:32:07 +01:00
|
|
|
target->kit(), info.displayName,
|
|
|
|
|
info.buildType);
|
2019-12-09 12:59:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setBuildDirectory(directory);
|
|
|
|
|
|
|
|
|
|
if (DeviceTypeKitAspect::deviceTypeId(target->kit())
|
|
|
|
|
== Android::Constants::ANDROID_DEVICE_TYPE) {
|
2021-09-05 18:49:26 +03:00
|
|
|
buildSteps()->appendStep(Android::Constants::ANDROID_PACKAGE_INSTALL_STEP_ID);
|
2019-12-09 12:59:38 +01:00
|
|
|
buildSteps()->appendStep(Android::Constants::ANDROID_BUILD_APK_ID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updateCacheAndEmitEnvironmentChanged();
|
|
|
|
|
});
|
|
|
|
|
|
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(target, &Target::kitChanged,
|
|
|
|
|
this, &QmakeBuildConfiguration::kitChanged);
|
|
|
|
|
MacroExpander *expander = macroExpander();
|
|
|
|
|
expander->registerVariable("Qmake:Makefile", "Qmake makefile", [this]() -> QString {
|
2021-08-12 15:04:18 +02:00
|
|
|
const FilePath file = makefile();
|
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
|
|
|
if (!file.isEmpty())
|
2021-08-12 15:04:18 +02:00
|
|
|
return file.path();
|
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
|
|
|
return QLatin1String("Makefile");
|
|
|
|
|
});
|
2019-11-26 17:11:01 +01:00
|
|
|
|
|
|
|
|
buildDirectoryAspect()->allowInSourceBuilds(target->project()->projectDirectory());
|
2022-10-20 15:35:38 +02:00
|
|
|
connect(this, &BuildConfiguration::buildDirectoryInitialized,
|
|
|
|
|
this, &QmakeBuildConfiguration::updateProblemLabel);
|
2019-11-26 17:11:01 +01:00
|
|
|
connect(this, &BuildConfiguration::buildDirectoryChanged,
|
|
|
|
|
this, &QmakeBuildConfiguration::updateProblemLabel);
|
|
|
|
|
connect(this, &QmakeBuildConfiguration::qmakeBuildConfigurationChanged,
|
|
|
|
|
this, &QmakeBuildConfiguration::updateProblemLabel);
|
2023-05-15 12:42:08 +02:00
|
|
|
connect(&settings(), &AspectContainer::changed,
|
2019-11-26 17:11:01 +01:00
|
|
|
this, &QmakeBuildConfiguration::updateProblemLabel);
|
|
|
|
|
connect(target, &Target::parsingFinished, this, &QmakeBuildConfiguration::updateProblemLabel);
|
|
|
|
|
connect(target, &Target::kitChanged, this, &QmakeBuildConfiguration::updateProblemLabel);
|
|
|
|
|
|
2023-07-13 19:17:55 +02:00
|
|
|
connect(&separateDebugInfo, &BaseAspect::changed, this, [this] {
|
2019-11-28 14:37:02 +01:00
|
|
|
emit separateDebugInfoChanged();
|
|
|
|
|
emit qmakeBuildConfigurationChanged();
|
|
|
|
|
qmakeBuildSystem()->scheduleUpdateAllNowOrLater();
|
|
|
|
|
});
|
|
|
|
|
|
2023-07-13 19:17:55 +02:00
|
|
|
qmlDebugging.setBuildConfiguration(this);
|
|
|
|
|
connect(&qmlDebugging, &BaseAspect::changed, this, [this] {
|
2019-11-28 16:58:42 +01:00
|
|
|
emit qmlDebuggingChanged();
|
|
|
|
|
emit qmakeBuildConfigurationChanged();
|
|
|
|
|
qmakeBuildSystem()->scheduleUpdateAllNowOrLater();
|
|
|
|
|
});
|
|
|
|
|
|
2023-07-13 19:17:55 +02:00
|
|
|
useQtQuickCompiler.setBuildConfiguration(this);
|
|
|
|
|
connect(&useQtQuickCompiler, &QtQuickCompilerAspect::changed, this, [this] {
|
2019-11-28 16:58:42 +01:00
|
|
|
emit useQtQuickCompilerChanged();
|
|
|
|
|
emit qmakeBuildConfigurationChanged();
|
|
|
|
|
qmakeBuildSystem()->scheduleUpdateAllNowOrLater();
|
|
|
|
|
});
|
2020-10-15 17:07:00 +02:00
|
|
|
|
2023-07-13 19:17:55 +02:00
|
|
|
runSystemFunctions.setSettingsKey("RunSystemFunction");
|
|
|
|
|
runSystemFunctions.setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox);
|
|
|
|
|
runSystemFunctions.setDisplayName(Tr::tr("qmake system() behavior when parsing:"));
|
|
|
|
|
runSystemFunctions.addOption(Tr::tr("Run"));
|
|
|
|
|
runSystemFunctions.addOption(Tr::tr("Ignore"));
|
|
|
|
|
runSystemFunctions.addOption(Tr::tr("Use global setting"));
|
|
|
|
|
runSystemFunctions.setDefaultValue(2);
|
2009-11-23 12:11:48 +01:00
|
|
|
}
|
|
|
|
|
|
2019-10-25 09:55:32 +02:00
|
|
|
QmakeBuildConfiguration::~QmakeBuildConfiguration()
|
|
|
|
|
{
|
|
|
|
|
delete m_buildSystem;
|
|
|
|
|
}
|
2009-11-23 12:11:48 +01:00
|
|
|
|
2023-07-21 17:44:01 +02:00
|
|
|
void QmakeBuildConfiguration::toMap(QVariantMap &map) const
|
2010-01-18 12:11:04 +01:00
|
|
|
{
|
2023-07-21 17:44:01 +02:00
|
|
|
BuildConfiguration::toMap(map);
|
2010-01-18 12:11:04 +01:00
|
|
|
map.insert(QLatin1String(BUILD_CONFIGURATION_KEY), int(m_qmakeBuildConfiguration));
|
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;
|
|
|
|
|
|
2022-01-21 16:06:36 +01:00
|
|
|
m_qmakeBuildConfiguration = QtVersion::QmakeBuildConfigs(map.value(QLatin1String(BUILD_CONFIGURATION_KEY)).toInt());
|
2011-03-23 13:32:42 +01:00
|
|
|
|
2020-09-07 15:56:18 +02:00
|
|
|
m_lastKitState = LastKitState(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
|
|
|
{
|
2020-09-07 15:56:18 +02:00
|
|
|
LastKitState newState = LastKitState(kit());
|
2012-10-18 15:35:10 +02:00
|
|
|
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
|
2019-11-20 15:51:44 +01:00
|
|
|
m_buildSystem->scheduleUpdateAllNowOrLater();
|
2012-10-18 15:35:10 +02:00
|
|
|
m_lastKitState = newState;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-26 17:11:01 +01:00
|
|
|
void QmakeBuildConfiguration::updateProblemLabel()
|
2019-10-25 09:55:32 +02:00
|
|
|
{
|
2020-09-07 15:56:18 +02:00
|
|
|
ProjectExplorer::Kit * const k = kit();
|
2019-11-26 17:11:01 +01:00
|
|
|
|
|
|
|
|
// Check for Qt version:
|
2022-01-21 16:06:36 +01:00
|
|
|
QtSupport::QtVersion *version = QtSupport::QtKitAspect::qtVersion(k);
|
2019-11-26 17:11:01 +01:00
|
|
|
if (!version) {
|
2022-09-25 22:42:53 +02:00
|
|
|
buildDirectoryAspect()->setProblem(Tr::tr("This kit cannot build this project since it "
|
|
|
|
|
"does not define a Qt version."));
|
2019-11-26 17:11:01 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const auto bs = qmakeBuildSystem();
|
2020-02-06 17:22:47 +01:00
|
|
|
if (QmakeProFile *rootProFile = bs->rootProFile()) {
|
|
|
|
|
if (rootProFile->parseInProgress() || !rootProFile->validParse()) {
|
|
|
|
|
buildDirectoryAspect()->setProblem({});
|
|
|
|
|
return;
|
|
|
|
|
}
|
2019-11-26 17:11:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool targetMismatch = false;
|
|
|
|
|
bool incompatibleBuild = false;
|
|
|
|
|
bool allGood = false;
|
|
|
|
|
// we only show if we actually have a qmake and makestep
|
|
|
|
|
QString errorString;
|
|
|
|
|
if (qmakeStep() && makeStep()) {
|
2021-08-12 15:04:18 +02:00
|
|
|
const QString makeFile = this->makefile().isEmpty() ? "Makefile" : makefile().path();
|
|
|
|
|
switch (compareToImportFrom(buildDirectory() / makeFile, &errorString)) {
|
2019-11-26 17:11:01 +01:00
|
|
|
case QmakeBuildConfiguration::MakefileMatches:
|
|
|
|
|
allGood = true;
|
|
|
|
|
break;
|
|
|
|
|
case QmakeBuildConfiguration::MakefileMissing:
|
|
|
|
|
allGood = true;
|
|
|
|
|
break;
|
|
|
|
|
case QmakeBuildConfiguration::MakefileIncompatible:
|
|
|
|
|
incompatibleBuild = true;
|
|
|
|
|
break;
|
|
|
|
|
case QmakeBuildConfiguration::MakefileForWrongProject:
|
|
|
|
|
targetMismatch = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-15 12:42:08 +02:00
|
|
|
const bool unalignedBuildDir = settings().warnAgainstUnalignedBuildDir()
|
2019-11-26 17:11:01 +01:00
|
|
|
&& !isBuildDirAtSafeLocation();
|
|
|
|
|
if (unalignedBuildDir)
|
|
|
|
|
allGood = false;
|
|
|
|
|
|
|
|
|
|
if (allGood) {
|
2022-10-21 14:05:12 +02:00
|
|
|
const Tasks issues = Utils::sorted(
|
2023-01-11 15:46:28 +01:00
|
|
|
version->reportIssues(project()->projectFilePath(), buildDirectory()));
|
2019-11-26 17:11:01 +01:00
|
|
|
if (!issues.isEmpty()) {
|
|
|
|
|
QString text = QLatin1String("<nobr>");
|
2022-10-21 14:05:12 +02:00
|
|
|
for (const ProjectExplorer::Task &task : issues) {
|
2019-11-26 17:11:01 +01:00
|
|
|
QString type;
|
|
|
|
|
switch (task.type) {
|
|
|
|
|
case ProjectExplorer::Task::Error:
|
2022-09-25 22:42:53 +02:00
|
|
|
type = Tr::tr("Error:");
|
2019-11-26 17:11:01 +01:00
|
|
|
type += QLatin1Char(' ');
|
|
|
|
|
break;
|
|
|
|
|
case ProjectExplorer::Task::Warning:
|
2022-09-25 22:42:53 +02:00
|
|
|
type = Tr::tr("Warning:");
|
2019-11-26 17:11:01 +01:00
|
|
|
type += QLatin1Char(' ');
|
|
|
|
|
break;
|
|
|
|
|
case ProjectExplorer::Task::Unknown:
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (!text.endsWith(QLatin1String("br>")))
|
|
|
|
|
text.append(QLatin1String("<br>"));
|
2020-05-12 16:26:34 +02:00
|
|
|
text.append(type + task.description());
|
2019-11-26 17:11:01 +01:00
|
|
|
}
|
|
|
|
|
buildDirectoryAspect()->setProblem(text);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
} else if (targetMismatch) {
|
2022-09-25 22:42:53 +02:00
|
|
|
buildDirectoryAspect()->setProblem(Tr::tr("The build directory contains a build for "
|
|
|
|
|
"a different project, which will be overwritten."));
|
2019-11-26 17:11:01 +01:00
|
|
|
return;
|
|
|
|
|
} else if (incompatibleBuild) {
|
2022-09-25 22:42:53 +02:00
|
|
|
buildDirectoryAspect()->setProblem(Tr::tr("%1 The build will be overwritten.",
|
|
|
|
|
"%1 error message")
|
2020-02-20 15:33:26 +01:00
|
|
|
.arg(errorString));
|
2019-11-26 17:11:01 +01:00
|
|
|
return;
|
|
|
|
|
} else if (unalignedBuildDir) {
|
|
|
|
|
buildDirectoryAspect()->setProblem(unalignedBuildDirWarning());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buildDirectoryAspect()->setProblem({});
|
2019-10-25 09:55:32 +02:00
|
|
|
}
|
|
|
|
|
|
2019-11-26 17:11:01 +01:00
|
|
|
BuildSystem *QmakeBuildConfiguration::buildSystem() const
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
2019-11-26 17:11:01 +01:00
|
|
|
return m_buildSystem;
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-12 15:04:18 +02:00
|
|
|
FilePath QmakeBuildConfiguration::makefile() const
|
2010-10-05 17:38:45 +02:00
|
|
|
{
|
2021-08-12 15:04:18 +02:00
|
|
|
return FilePath::fromString(m_buildSystem->rootProFile()->singleVariableValue(Variable::Makefile));
|
2009-11-25 18:50:20 +01:00
|
|
|
}
|
|
|
|
|
|
2022-01-21 16:06:36 +01:00
|
|
|
QtVersion::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
|
|
|
}
|
|
|
|
|
|
2022-01-21 16:06:36 +01:00
|
|
|
void QmakeBuildConfiguration::setQMakeBuildConfiguration(QtVersion::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();
|
2019-10-25 09:55:32 +02:00
|
|
|
m_buildSystem->scheduleUpdateAllNowOrLater();
|
2019-11-20 15:51:44 +01:00
|
|
|
emit buildTypeChanged();
|
2010-09-01 12:33:53 +02:00
|
|
|
}
|
|
|
|
|
|
2019-03-04 17:29:57 +01:00
|
|
|
QString QmakeBuildConfiguration::unalignedBuildDirWarning()
|
|
|
|
|
{
|
2022-09-25 22:42:53 +02:00
|
|
|
return Tr::tr("The build directory should be at the same level as the source directory.");
|
2019-03-04 17:29:57 +01:00
|
|
|
}
|
|
|
|
|
|
2023-01-11 15:46:28 +01:00
|
|
|
bool QmakeBuildConfiguration::isBuildDirAtSafeLocation(const FilePath &sourceDir,
|
|
|
|
|
const FilePath &buildDir)
|
2019-03-04 17:29:57 +01:00
|
|
|
{
|
2023-01-11 15:46:28 +01:00
|
|
|
return buildDir.path().count('/') == sourceDir.path().count('/');
|
2019-03-04 17:29:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool QmakeBuildConfiguration::isBuildDirAtSafeLocation() const
|
|
|
|
|
{
|
2023-01-11 15:46:28 +01:00
|
|
|
return isBuildDirAtSafeLocation(project()->projectDirectory(), buildDirectory());
|
2019-03-04 17:29:57 +01:00
|
|
|
}
|
|
|
|
|
|
2019-11-28 14:37:02 +01:00
|
|
|
void QmakeBuildConfiguration::forceSeparateDebugInfo(bool sepDebugInfo)
|
|
|
|
|
{
|
2023-07-13 19:17:55 +02:00
|
|
|
separateDebugInfo.setValue(sepDebugInfo ? TriState::Enabled : TriState::Disabled);
|
2019-11-28 16:58:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmakeBuildConfiguration::forceQmlDebugging(bool enable)
|
|
|
|
|
{
|
2023-07-13 19:17:55 +02:00
|
|
|
qmlDebugging.setValue(enable ? TriState::Enabled : TriState::Disabled);
|
2019-11-28 16:58:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmakeBuildConfiguration::forceQtQuickCompiler(bool enable)
|
|
|
|
|
{
|
2023-07-13 19:17:55 +02:00
|
|
|
useQtQuickCompiler.setValue(enable ? TriState::Enabled : TriState::Disabled);
|
2019-11-28 16:58:42 +01:00
|
|
|
}
|
|
|
|
|
|
2023-07-13 19:17:55 +02:00
|
|
|
bool QmakeBuildConfiguration::runQmakeSystemFunctions() const
|
2020-10-15 17:07:00 +02:00
|
|
|
{
|
2023-07-13 19:17:55 +02:00
|
|
|
const int sel = runSystemFunctions();
|
|
|
|
|
if (sel == 0)
|
2020-10-15 17:07:00 +02:00
|
|
|
return true;
|
2023-07-13 19:17:55 +02:00
|
|
|
if (sel == 1)
|
2020-10-15 17:07:00 +02:00
|
|
|
return false;
|
2023-05-15 12:42:08 +02:00
|
|
|
return settings().runSystemFunction();
|
2020-10-15 17:07:00 +02:00
|
|
|
}
|
|
|
|
|
|
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;
|
2022-01-21 16:06:36 +01:00
|
|
|
QtVersion *version = QtKitAspect::qtVersion(kit());
|
|
|
|
|
QtVersion::QmakeBuildConfigs defaultBuildConfiguration =
|
|
|
|
|
version ? version->defaultBuildConfig() : QtVersion::QmakeBuildConfigs(QtVersion::DebugBuild | QtVersion::BuildAll);
|
|
|
|
|
QtVersion::QmakeBuildConfigs userBuildConfiguration = m_qmakeBuildConfiguration;
|
|
|
|
|
if ((defaultBuildConfiguration & QtVersion::BuildAll) && !(userBuildConfiguration & QtVersion::BuildAll))
|
2012-01-13 14:20:45 +01:00
|
|
|
result << QLatin1String("CONFIG-=debug_and_release");
|
2010-09-01 12:33:53 +02:00
|
|
|
|
2022-01-21 16:06:36 +01:00
|
|
|
if (!(defaultBuildConfiguration & QtVersion::BuildAll) && (userBuildConfiguration & QtVersion::BuildAll))
|
2012-01-13 14:20:45 +01:00
|
|
|
result << QLatin1String("CONFIG+=debug_and_release");
|
2022-01-21 16:06:36 +01:00
|
|
|
if ((defaultBuildConfiguration & QtVersion::DebugBuild) && !(userBuildConfiguration & QtVersion::DebugBuild))
|
2012-01-13 14:20:45 +01:00
|
|
|
result << QLatin1String("CONFIG+=release");
|
2022-01-21 16:06:36 +01:00
|
|
|
if (!(defaultBuildConfiguration & QtVersion::DebugBuild) && (userBuildConfiguration & QtVersion::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
|
|
|
{
|
2018-07-12 23:59:51 +02:00
|
|
|
QMakeStep *qs = nullptr;
|
2019-12-05 16:19:42 +01:00
|
|
|
BuildStepList *bsl = buildSteps();
|
2010-07-16 14:00:41 +02:00
|
|
|
for (int i = 0; i < bsl->count(); ++i)
|
2018-07-12 23:59:51 +02:00
|
|
|
if ((qs = qobject_cast<QMakeStep *>(bsl->at(i))) != nullptr)
|
2009-11-25 18:50:20 +01:00
|
|
|
return qs;
|
2018-07-12 23:59:51 +02:00
|
|
|
return nullptr;
|
2009-11-25 18:50:20 +01:00
|
|
|
}
|
|
|
|
|
|
2021-04-23 05:06:22 +02:00
|
|
|
MakeStep *QmakeBuildConfiguration::makeStep() const
|
2009-11-25 18:50:20 +01:00
|
|
|
{
|
2021-04-23 05:06:22 +02:00
|
|
|
MakeStep *ms = nullptr;
|
2019-12-05 16:19:42 +01:00
|
|
|
BuildStepList *bsl = buildSteps();
|
2010-07-16 14:00:41 +02:00
|
|
|
for (int i = 0; i < bsl->count(); ++i)
|
2021-04-23 05:06:22 +02:00
|
|
|
if ((ms = qobject_cast<MakeStep *>(bsl->at(i))) != nullptr)
|
2010-07-16 14:00:41 +02:00
|
|
|
return ms;
|
2018-07-12 23:59:51 +02:00
|
|
|
return nullptr;
|
2009-11-25 18:50:20 +01:00
|
|
|
}
|
|
|
|
|
|
2019-10-25 09:55:32 +02:00
|
|
|
QmakeBuildSystem *QmakeBuildConfiguration::qmakeBuildSystem() const
|
|
|
|
|
{
|
|
|
|
|
return m_buildSystem;
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-29 23:17:42 +02:00
|
|
|
// Returns true if both are equal.
|
2021-08-12 15:04:18 +02:00
|
|
|
QmakeBuildConfiguration::MakefileState QmakeBuildConfiguration::compareToImportFrom(const FilePath &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();
|
2020-09-08 10:32:17 +02:00
|
|
|
MakeFileParse parse(makefile, MakeFileParse::Mode::DoNotFilterKnownConfigValues);
|
2015-03-04 17:14:28 +01:00
|
|
|
|
|
|
|
|
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)
|
2022-09-25 22:42:53 +02:00
|
|
|
*errorString = Tr::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;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-21 16:06:36 +01:00
|
|
|
QtVersion *version = QtKitAspect::qtVersion(kit());
|
2015-03-04 17:14:28 +01:00
|
|
|
if (!version) {
|
|
|
|
|
qCDebug(logs) << "**No qt version in kit";
|
|
|
|
|
return MakefileForWrongProject;
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-12 15:04:18 +02:00
|
|
|
const FilePath projectPath =
|
2018-06-10 08:59:57 +03:00
|
|
|
m_subNodeBuild ? m_subNodeBuild->filePath() : qs->project()->projectFilePath();
|
2021-08-12 15:04:18 +02:00
|
|
|
if (parse.srcProFile() != projectPath) {
|
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)
|
2022-09-25 22:42:53 +02:00
|
|
|
*errorString = Tr::tr("The Makefile is for a different project.");
|
2015-03-04 17:14:28 +01:00
|
|
|
return MakefileIncompatible;
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-13 09:41:26 +02:00
|
|
|
if (version->qmakeFilePath() != parse.qmakePath()) {
|
2021-08-12 15:04:18 +02:00
|
|
|
qCDebug(logs) << "**Different Qt versions, buildconfiguration:" << version->qmakeFilePath()
|
|
|
|
|
<< " Makefile:" << parse.qmakePath();
|
2015-03-04 17:14:28 +01:00
|
|
|
return MakefileForWrongProject;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// same qtversion
|
2022-01-21 16:06:36 +01:00
|
|
|
QtVersion::QmakeBuildConfigs buildConfig = parse.effectiveBuildConfig(version->defaultBuildConfig());
|
2015-03-04 17:14:28 +01:00
|
|
|
if (qmakeBuildConfiguration() != buildConfig) {
|
|
|
|
|
qCDebug(logs) << "**Different qmake buildconfigurations buildconfiguration:"
|
|
|
|
|
<< qmakeBuildConfiguration() << " Makefile:" << buildConfig;
|
2015-07-24 15:21:00 +02:00
|
|
|
if (errorString)
|
2022-09-25 22:42:53 +02:00
|
|
|
*errorString = Tr::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
|
2021-08-12 15:04:18 +02:00
|
|
|
FilePath workingDirectory = makefile.parentDir();
|
2015-03-04 17:14:28 +01:00
|
|
|
QStringList actualArgs;
|
2020-09-08 10:32:17 +02:00
|
|
|
QString allArgs = macroExpander()->expandProcessArgs(qs->allArguments(
|
|
|
|
|
QtKitAspect::qtVersion(target()->kit()), QMakeStep::ArgumentFlag::Expand));
|
|
|
|
|
// This copies the settings from allArgs to actualArgs (minus some we
|
2015-03-04 17:14:28 +01:00
|
|
|
// are not interested in), splitting them up into individual strings:
|
2020-09-08 10:32:17 +02:00
|
|
|
extractSpecFromArguments(&allArgs, workingDirectory, version, &actualArgs);
|
|
|
|
|
actualArgs.removeFirst(); // Project file.
|
2019-05-27 15:19:36 +02:00
|
|
|
const QString actualSpec = qs->mkspec();
|
2015-03-04 17:14:28 +01:00
|
|
|
|
|
|
|
|
QString qmakeArgs = parse.unparsedArguments();
|
|
|
|
|
QStringList parsedArgs;
|
2019-05-27 15:19:36 +02:00
|
|
|
QString parsedSpec =
|
|
|
|
|
extractSpecFromArguments(&qmakeArgs, workingDirectory, version, &parsedArgs);
|
2015-03-04 17:14:28 +01:00
|
|
|
|
|
|
|
|
qCDebug(logs) << " Actual args:" << actualArgs;
|
|
|
|
|
qCDebug(logs) << " Parsed args:" << parsedArgs;
|
2019-05-27 15:19:36 +02:00
|
|
|
qCDebug(logs) << " Actual spec:" << actualSpec;
|
|
|
|
|
qCDebug(logs) << " Parsed spec:" << parsedSpec;
|
2015-03-04 17:14:28 +01:00
|
|
|
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)
|
2022-09-25 22:42:53 +02:00
|
|
|
*errorString = Tr::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)
|
2022-09-25 22:42:53 +02:00
|
|
|
*errorString = Tr::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();
|
2019-05-27 15:19:36 +02:00
|
|
|
if ((actualSpec == version->mkspec() || actualSpec == "default")
|
|
|
|
|
&& (parsedSpec == version->mkspec() || parsedSpec == "default" || parsedSpec.isEmpty())) {
|
2015-03-04 17:14:28 +01:00
|
|
|
qCDebug(logs) << "**Matched specs (2)";
|
|
|
|
|
return MakefileMatches;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qCDebug(logs) << "**Incompatible specs";
|
2015-07-24 15:21:00 +02:00
|
|
|
if (errorString)
|
2022-09-25 22:42:53 +02:00
|
|
|
*errorString = Tr::tr("The mkspec has changed.");
|
2015-03-04 17:14:28 +01:00
|
|
|
return MakefileIncompatible;
|
2010-08-30 13:24:34 +02:00
|
|
|
}
|
|
|
|
|
|
2019-05-27 15:19:36 +02:00
|
|
|
QString QmakeBuildConfiguration::extractSpecFromArguments(QString *args,
|
2021-08-12 15:04:18 +02:00
|
|
|
const FilePath &directory,
|
2022-01-21 16:06:36 +01:00
|
|
|
const QtVersion *version,
|
2012-08-29 23:17:42 +02:00
|
|
|
QStringList *outArgs)
|
2009-11-26 16:49:45 +01:00
|
|
|
{
|
2019-05-28 13:49:26 +02:00
|
|
|
FilePath 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;
|
2021-05-06 13:07:36 +02:00
|
|
|
for (ProcessArgs::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;
|
2019-05-28 13:49:26 +02:00
|
|
|
parsedSpec = FilePath::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())
|
2019-05-27 15:19:36 +02:00
|
|
|
return {};
|
2009-11-26 16:49:45 +01:00
|
|
|
|
2023-06-07 09:48:25 +02:00
|
|
|
const FilePath baseMkspecDir = version->hostDataPath().pathAppended("mkspecs")
|
|
|
|
|
.canonicalPath();
|
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
|
2023-06-07 09:48:25 +02:00
|
|
|
if (parsedSpec.isRelativePath()) {
|
|
|
|
|
FilePath mkspecs = directory.pathAppended(parsedSpec.path());
|
|
|
|
|
if (mkspecs.exists())
|
|
|
|
|
parsedSpec = 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
|
|
|
else
|
2023-06-07 09:48:25 +02:00
|
|
|
parsedSpec = baseMkspecDir.pathAppended(parsedSpec.path());
|
2009-11-26 16:49:45 +01:00
|
|
|
}
|
|
|
|
|
|
2023-06-08 11:44:18 +02:00
|
|
|
for (int i = 0; i < 5 && parsedSpec.isSymLink(); ++i)
|
2023-06-07 09:48:25 +02:00
|
|
|
parsedSpec = parsedSpec.symLinkTarget();
|
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 {
|
2023-06-07 09:48:25 +02:00
|
|
|
FilePath sourceMkSpecPath = version->sourcePath().pathAppended("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
|
|
|
}
|
2019-05-27 15:19:36 +02:00
|
|
|
return parsedSpec.toString();
|
2009-12-02 17:43:43 +01:00
|
|
|
}
|
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
|
|
|
*/
|
|
|
|
|
|
2020-01-09 18:42:28 +01:00
|
|
|
static BuildInfo createBuildInfo(const Kit *k, const FilePath &projectPath,
|
|
|
|
|
BuildConfiguration::BuildType type)
|
2012-04-04 16:06:35 +02:00
|
|
|
{
|
2023-07-17 16:38:40 +02:00
|
|
|
const BuildPropertiesSettings &settings = buildPropertiesSettings();
|
2022-01-21 16:06:36 +01:00
|
|
|
QtVersion *version = QtKitAspect::qtVersion(k);
|
2019-01-29 16:51:17 +01:00
|
|
|
QmakeExtraBuildInfo extraInfo;
|
2020-01-09 18:42:28 +01:00
|
|
|
BuildInfo info;
|
2013-12-16 12:16:35 +04:00
|
|
|
QString suffix;
|
2019-12-04 15:33:07 +01:00
|
|
|
|
2013-12-16 12:16:35 +04:00
|
|
|
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.
|
2023-02-08 20:23:54 +01:00
|
|
|
info.displayName = ::ProjectExplorer::Tr::tr("Release");
|
2013-12-16 12:16:35 +04:00
|
|
|
//: Non-ASCII characters in directory suffix may cause build issues.
|
2022-09-25 22:42:53 +02:00
|
|
|
suffix = Tr::tr("Release", "Shadow build directory suffix");
|
2023-07-17 16:38:40 +02:00
|
|
|
if (settings.qtQuickCompiler() == TriState::Default) {
|
2019-12-04 15:33:07 +01:00
|
|
|
if (version && version->isQtQuickCompilerSupported())
|
|
|
|
|
extraInfo.config.useQtQuickCompiler = TriState::Enabled;
|
|
|
|
|
}
|
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.
|
2023-02-08 20:23:54 +01:00
|
|
|
info.displayName = ::ProjectExplorer::Tr::tr("Debug");
|
2015-02-20 15:10:56 +01:00
|
|
|
//: Non-ASCII characters in directory suffix may cause build issues.
|
2022-09-25 22:42:53 +02:00
|
|
|
suffix = Tr::tr("Debug", "Shadow build directory suffix");
|
2015-02-20 15:10:56 +01:00
|
|
|
} else if (type == BuildConfiguration::Profile) {
|
|
|
|
|
//: The name of the profile build configuration created by default for a qmake project.
|
2023-02-08 20:23:54 +01:00
|
|
|
info.displayName = ::ProjectExplorer::Tr::tr("Profile");
|
2015-02-20 15:10:56 +01:00
|
|
|
//: Non-ASCII characters in directory suffix may cause build issues.
|
2022-09-25 22:42:53 +02:00
|
|
|
suffix = Tr::tr("Profile", "Shadow build directory suffix");
|
2023-07-17 16:38:40 +02:00
|
|
|
if (settings.separateDebugInfo() == TriState::Default)
|
2019-12-04 15:33:07 +01:00
|
|
|
extraInfo.config.separateDebugInfo = TriState::Enabled;
|
|
|
|
|
|
2023-07-17 16:38:40 +02:00
|
|
|
if (settings.qtQuickCompiler() == TriState::Default) {
|
2019-12-04 15:33:07 +01:00
|
|
|
if (version && version->isQtQuickCompilerSupported())
|
|
|
|
|
extraInfo.config.useQtQuickCompiler = TriState::Enabled;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-07-17 16:38:40 +02:00
|
|
|
if (settings.qmlDebugging() == TriState::Default) {
|
2019-12-04 15:33:07 +01:00
|
|
|
if (version && version->isQmlDebuggingSupported())
|
|
|
|
|
extraInfo.config.linkQmlDebuggingQQ2 = TriState::Enabled;
|
2015-02-20 15:10:56 +01:00
|
|
|
}
|
2013-12-16 12:16:35 +04:00
|
|
|
}
|
2019-01-29 16:51:17 +01:00
|
|
|
info.typeName = info.displayName;
|
|
|
|
|
// Leave info.buildDirectory unset;
|
2014-10-20 17:23:07 +02:00
|
|
|
|
|
|
|
|
// check if this project is in the source directory:
|
2021-06-30 11:33:33 +02:00
|
|
|
if (version && version->isInQtSourceDirectory(projectPath)) {
|
2014-10-20 17:23:07 +02:00
|
|
|
// assemble build directory
|
2019-06-26 17:09:35 +02:00
|
|
|
QString projectDirectory = projectPath.toFileInfo().absolutePath();
|
2014-10-20 17:23:07 +02:00
|
|
|
QDir qtSourceDir = QDir(version->sourcePath().toString());
|
|
|
|
|
QString relativeProjectPath = qtSourceDir.relativeFilePath(projectDirectory);
|
2019-09-30 14:34:31 +02:00
|
|
|
QString qtBuildDir = version->prefix().toString();
|
2014-10-20 17:23:07 +02:00
|
|
|
QString absoluteBuildPath = QDir::cleanPath(qtBuildDir + QLatin1Char('/') + relativeProjectPath);
|
|
|
|
|
|
2019-05-28 13:49:26 +02:00
|
|
|
info.buildDirectory = FilePath::fromString(absoluteBuildPath);
|
2014-10-20 17:23:07 +02:00
|
|
|
} else {
|
2019-12-04 13:19:34 +01:00
|
|
|
info.buildDirectory =
|
|
|
|
|
QmakeBuildConfiguration::shadowBuildDirectory(projectPath, k, suffix, type);
|
2014-10-20 17:23:07 +02:00
|
|
|
}
|
2019-01-29 16:51:17 +01:00
|
|
|
info.buildType = type;
|
|
|
|
|
info.extraInfo = QVariant::fromValue(extraInfo);
|
2013-07-22 15:53:57 +02:00
|
|
|
return info;
|
2012-04-04 16:06:35 +02:00
|
|
|
}
|
|
|
|
|
|
2020-01-09 18:42:28 +01:00
|
|
|
QmakeBuildConfigurationFactory::QmakeBuildConfigurationFactory()
|
|
|
|
|
{
|
|
|
|
|
registerBuildConfiguration<QmakeBuildConfiguration>(Constants::QMAKE_BC_ID);
|
|
|
|
|
setSupportedProjectType(Constants::QMAKEPROJECT_ID);
|
|
|
|
|
setSupportedProjectMimeTypeName(Constants::PROFILE_MIMETYPE);
|
2023-01-11 15:46:28 +01:00
|
|
|
setIssueReporter([](Kit *k, const FilePath &projectPath, const FilePath &buildDir) {
|
2022-01-21 16:06:36 +01:00
|
|
|
QtSupport::QtVersion *version = QtSupport::QtKitAspect::qtVersion(k);
|
2020-01-09 18:42:28 +01:00
|
|
|
Tasks issues;
|
|
|
|
|
if (version)
|
|
|
|
|
issues << version->reportIssues(projectPath, buildDir);
|
2023-05-15 12:42:08 +02:00
|
|
|
if (settings().warnAgainstUnalignedBuildDir()
|
2020-01-09 18:42:28 +01:00
|
|
|
&& !QmakeBuildConfiguration::isBuildDirAtSafeLocation(
|
2023-01-11 15:46:28 +01:00
|
|
|
projectPath.absolutePath(), buildDir.absoluteFilePath())) {
|
2020-01-15 08:56:11 +01:00
|
|
|
issues.append(BuildSystemTask(Task::Warning,
|
|
|
|
|
QmakeBuildConfiguration::unalignedBuildDirWarning()));
|
2020-01-09 18:42:28 +01:00
|
|
|
}
|
|
|
|
|
return issues;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
setBuildGenerator([](const Kit *k, const FilePath &projectPath, bool forSetup) {
|
|
|
|
|
QList<BuildInfo> result;
|
|
|
|
|
|
2022-01-21 16:06:36 +01:00
|
|
|
QtVersion *qtVersion = QtKitAspect::qtVersion(k);
|
2020-01-09 18:42:28 +01:00
|
|
|
|
|
|
|
|
if (forSetup && (!qtVersion || !qtVersion->isValid()))
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
const auto addBuild = [&](BuildConfiguration::BuildType buildType) {
|
|
|
|
|
BuildInfo info = createBuildInfo(k, projectPath, buildType);
|
|
|
|
|
if (!forSetup) {
|
|
|
|
|
info.displayName.clear(); // ask for a name
|
|
|
|
|
info.buildDirectory.clear(); // This depends on the displayName
|
|
|
|
|
}
|
|
|
|
|
result << info;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
addBuild(BuildConfiguration::Debug);
|
|
|
|
|
addBuild(BuildConfiguration::Release);
|
2022-07-04 18:36:40 +02:00
|
|
|
if (qtVersion && qtVersion->qtVersion().majorVersion() > 4)
|
2020-01-09 18:42:28 +01:00
|
|
|
addBuild(BuildConfiguration::Profile);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
BuildConfiguration::BuildType QmakeBuildConfiguration::buildType() const
|
2011-03-03 16:12:00 +01:00
|
|
|
{
|
2022-01-21 16:06:36 +01:00
|
|
|
if (qmakeBuildConfiguration() & QtVersion::DebugBuild)
|
2011-03-03 16:12:00 +01:00
|
|
|
return Debug;
|
2019-11-15 16:20:33 +01:00
|
|
|
if (separateDebugInfo() == TriState::Enabled)
|
2015-02-20 15:10:56 +01:00
|
|
|
return Profile;
|
2019-11-28 14:37:02 +01:00
|
|
|
return Release;
|
2011-03-03 16:12:00 +01:00
|
|
|
}
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2017-10-17 12:27:37 +02:00
|
|
|
void QmakeBuildConfiguration::addToEnvironment(Environment &env) const
|
|
|
|
|
{
|
2020-11-23 08:17:19 +01:00
|
|
|
QtSupport::QtKitAspect::addHostBinariesToPath(kit(), env);
|
2017-10-17 12:27:37 +02:00
|
|
|
}
|
|
|
|
|
|
2018-07-12 23:59:51 +02:00
|
|
|
QmakeBuildConfiguration::LastKitState::LastKitState() = default;
|
2012-10-18 15:35:10 +02:00
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
QmakeBuildConfiguration::LastKitState::LastKitState(Kit *k)
|
2019-02-06 12:50:51 +01:00
|
|
|
: m_qtVersion(QtKitAspect::qtVersionId(k)),
|
|
|
|
|
m_sysroot(SysRootKitAspect::sysRoot(k).toString()),
|
2019-05-27 15:19:36 +02:00
|
|
|
m_mkspec(QmakeKitAspect::mkspec(k))
|
2012-10-18 15:35:10 +02:00
|
|
|
{
|
2020-02-18 18:25:26 +01:00
|
|
|
ToolChain *tc = ToolChainKitAspect::cxxToolChain(k);
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-03 15:09:51 +02:00
|
|
|
bool QmakeBuildConfiguration::regenerateBuildFiles(Node *node)
|
|
|
|
|
{
|
|
|
|
|
QMakeStep *qs = qmakeStep();
|
|
|
|
|
if (!qs)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
qs->setForced(true);
|
|
|
|
|
|
2019-12-05 16:19:42 +01:00
|
|
|
BuildManager::buildList(cleanSteps());
|
2020-04-22 11:27:46 +02:00
|
|
|
BuildManager::appendStep(qs, BuildManager::displayNameForStepId(ProjectExplorer::Constants::BUILDSTEPS_CLEAN));
|
2018-07-03 15:09:51 +02:00
|
|
|
|
|
|
|
|
QmakeProFileNode *proFile = nullptr;
|
2020-09-07 15:56:18 +02:00
|
|
|
if (node && node != project()->rootProjectNode())
|
2018-07-03 15:09:51 +02:00
|
|
|
proFile = dynamic_cast<QmakeProFileNode *>(node);
|
|
|
|
|
|
|
|
|
|
setSubNodeBuild(proFile);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-04 17:23:02 +01:00
|
|
|
void QmakeBuildConfiguration::restrictNextBuild(const RunConfiguration *rc)
|
|
|
|
|
{
|
|
|
|
|
if (!rc) {
|
|
|
|
|
setSubNodeBuild(nullptr);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const auto productNode = dynamic_cast<QmakeProFileNode *>(rc->productNode());
|
|
|
|
|
QTC_ASSERT(productNode, return);
|
|
|
|
|
setSubNodeBuild(productNode);
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-16 11:02:37 +02:00
|
|
|
} // namespace QmakeProjectManager
|