QmakeBuildConfiguration: Make use of SeparateDebugInfoAspect

Change-Id: I0dceadf2a6ef34187fa4107f3fc5d6831ecb7bfe
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2019-11-28 14:37:02 +01:00
parent 110f8491c9
commit 8a2fb30378
5 changed files with 52 additions and 73 deletions

View File

@@ -224,7 +224,7 @@ void MakeFileParse::parseAssignments(QList<QMakeAssignment> *assignments)
}
if (foundForceDebugInfo && foundSeparateDebugInfo) {
m_config.separateDebugInfo = true;
m_config.separateDebugInfo = ProjectExplorer::SeparateDebugInfoAspect::Value::Enabled;
} else if (foundForceDebugInfo) {
// Found only force_debug_info, so readd it
QMakeAssignment newQA;
@@ -376,7 +376,8 @@ void MakeFileParse::parseCommandLine(const QString &command, const QString &proj
qCDebug(logging()) << " OsType" << m_config.osType;
qCDebug(logging()) << " LinkQmlDebuggingQQ2" << m_config.linkQmlDebuggingQQ2;
qCDebug(logging()) << " Qt Quick Compiler" << m_config.useQtQuickCompiler;
qCDebug(logging()) << " Separate Debug Info" << m_config.separateDebugInfo;
qCDebug(logging()) << " Separate Debug Info"
<< (m_config.separateDebugInfo == ProjectExplorer::SeparateDebugInfoAspect::Value::Enabled);
// Create command line of all unfiltered arguments
foreach (const QMakeAssignment &qa, assignments)
@@ -523,6 +524,7 @@ void QmakeProjectManagerPlugin::testMakefileParser()
QCOMPARE(qmsc.osType, static_cast<QMakeStepConfig::OsType>(osType));
QCOMPARE(qmsc.linkQmlDebuggingQQ2, linkQmlDebuggingQQ2);
QCOMPARE(qmsc.useQtQuickCompiler, useQtQuickCompiler);
QCOMPARE(qmsc.separateDebugInfo, separateDebugInfo);
QCOMPARE(qmsc.separateDebugInfo == ProjectExplorer::SeparateDebugInfoAspect::Value::Enabled,
separateDebugInfo);
}
#endif

View File

@@ -41,7 +41,6 @@
#include <coreplugin/documentmanager.h>
#include <coreplugin/icore.h>
#include <projectexplorer/buildaspects.h>
#include <projectexplorer/buildinfo.h>
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/buildsteplist.h>
@@ -130,6 +129,13 @@ QmakeBuildConfiguration::QmakeBuildConfiguration(Target *target, Core::Id id)
connect(target, &Target::parsingFinished, this, &QmakeBuildConfiguration::updateProblemLabel);
connect(target, &Target::kitChanged, this, &QmakeBuildConfiguration::updateProblemLabel);
const auto separateDebugInfoAspect = addAspect<SeparateDebugInfoAspect>();
connect(separateDebugInfoAspect, &SeparateDebugInfoAspect::changed, this, [this] {
emit separateDebugInfoChanged();
emit qmakeBuildConfigurationChanged();
qmakeBuildSystem()->scheduleUpdateAllNowOrLater();
});
}
void QmakeBuildConfiguration::initialize()
@@ -157,7 +163,8 @@ void QmakeBuildConfiguration::initialize()
if (!additionalArguments.isEmpty())
qmakeStep->setUserArguments(additionalArguments);
qmakeStep->setLinkQmlDebuggingLibrary(qmakeExtra.config.linkQmlDebuggingQQ2);
qmakeStep->setSeparateDebugInfo(qmakeExtra.config.separateDebugInfo);
if (qmakeExtra.config.separateDebugInfo == SeparateDebugInfoAspect::Value::Enabled)
forceSeparateDebugInfo(true);
qmakeStep->setUseQtQuickCompiler(qmakeExtra.config.useQtQuickCompiler);
setQMakeBuildConfiguration(config);
@@ -388,6 +395,18 @@ bool QmakeBuildConfiguration::isBuildDirAtSafeLocation() const
buildDirectory().toString());
}
SeparateDebugInfoAspect::Value QmakeBuildConfiguration::separateDebugInfo() const
{
return aspect<SeparateDebugInfoAspect>()->setting();
}
void QmakeBuildConfiguration::forceSeparateDebugInfo(bool sepDebugInfo)
{
aspect<SeparateDebugInfoAspect>()->setSetting(sepDebugInfo
? SeparateDebugInfoAspect::Value::Enabled
: SeparateDebugInfoAspect::Value::Disabled);
}
QStringList QmakeBuildConfiguration::configCommandLineArguments() const
{
QStringList result;
@@ -684,7 +703,7 @@ BuildInfo QmakeBuildConfigurationFactory::createBuildInfo(const Kit *k,
info.displayName = tr("Profile");
//: Non-ASCII characters in directory suffix may cause build issues.
suffix = tr("Profile", "Shadow build directory suffix");
extraInfo.config.separateDebugInfo = true;
extraInfo.config.separateDebugInfo = SeparateDebugInfoAspect::Value::Enabled;
if (version && version->isQtQuickCompilerSupported())
extraInfo.config.useQtQuickCompiler = true;
}
@@ -747,12 +766,10 @@ QList<BuildInfo> QmakeBuildConfigurationFactory::availableBuilds(const Kit *k, c
BuildConfiguration::BuildType QmakeBuildConfiguration::buildType() const
{
QMakeStep *qs = qmakeStep();
if (qmakeBuildConfiguration() & BaseQtVersion::DebugBuild)
return Debug;
else if (qs && qs->separateDebugInfo())
if (separateDebugInfo() == SeparateDebugInfoAspect::Value::Enabled)
return Profile;
else
return Release;
}

View File

@@ -27,6 +27,7 @@
#include "qmakeprojectmanager_global.h"
#include <projectexplorer/buildaspects.h>
#include <projectexplorer/buildconfiguration.h>
#include <qtsupport/baseqtversion.h>
@@ -95,11 +96,16 @@ public:
static bool isBuildDirAtSafeLocation(const QString &sourceDir, const QString &buildDir);
bool isBuildDirAtSafeLocation() const;
ProjectExplorer::SeparateDebugInfoAspect::Value separateDebugInfo() const;
void forceSeparateDebugInfo(bool sepDebugInfo);
signals:
/// emitted for setQMakeBuildConfig, not emitted for Qt version changes, even
/// if those change the qmakebuildconfig
void qmakeBuildConfigurationChanged();
void separateDebugInfoChanged(); // TODO: Check whether really needed.
protected:
bool fromMap(const QVariantMap &map) override;
bool regenerateBuildFiles(ProjectExplorer::Node *node = nullptr) override;

View File

@@ -73,7 +73,6 @@ namespace {
const char QMAKE_ARGUMENTS_KEY[] = "QtProjectManager.QMakeBuildStep.QMakeArguments";
const char QMAKE_FORCED_KEY[] = "QtProjectManager.QMakeBuildStep.QMakeForced";
const char QMAKE_USE_QTQUICKCOMPILER[] = "QtProjectManager.QMakeBuildStep.UseQtQuickCompiler";
const char QMAKE_SEPARATEDEBUGINFO_KEY[] = "QtProjectManager.QMakeBuildStep.SeparateDebugInfo";
const char QMAKE_QMLDEBUGLIBAUTO_KEY[] = "QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto";
const char QMAKE_QMLDEBUGLIB_KEY[] = "QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary";
}
@@ -168,8 +167,7 @@ QMakeStepConfig QMakeStep::deducedArguments() const
if (useQtQuickCompiler() && version)
config.useQtQuickCompiler = true;
if (separateDebugInfo())
config.separateDebugInfo = true;
config.separateDebugInfo = qmakeBuildConfiguration()->separateDebugInfo();
return config;
}
@@ -434,23 +432,6 @@ void QMakeStep::setUseQtQuickCompiler(bool enable)
qmakeBuildSystem()->scheduleUpdateAllNowOrLater();
}
bool QMakeStep::separateDebugInfo() const
{
return m_separateDebugInfo;
}
void QMakeStep::setSeparateDebugInfo(bool enable)
{
if (enable == m_separateDebugInfo)
return;
m_separateDebugInfo = enable;
emit separateDebugInfoChanged();
emit qmakeBuildConfiguration()->qmakeBuildConfigurationChanged();
qmakeBuildSystem()->scheduleUpdateAllNowOrLater();
}
FilePath QMakeStep::makeCommand() const
{
if (auto ms = stepList()->firstOfType<MakeStep>())
@@ -529,7 +510,6 @@ QVariantMap QMakeStep::toMap() const
map.insert(QMAKE_QMLDEBUGLIB_KEY, m_linkQmlDebuggingLibrary);
map.insert(QMAKE_FORCED_KEY, m_forced);
map.insert(QMAKE_USE_QTQUICKCOMPILER, m_useQtQuickCompiler);
map.insert(QMAKE_SEPARATEDEBUGINFO_KEY, m_separateDebugInfo);
return map;
}
@@ -549,7 +529,12 @@ bool QMakeStep::fromMap(const QVariantMap &map)
} else {
m_linkQmlDebuggingLibrary = map.value(QMAKE_QMLDEBUGLIB_KEY, false).toBool();
}
m_separateDebugInfo = map.value(QMAKE_SEPARATEDEBUGINFO_KEY, false).toBool();
// Backwards compatibility with < Creator 4.12.
const QVariant separateDebugInfo
= map.value("QtProjectManager.QMakeBuildStep.SeparateDebugInfo");
if (separateDebugInfo.isValid())
qmakeBuildConfiguration()->forceSeparateDebugInfo(separateDebugInfo.toBool());
return BuildStep::fromMap(map);
}
@@ -584,12 +569,6 @@ QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step)
qmakeAdditonalArgumentsLineEdit = new QLineEdit(this);
auto separateDebugInfoLabel = new QLabel(tr("Generate separate debug info:"), this);
auto widget_2 = new QWidget(this);
auto separateDebugInfoCheckBox = new QCheckBox(widget_2);
debuggingLibraryLabel = new QLabel("Link QML debugging library:", this);
auto widget_3 = new QWidget(this);
@@ -640,7 +619,6 @@ QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step)
abisListWidget = new QListWidget(this);
separateDebugInfoCheckBox->setText(QString());
qmlDebuggingLibraryCheckBox->setText(QString());
qmlDebuggingWarningText->setText(QString());
qtQuickCompilerCheckBox->setText(QString());
@@ -649,20 +627,13 @@ QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step)
qmakeAdditonalArgumentsLineEdit->setText(m_step->userArguments());
qmlDebuggingLibraryCheckBox->setChecked(m_step->linkQmlDebuggingLibrary());
qtQuickCompilerCheckBox->setChecked(m_step->useQtQuickCompiler());
separateDebugInfoCheckBox->setChecked(m_step->separateDebugInfo());
const QPixmap warning = Utils::Icons::WARNING.pixmap();
qmlDebuggingWarningIcon->setPixmap(warning);
qtQuickCompilerWarningIcon->setPixmap(warning);
auto horizontalLayout_2 = new QHBoxLayout(widget_2);
horizontalLayout_2->setContentsMargins(0, 0, 0, 0);
horizontalLayout_2->addWidget(separateDebugInfoCheckBox);
horizontalLayout_2->addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
auto formLayout = new QFormLayout(this);
formLayout->addRow(label_0, buildConfigurationWidget);
formLayout->addRow(qmakeArgsLabel, qmakeAdditonalArgumentsLineEdit);
formLayout->addRow(separateDebugInfoLabel, widget_2);
formLayout->addRow(debuggingLibraryLabel, widget_3);
formLayout->addRow(qtQuickCompilerLabel, widget_4);
formLayout->addRow(label, qmakeArgumentsEdit);
@@ -688,10 +659,6 @@ QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step)
this, &QMakeStepConfigWidget::useQtQuickCompilerChecked);
connect(qtQuickCompilerCheckBox, &QCheckBox::clicked,
this, [this] { askForRebuild(tr("QML Debugging")); });
connect(separateDebugInfoCheckBox, &QAbstractButton::toggled,
this, &QMakeStepConfigWidget::separateDebugInfoChecked);
connect(separateDebugInfoCheckBox, &QCheckBox::clicked,
this, [this] { askForRebuild(tr("QMake Configuration")); });
connect(step, &QMakeStep::userArgumentsChanged,
this, &QMakeStepConfigWidget::userArgumentsChanged);
connect(step, &QMakeStep::linkQmlDebuggingLibraryChanged,
@@ -702,7 +669,7 @@ QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step)
this, &QMakeStepConfigWidget::updateEffectiveQMakeCall);
connect(step, &QMakeStep::useQtQuickCompilerChanged,
this, &QMakeStepConfigWidget::useQtQuickCompilerChanged);
connect(step, &QMakeStep::separateDebugInfoChanged,
connect(step->qmakeBuildConfiguration(), &QmakeBuildConfiguration::separateDebugInfoChanged,
this, &QMakeStepConfigWidget::separateDebugInfoChanged);
connect(step->qmakeBuildConfiguration(), &QmakeBuildConfiguration::qmakeBuildConfigurationChanged,
this, &QMakeStepConfigWidget::qmakeBuildConfigChanged);
@@ -784,6 +751,7 @@ void QMakeStepConfigWidget::separateDebugInfoChanged()
updateSummaryLabel();
updateEffectiveQMakeCall();
askForRebuild(tr("Separate Debug Information"));
}
void QMakeStepConfigWidget::abisChanged()
@@ -885,19 +853,6 @@ void QMakeStepConfigWidget::useQtQuickCompilerChecked(bool checked)
updateQtQuickCompilerOption();
}
void QMakeStepConfigWidget::separateDebugInfoChecked(bool checked)
{
if (m_ignoreChange)
return;
m_ignoreChange = true;
m_step->setSeparateDebugInfo(checked);
m_ignoreChange = false;
updateSummaryLabel();
updateEffectiveQMakeCall();
}
void QMakeStepConfigWidget::updateSummaryLabel()
{
BaseQtVersion *qtVersion = QtKitAspect::qtVersion(m_step->target()->kit());
@@ -1071,8 +1026,10 @@ QStringList QMakeStepConfig::toArguments() const
if (useQtQuickCompiler)
arguments << "CONFIG+=qtquickcompiler";
if (separateDebugInfo)
if (separateDebugInfo == SeparateDebugInfoAspect::Value::Enabled)
arguments << "CONFIG+=force_debug_info" << "CONFIG+=separate_debug_info";
else if (separateDebugInfo == SeparateDebugInfoAspect::Value::Disabled)
arguments << "CONFIG-=separate_debug_info";
if (!sysRoot.isEmpty()) {
arguments << ("QMAKE_CFLAGS+=--sysroot=\"" + sysRoot + "\"");

View File

@@ -28,6 +28,7 @@
#include "qmakeprojectmanager_global.h"
#include <projectexplorer/abstractprocessstep.h>
#include <projectexplorer/buildaspects.h>
#include <utils/fileutils.h>
@@ -83,9 +84,10 @@ public:
QString targetTriple;
TargetArchConfig archConfig = NoArch;
OsType osType = NoOsType;
ProjectExplorer::SeparateDebugInfoAspect::Value separateDebugInfo
= ProjectExplorer::SeparateDebugInfoAspect::Value::Default;
bool linkQmlDebuggingQQ2 = false;
bool useQtQuickCompiler = false;
bool separateDebugInfo = false;
};
@@ -102,7 +104,8 @@ inline bool operator !=(const QMakeStepConfig &a, const QMakeStepConfig &b) {
inline QDebug operator<<(QDebug dbg, const QMakeStepConfig &c)
{
dbg << c.archConfig << c.osType << c.linkQmlDebuggingQQ2 << c.useQtQuickCompiler << c.separateDebugInfo;
dbg << c.archConfig << c.osType << c.linkQmlDebuggingQQ2 << c.useQtQuickCompiler
<< (c.separateDebugInfo == ProjectExplorer::SeparateDebugInfoAspect::Value::Enabled);
return dbg;
}
@@ -151,8 +154,6 @@ public:
void setLinkQmlDebuggingLibrary(bool enable);
bool useQtQuickCompiler() const;
void setUseQtQuickCompiler(bool enable);
bool separateDebugInfo() const;
void setSeparateDebugInfo(bool enable);
Utils::FilePath makeCommand() const;
QString makeArguments(const QString &makefile) const;
@@ -165,7 +166,6 @@ signals:
void extraArgumentsChanged();
void linkQmlDebuggingLibraryChanged();
void useQtQuickCompilerChanged();
void separateDebugInfoChanged();
protected:
bool fromMap(const QVariantMap &map) override;
@@ -198,7 +198,6 @@ private:
bool m_linkQmlDebuggingLibrary = false;
bool m_useQtQuickCompiler = false;
bool m_scriptTemplate = false;
bool m_separateDebugInfo = false;
};
@@ -224,7 +223,6 @@ private:
void buildConfigurationSelected();
void linkQmlDebuggingLibraryChecked(bool checked);
void useQtQuickCompilerChecked(bool checked);
void separateDebugInfoChecked(bool checked);
void askForRebuild(const QString &title);
void recompileMessageBoxFinished(int button);
@@ -242,7 +240,6 @@ private:
QLabel *abisLabel = nullptr;
QComboBox *buildConfigurationComboBox = nullptr;
QLineEdit *qmakeAdditonalArgumentsLineEdit = nullptr;
QCheckBox *separateDebugInfoCheckBox = nullptr;
QLabel *debuggingLibraryLabel = nullptr;
QCheckBox *qmlDebuggingLibraryCheckBox = nullptr;
QCheckBox *qtQuickCompilerCheckBox = nullptr;