forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.0'
This commit is contained in:
@@ -60,8 +60,8 @@
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
static QStringList toArguments(const CMakeConfig &config) {
|
||||
return Utils::transform(config, [](const CMakeConfigItem &i) -> QString {
|
||||
static QStringList toArguments(const CMakeConfig &config, const ProjectExplorer::Kit *k) {
|
||||
return Utils::transform(config, [k](const CMakeConfigItem &i) -> QString {
|
||||
QString a = QString::fromLatin1("-D");
|
||||
a.append(QString::fromUtf8(i.key));
|
||||
switch (i.type) {
|
||||
@@ -81,7 +81,7 @@ static QStringList toArguments(const CMakeConfig &config) {
|
||||
a.append(QLatin1String(":INTERNAL="));
|
||||
break;
|
||||
}
|
||||
a.append(QString::fromUtf8(i.value));
|
||||
a.append(QString::fromUtf8(k->macroExpander()->expand(i.value)));
|
||||
|
||||
return a;
|
||||
});
|
||||
@@ -110,6 +110,7 @@ BuildDirManager::BuildDirManager(const CMakeBuildConfiguration *bc) :
|
||||
|
||||
BuildDirManager::~BuildDirManager()
|
||||
{
|
||||
stopProcess();
|
||||
resetData();
|
||||
delete m_tempDir;
|
||||
}
|
||||
@@ -153,6 +154,9 @@ bool BuildDirManager::isParsing() const
|
||||
|
||||
void BuildDirManager::forceReparse()
|
||||
{
|
||||
if (m_buildConfiguration->target()->activeBuildConfiguration() != m_buildConfiguration)
|
||||
return;
|
||||
|
||||
stopProcess();
|
||||
|
||||
CMakeTool *tool = CMakeKitInformation::cmakeTool(kit());
|
||||
@@ -424,11 +428,11 @@ void BuildDirManager::startCMake(CMakeTool *tool, const QString &generator,
|
||||
Utils::QtcProcess::addArg(&args, srcDir);
|
||||
if (!generator.isEmpty())
|
||||
Utils::QtcProcess::addArg(&args, QString::fromLatin1("-G%1").arg(generator));
|
||||
Utils::QtcProcess::addArgs(&args, toArguments(config));
|
||||
Utils::QtcProcess::addArgs(&args, toArguments(config, kit()));
|
||||
|
||||
ProjectExplorer::TaskHub::clearTasks(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
|
||||
|
||||
Core::MessageManager::write(tr("Running '%1 %2' in %3.")
|
||||
Core::MessageManager::write(tr("Running \"%1 %2\" in %3.")
|
||||
.arg(tool->cmakeExecutable().toUserOutput())
|
||||
.arg(args)
|
||||
.arg(workDirectory().toUserOutput()));
|
||||
|
||||
@@ -266,12 +266,14 @@ bool CMakeBuildStep::immutable() const
|
||||
void CMakeBuildStep::stdOutput(const QString &line)
|
||||
{
|
||||
if (m_percentProgress.indexIn(line) != -1) {
|
||||
AbstractProcessStep::stdOutput(line);
|
||||
bool ok = false;
|
||||
int percent = m_percentProgress.cap(1).toInt(&ok);
|
||||
if (ok)
|
||||
futureInterface()->setProgressValue(percent);
|
||||
return;
|
||||
} else if (m_ninjaProgress.indexIn(line) != -1) {
|
||||
AbstractProcessStep::stdOutput(line);
|
||||
m_useNinja = true;
|
||||
bool ok = false;
|
||||
int done = m_ninjaProgress.cap(1).toInt(&ok);
|
||||
|
||||
@@ -41,26 +41,6 @@ CMakeFile::CMakeFile(const FileName &fileName)
|
||||
setFilePath(fileName);
|
||||
}
|
||||
|
||||
bool CMakeFile::save(QString *errorString, const QString &fileName, bool autoSave)
|
||||
{
|
||||
// Once we have an texteditor open for this file, we probably do
|
||||
// need to implement this, don't we.
|
||||
Q_UNUSED(errorString)
|
||||
Q_UNUSED(fileName)
|
||||
Q_UNUSED(autoSave)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMakeFile::isModified() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMakeFile::isSaveAsAllowed() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Core::IDocument::ReloadBehavior CMakeFile::reloadBehavior(ChangeTrigger state, ChangeType type) const
|
||||
{
|
||||
Q_UNUSED(state)
|
||||
@@ -68,12 +48,5 @@ Core::IDocument::ReloadBehavior CMakeFile::reloadBehavior(ChangeTrigger state, C
|
||||
return BehaviorSilent;
|
||||
}
|
||||
|
||||
bool CMakeFile::reload(QString *errorString, ReloadFlag flag, ChangeType type)
|
||||
{
|
||||
Q_UNUSED(errorString)
|
||||
Q_UNUSED(flag)
|
||||
Q_UNUSED(type)
|
||||
return true;
|
||||
}
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
|
||||
@@ -38,13 +38,7 @@ class CMakeFile : public Core::IDocument
|
||||
public:
|
||||
CMakeFile(const Utils::FileName &fileName);
|
||||
|
||||
bool save(QString *errorString, const QString &fileName, bool autoSave) override;
|
||||
|
||||
bool isModified() const override;
|
||||
bool isSaveAsAllowed() const override;
|
||||
|
||||
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
|
||||
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -325,14 +325,12 @@ void CMakeConfigurationKitInformation::fromStringList(Kit *k, const QStringList
|
||||
|
||||
QVariant CMakeConfigurationKitInformation::defaultValue(const Kit *k) const
|
||||
{
|
||||
Q_UNUSED(k);
|
||||
|
||||
// FIXME: Convert preload scripts
|
||||
CMakeConfig config;
|
||||
const QtSupport::BaseQtVersion *const version = QtSupport::QtKitInformation::qtVersion(k);
|
||||
if (version && version->isValid())
|
||||
config << CMakeConfigItem(CMAKE_QMAKE_KEY, version->qmakeCommand().toString().toUtf8());
|
||||
const ToolChain *const tc = ToolChainKitInformation::toolChain(k);
|
||||
if (tc && tc->isValid())
|
||||
config << CMakeConfigItem(CMAKE_TOOLCHAIN_KEY, tc->compilerCommand().toString().toUtf8());
|
||||
config << CMakeConfigItem(CMAKE_QMAKE_KEY, "%{Qt:qmakeExecutable}");
|
||||
config << CMakeConfigItem(CMAKE_TOOLCHAIN_KEY, "%{Compiler:Executable}");
|
||||
|
||||
const QStringList tmp
|
||||
= Utils::transform(config, [](const CMakeConfigItem &i) { return i.toString(); });
|
||||
@@ -348,10 +346,12 @@ QList<Task> CMakeConfigurationKitInformation::validate(const Kit *k) const
|
||||
QByteArray qmakePath;
|
||||
QByteArray tcPath;
|
||||
foreach (const CMakeConfigItem &i, config) {
|
||||
// Do not use expand(QByteArray) as we can not be sure the input is latin1
|
||||
const QByteArray expandedValue = k->macroExpander()->expand(QString::fromUtf8(i.value)).toUtf8();
|
||||
if (i.key == CMAKE_QMAKE_KEY)
|
||||
qmakePath = i.value;
|
||||
qmakePath = expandedValue;
|
||||
else if (i.key == CMAKE_TOOLCHAIN_KEY)
|
||||
tcPath = i.value;
|
||||
tcPath = expandedValue;
|
||||
}
|
||||
|
||||
QList<Task> result;
|
||||
@@ -406,31 +406,7 @@ void CMakeConfigurationKitInformation::setup(Kit *k)
|
||||
|
||||
void CMakeConfigurationKitInformation::fix(Kit *k)
|
||||
{
|
||||
const QtSupport::BaseQtVersion *const version = QtSupport::QtKitInformation::qtVersion(k);
|
||||
const QByteArray qmakePath
|
||||
= (version && version->isValid()) ? version->qmakeCommand().toString().toUtf8() : QByteArray();
|
||||
const ToolChain *const tc = ToolChainKitInformation::toolChain(k);
|
||||
const QByteArray tcPath
|
||||
= (tc && tc->isValid()) ? tc->compilerCommand().toString().toUtf8() : QByteArray();
|
||||
|
||||
CMakeConfig result;
|
||||
bool haveQmake = false;
|
||||
bool haveToolChain = false;
|
||||
|
||||
foreach (const CMakeConfigItem &i, configuration(k)) {
|
||||
if (i.key == CMAKE_QMAKE_KEY)
|
||||
haveQmake = true;
|
||||
else if (i.key == CMAKE_TOOLCHAIN_KEY)
|
||||
haveToolChain = true;
|
||||
result << i;
|
||||
}
|
||||
|
||||
if (!haveQmake && !qmakePath.isEmpty())
|
||||
result << CMakeConfigItem(CMAKE_QMAKE_KEY, qmakePath);
|
||||
if (!haveToolChain && !tcPath.isEmpty())
|
||||
result << CMakeConfigItem(CMAKE_TOOLCHAIN_KEY, tcPath);
|
||||
|
||||
setConfiguration(k, result);
|
||||
Q_UNUSED(k);
|
||||
}
|
||||
|
||||
KitInformation::ItemList CMakeConfigurationKitInformation::toUserOutput(const Kit *k) const
|
||||
|
||||
@@ -117,7 +117,6 @@ void CMakeManager::clearCMakeCache(Project *project)
|
||||
if (!bc)
|
||||
return;
|
||||
|
||||
bc->setCMakeConfiguration(CMakeConfigurationKitInformation::configuration(bc->target()->kit()));
|
||||
bc->buildDirManager()->clearCache();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user