forked from qt-creator/qt-creator
Detach QML debugging option from qmakes build mode
The coupling of qml_debug to qmake's Debug profile is both brittle and wrong. There are good reasons to also enable qml debugging in certain Release builds and changing the build type of a specific build often leaves the UI in an inconsistent state. Change-Id: I89cb86849c984278ebfc54f66f139ec482b18d9a Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -570,6 +570,8 @@ QmakeBuildInfo *QmakeBuildConfigurationFactory::createBuildInfo(const Kit *k,
|
||||
info->displayName = tr("Debug");
|
||||
//: Non-ASCII characters in directory suffix may cause build issues.
|
||||
suffix = tr("Debug", "Shadow build directory suffix");
|
||||
if (version && version->qtVersion().majorVersion >= 5)
|
||||
info->config.linkQmlDebuggingQQ2 = true;
|
||||
}
|
||||
info->typeName = info->displayName;
|
||||
// Leave info->buildDirectory unset;
|
||||
@@ -669,7 +671,6 @@ void QmakeBuildConfigurationFactory::configureBuildConfiguration(Target *parent,
|
||||
QString additionalArguments = qmakeInfo->additionalArguments;
|
||||
if (!additionalArguments.isEmpty())
|
||||
qmakeStep->setUserArguments(additionalArguments);
|
||||
if (!qmakeInfo->makefile.isEmpty())
|
||||
qmakeStep->setLinkQmlDebuggingLibrary(qmakeInfo->config.linkQmlDebuggingQQ2);
|
||||
qmakeStep->setSeparateDebugInfo(qmakeInfo->config.separateDebugInfo);
|
||||
qmakeStep->setUseQtQuickCompiler(qmakeInfo->config.useQtQuickCompiler);
|
||||
|
||||
@@ -324,23 +324,15 @@ void QMakeStep::setUserArguments(const QString &arguments)
|
||||
|
||||
bool QMakeStep::linkQmlDebuggingLibrary() const
|
||||
{
|
||||
if (m_linkQmlDebuggingLibrary == DoLink)
|
||||
return true;
|
||||
if (m_linkQmlDebuggingLibrary == DoNotLink)
|
||||
return false;
|
||||
|
||||
const Core::Context languages = project()->projectLanguages();
|
||||
if (!languages.contains(ProjectExplorer::Constants::LANG_QMLJS))
|
||||
return false;
|
||||
return (qmakeBuildConfiguration()->buildType() & BuildConfiguration::Debug);
|
||||
return m_linkQmlDebuggingLibrary;
|
||||
}
|
||||
|
||||
void QMakeStep::setLinkQmlDebuggingLibrary(bool enable)
|
||||
{
|
||||
if ((enable && (m_linkQmlDebuggingLibrary == DoLink))
|
||||
|| (!enable && (m_linkQmlDebuggingLibrary == DoNotLink)))
|
||||
if (enable == m_linkQmlDebuggingLibrary)
|
||||
return;
|
||||
m_linkQmlDebuggingLibrary = enable ? DoLink : DoNotLink;
|
||||
|
||||
m_linkQmlDebuggingLibrary = enable;
|
||||
|
||||
emit linkQmlDebuggingLibraryChanged();
|
||||
|
||||
@@ -414,8 +406,7 @@ QVariantMap QMakeStep::toMap() const
|
||||
{
|
||||
QVariantMap map(AbstractProcessStep::toMap());
|
||||
map.insert(QLatin1String(QMAKE_ARGUMENTS_KEY), m_userArgs);
|
||||
map.insert(QLatin1String(QMAKE_QMLDEBUGLIBAUTO_KEY), m_linkQmlDebuggingLibrary == DebugLink);
|
||||
map.insert(QLatin1String(QMAKE_QMLDEBUGLIB_KEY), m_linkQmlDebuggingLibrary == DoLink);
|
||||
map.insert(QLatin1String(QMAKE_QMLDEBUGLIB_KEY), m_linkQmlDebuggingLibrary);
|
||||
map.insert(QLatin1String(QMAKE_FORCED_KEY), m_forced);
|
||||
map.insert(QLatin1String(QMAKE_USE_QTQUICKCOMPILER), m_useQtQuickCompiler);
|
||||
map.insert(QLatin1String(QMAKE_SEPARATEDEBUGINFO_KEY), m_separateDebugInfo);
|
||||
@@ -427,13 +418,15 @@ bool QMakeStep::fromMap(const QVariantMap &map)
|
||||
m_userArgs = map.value(QLatin1String(QMAKE_ARGUMENTS_KEY)).toString();
|
||||
m_forced = map.value(QLatin1String(QMAKE_FORCED_KEY), false).toBool();
|
||||
m_useQtQuickCompiler = map.value(QLatin1String(QMAKE_USE_QTQUICKCOMPILER), false).toBool();
|
||||
|
||||
// QMAKE_QMLDEBUGLIBAUTO_KEY was used in versions 2.3 to 3.5 (both included) to automatically
|
||||
// change the qml_debug CONFIG flag based no the qmake build configuration.
|
||||
if (map.value(QLatin1String(QMAKE_QMLDEBUGLIBAUTO_KEY), false).toBool()) {
|
||||
m_linkQmlDebuggingLibrary = DebugLink;
|
||||
m_linkQmlDebuggingLibrary =
|
||||
project()->projectLanguages().contains(ProjectExplorer::Constants::LANG_QMLJS) &&
|
||||
(qmakeBuildConfiguration()->qmakeBuildConfiguration() & BaseQtVersion::DebugBuild);
|
||||
} else {
|
||||
if (map.value(QLatin1String(QMAKE_QMLDEBUGLIB_KEY), false).toBool())
|
||||
m_linkQmlDebuggingLibrary = DoLink;
|
||||
else
|
||||
m_linkQmlDebuggingLibrary = DoNotLink;
|
||||
m_linkQmlDebuggingLibrary = map.value(QLatin1String(QMAKE_QMLDEBUGLIB_KEY), false).toBool();
|
||||
}
|
||||
m_separateDebugInfo = map.value(QLatin1String(QMAKE_SEPARATEDEBUGINFO_KEY), false).toBool();
|
||||
|
||||
|
||||
@@ -124,12 +124,6 @@ class QMAKEPROJECTMANAGER_EXPORT QMakeStep : public ProjectExplorer::AbstractPro
|
||||
Q_OBJECT
|
||||
friend class Internal::QMakeStepFactory;
|
||||
|
||||
enum QmlLibraryLink {
|
||||
DoNotLink = 0,
|
||||
DoLink,
|
||||
DebugLink
|
||||
};
|
||||
|
||||
// used in DebuggerRunConfigurationAspect
|
||||
Q_PROPERTY(bool linkQmlDebuggingLibrary READ linkQmlDebuggingLibrary WRITE setLinkQmlDebuggingLibrary NOTIFY linkQmlDebuggingLibraryChanged)
|
||||
|
||||
@@ -184,7 +178,7 @@ private:
|
||||
bool m_forced = false;
|
||||
bool m_needToRunQMake = false; // set in init(), read in run()
|
||||
QString m_userArgs;
|
||||
QmlLibraryLink m_linkQmlDebuggingLibrary = DebugLink;
|
||||
bool m_linkQmlDebuggingLibrary = false;
|
||||
bool m_useQtQuickCompiler = false;
|
||||
bool m_scriptTemplate = false;
|
||||
bool m_separateDebugInfo = false;
|
||||
|
||||
Reference in New Issue
Block a user