2016-09-27 22:01:08 +03:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2007-11-02 18:50:17 +03:00
|
|
|
#include "QCMake.h"
|
|
|
|
|
2007-11-05 21:20:54 +03:00
|
|
|
#include <QCoreApplication>
|
2016-04-29 17:53:13 +03:00
|
|
|
#include <QDir>
|
2007-11-02 18:50:17 +03:00
|
|
|
|
2016-04-29 17:53:13 +03:00
|
|
|
#include "cmExternalMakefileProjectGenerator.h"
|
2015-04-06 11:52:45 +03:00
|
|
|
#include "cmState.h"
|
2007-11-02 18:50:17 +03:00
|
|
|
#include "cmSystemTools.h"
|
|
|
|
|
2009-10-26 20:18:15 +03:00
|
|
|
#ifdef Q_OS_WIN
|
2016-05-16 17:34:04 +03:00
|
|
|
#include "qt_windows.h" // For SetErrorMode
|
2009-10-26 20:18:15 +03:00
|
|
|
#endif
|
|
|
|
|
2007-11-02 18:50:17 +03:00
|
|
|
QCMake::QCMake(QObject* p)
|
|
|
|
: QObject(p)
|
|
|
|
{
|
2010-08-25 20:35:40 +04:00
|
|
|
this->WarnUninitializedMode = false;
|
2010-08-25 20:43:02 +04:00
|
|
|
this->WarnUnusedMode = false;
|
2008-05-16 03:21:01 +04:00
|
|
|
qRegisterMetaType<QCMakeProperty>();
|
|
|
|
qRegisterMetaType<QCMakePropertyList>();
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2007-11-02 18:50:17 +03:00
|
|
|
cmSystemTools::DisableRunCommandOutput();
|
|
|
|
cmSystemTools::SetRunCommandHideConsole(true);
|
2014-05-15 17:38:30 +04:00
|
|
|
cmSystemTools::SetMessageCallback(QCMake::messageCallback, this);
|
2014-05-15 17:47:25 +04:00
|
|
|
cmSystemTools::SetStdoutCallback(QCMake::stdoutCallback, this);
|
|
|
|
cmSystemTools::SetStderrCallback(QCMake::stderrCallback, this);
|
2007-11-02 18:50:17 +03:00
|
|
|
|
|
|
|
this->CMakeInstance = new cmake;
|
2013-11-08 00:30:59 +04:00
|
|
|
this->CMakeInstance->SetCMakeEditCommand(
|
|
|
|
cmSystemTools::GetCMakeGUICommand());
|
2007-11-02 18:50:17 +03:00
|
|
|
this->CMakeInstance->SetProgressCallback(QCMake::progressCallback, this);
|
2007-11-05 21:20:54 +03:00
|
|
|
|
2012-01-02 22:07:43 +04:00
|
|
|
cmSystemTools::SetInterruptCallback(QCMake::interruptCallback, this);
|
|
|
|
|
2015-02-15 22:17:54 +03:00
|
|
|
std::vector<cmake::GeneratorInfo> generators;
|
2007-11-05 21:20:54 +03:00
|
|
|
this->CMakeInstance->GetRegisteredGenerators(generators);
|
2015-02-15 22:17:54 +03:00
|
|
|
|
|
|
|
std::vector<cmake::GeneratorInfo>::const_iterator it;
|
2016-05-16 17:34:04 +03:00
|
|
|
for (it = generators.begin(); it != generators.end(); ++it) {
|
2009-08-10 22:32:08 +04:00
|
|
|
// Skip the generator "KDevelop3", since there is also
|
|
|
|
// "KDevelop3 - Unix Makefiles", which is the full and official name.
|
|
|
|
// The short name is actually only still there since this was the name
|
|
|
|
// in CMake 2.4, to keep "command line argument compatibility", but
|
|
|
|
// this is not necessary in the GUI.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (it->name == "KDevelop3") {
|
2009-08-10 22:32:08 +04:00
|
|
|
continue;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-02-15 22:17:54 +03:00
|
|
|
|
|
|
|
this->AvailableGenerators.push_back(*it);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
QCMake::~QCMake()
|
|
|
|
{
|
|
|
|
delete this->CMakeInstance;
|
2016-05-16 17:34:04 +03:00
|
|
|
// cmDynamicLoader::FlushCache();
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void QCMake::loadCache(const QString& dir)
|
|
|
|
{
|
|
|
|
this->setBinaryDirectory(dir);
|
|
|
|
}
|
|
|
|
|
2009-03-31 00:34:28 +04:00
|
|
|
void QCMake::setSourceDirectory(const QString& _dir)
|
2007-11-02 18:50:17 +03:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
QString dir = QString::fromLocal8Bit(
|
|
|
|
cmSystemTools::GetActualCaseForPath(_dir.toLocal8Bit().data()).c_str());
|
|
|
|
if (this->SourceDirectory != dir) {
|
2008-04-08 03:19:50 +04:00
|
|
|
this->SourceDirectory = QDir::fromNativeSeparators(dir);
|
|
|
|
emit this->sourceDirChanged(this->SourceDirectory);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
|
|
|
|
2009-03-31 00:34:28 +04:00
|
|
|
void QCMake::setBinaryDirectory(const QString& _dir)
|
2007-11-02 18:50:17 +03:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
QString dir = QString::fromLocal8Bit(
|
|
|
|
cmSystemTools::GetActualCaseForPath(_dir.toLocal8Bit().data()).c_str());
|
|
|
|
if (this->BinaryDirectory != dir) {
|
2008-04-08 03:19:50 +04:00
|
|
|
this->BinaryDirectory = QDir::fromNativeSeparators(dir);
|
|
|
|
emit this->binaryDirChanged(this->BinaryDirectory);
|
2015-04-06 11:52:45 +03:00
|
|
|
cmState* state = this->CMakeInstance->GetState();
|
2007-11-05 21:20:54 +03:00
|
|
|
this->setGenerator(QString());
|
2015-02-15 22:17:54 +03:00
|
|
|
this->setToolset(QString());
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!this->CMakeInstance->LoadCache(
|
|
|
|
this->BinaryDirectory.toLocal8Bit().data())) {
|
2008-04-08 03:19:50 +04:00
|
|
|
QDir testDir(this->BinaryDirectory);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (testDir.exists("CMakeCache.txt")) {
|
|
|
|
cmSystemTools::Error(
|
|
|
|
"There is a CMakeCache.txt file for the current binary "
|
|
|
|
"tree but cmake does not have permission to read it. "
|
|
|
|
"Please check the permissions of the directory you are trying to "
|
|
|
|
"run CMake on.");
|
2007-11-05 21:20:54 +03:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2008-05-16 03:21:01 +04:00
|
|
|
QCMakePropertyList props = this->properties();
|
2007-11-04 02:48:59 +03:00
|
|
|
emit this->propertiesChanged(props);
|
2015-04-06 11:52:45 +03:00
|
|
|
const char* homeDir = state->GetCacheEntryValue("CMAKE_HOME_DIRECTORY");
|
2016-05-16 17:34:04 +03:00
|
|
|
if (homeDir) {
|
2015-04-06 13:14:40 +03:00
|
|
|
setSourceDirectory(QString::fromLocal8Bit(homeDir));
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-04-06 11:52:45 +03:00
|
|
|
const char* gen = state->GetCacheEntryValue("CMAKE_GENERATOR");
|
2016-05-16 17:34:04 +03:00
|
|
|
if (gen) {
|
|
|
|
const char* extraGen =
|
|
|
|
state->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
|
|
|
|
std::string curGen =
|
|
|
|
cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
|
|
|
|
gen, extraGen ? extraGen : "");
|
2012-07-06 23:26:39 +04:00
|
|
|
this->setGenerator(QString::fromLocal8Bit(curGen.c_str()));
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-02-15 22:17:54 +03:00
|
|
|
|
|
|
|
const char* toolset = state->GetCacheEntryValue("CMAKE_GENERATOR_TOOLSET");
|
2016-05-16 17:34:04 +03:00
|
|
|
if (toolset) {
|
2015-02-15 22:17:54 +03:00
|
|
|
this->setToolset(QString::fromLocal8Bit(toolset));
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
|
|
|
|
2007-11-05 21:20:54 +03:00
|
|
|
void QCMake::setGenerator(const QString& gen)
|
2007-11-02 18:50:17 +03:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->Generator != gen) {
|
2007-11-05 21:20:54 +03:00
|
|
|
this->Generator = gen;
|
|
|
|
emit this->generatorChanged(this->Generator);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
|
|
|
|
2015-02-15 22:17:54 +03:00
|
|
|
void QCMake::setToolset(const QString& toolset)
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->Toolset != toolset) {
|
2015-02-15 22:17:54 +03:00
|
|
|
this->Toolset = toolset;
|
|
|
|
emit this->toolsetChanged(this->Toolset);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-02-15 22:17:54 +03:00
|
|
|
}
|
|
|
|
|
2007-11-02 18:50:17 +03:00
|
|
|
void QCMake::configure()
|
|
|
|
{
|
2009-10-26 20:18:15 +03:00
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
UINT lastErrorMode = SetErrorMode(0);
|
|
|
|
#endif
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
this->CMakeInstance->SetHomeDirectory(
|
|
|
|
this->SourceDirectory.toLocal8Bit().data());
|
|
|
|
this->CMakeInstance->SetHomeOutputDirectory(
|
|
|
|
this->BinaryDirectory.toLocal8Bit().data());
|
2007-11-02 18:50:17 +03:00
|
|
|
this->CMakeInstance->SetGlobalGenerator(
|
2016-05-16 17:34:04 +03:00
|
|
|
this->CMakeInstance->CreateGlobalGenerator(
|
|
|
|
this->Generator.toLocal8Bit().data()));
|
2015-02-19 17:09:58 +03:00
|
|
|
this->CMakeInstance->SetGeneratorPlatform("");
|
2015-02-15 22:17:54 +03:00
|
|
|
this->CMakeInstance->SetGeneratorToolset(this->Toolset.toLocal8Bit().data());
|
2007-11-02 18:50:17 +03:00
|
|
|
this->CMakeInstance->LoadCache();
|
2010-08-25 20:35:40 +04:00
|
|
|
this->CMakeInstance->SetWarnUninitialized(this->WarnUninitializedMode);
|
2010-08-25 20:43:02 +04:00
|
|
|
this->CMakeInstance->SetWarnUnused(this->WarnUnusedMode);
|
2008-02-08 19:26:08 +03:00
|
|
|
this->CMakeInstance->PreLoadCMakeFiles();
|
2007-11-02 18:50:17 +03:00
|
|
|
|
2012-01-02 22:07:43 +04:00
|
|
|
InterruptFlag = 0;
|
2007-11-02 18:50:17 +03:00
|
|
|
cmSystemTools::ResetErrorOccuredFlag();
|
|
|
|
|
2007-11-05 21:20:54 +03:00
|
|
|
int err = this->CMakeInstance->Configure();
|
2007-11-02 18:50:17 +03:00
|
|
|
|
2009-10-26 20:18:15 +03:00
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
SetErrorMode(lastErrorMode);
|
|
|
|
#endif
|
|
|
|
|
2007-11-02 18:50:17 +03:00
|
|
|
emit this->propertiesChanged(this->properties());
|
2007-11-05 21:20:54 +03:00
|
|
|
emit this->configureDone(err);
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void QCMake::generate()
|
|
|
|
{
|
2009-10-26 20:18:15 +03:00
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
UINT lastErrorMode = SetErrorMode(0);
|
|
|
|
#endif
|
|
|
|
|
2012-01-02 22:07:43 +04:00
|
|
|
InterruptFlag = 0;
|
2007-11-02 18:50:17 +03:00
|
|
|
cmSystemTools::ResetErrorOccuredFlag();
|
2012-01-02 22:07:43 +04:00
|
|
|
|
2007-11-05 21:20:54 +03:00
|
|
|
int err = this->CMakeInstance->Generate();
|
2009-10-26 20:18:15 +03:00
|
|
|
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
SetErrorMode(lastErrorMode);
|
|
|
|
#endif
|
|
|
|
|
2007-11-05 21:20:54 +03:00
|
|
|
emit this->generateDone(err);
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2008-05-16 03:21:01 +04:00
|
|
|
void QCMake::setProperties(const QCMakePropertyList& newProps)
|
2007-11-02 18:50:17 +03:00
|
|
|
{
|
2008-05-16 03:21:01 +04:00
|
|
|
QCMakePropertyList props = newProps;
|
2007-11-13 07:54:49 +03:00
|
|
|
|
2007-11-08 18:17:37 +03:00
|
|
|
QStringList toremove;
|
2007-11-13 07:54:49 +03:00
|
|
|
|
|
|
|
// set the value of properties
|
2015-04-06 11:52:45 +03:00
|
|
|
cmState* state = this->CMakeInstance->GetState();
|
|
|
|
std::vector<std::string> cacheKeys = state->GetCacheEntryKeys();
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<std::string>::const_iterator it = cacheKeys.begin();
|
|
|
|
it != cacheKeys.end(); ++it) {
|
2015-04-07 23:45:54 +03:00
|
|
|
cmState::CacheEntryType t = state->GetCacheEntryType(*it);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (t == cmState::INTERNAL || t == cmState::STATIC) {
|
2007-11-08 18:17:37 +03:00
|
|
|
continue;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2007-11-08 18:17:37 +03:00
|
|
|
|
2008-05-16 03:21:01 +04:00
|
|
|
QCMakeProperty prop;
|
2015-04-06 13:14:40 +03:00
|
|
|
prop.Key = QString::fromLocal8Bit(it->c_str());
|
2007-11-08 18:17:37 +03:00
|
|
|
int idx = props.indexOf(prop);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (idx == -1) {
|
2015-04-06 13:14:40 +03:00
|
|
|
toremove.append(QString::fromLocal8Bit(it->c_str()));
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2007-11-08 18:17:37 +03:00
|
|
|
prop = props[idx];
|
2016-05-16 17:34:04 +03:00
|
|
|
if (prop.Value.type() == QVariant::Bool) {
|
2015-04-06 11:52:45 +03:00
|
|
|
state->SetCacheEntryValue(*it, prop.Value.toBool() ? "ON" : "OFF");
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2015-04-06 11:52:45 +03:00
|
|
|
state->SetCacheEntryValue(*it,
|
2016-05-16 17:34:04 +03:00
|
|
|
prop.Value.toString().toLocal8Bit().data());
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
props.removeAt(idx);
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2007-11-08 18:17:37 +03:00
|
|
|
|
2007-11-13 07:54:49 +03:00
|
|
|
// remove some properites
|
2016-05-16 17:34:04 +03:00
|
|
|
foreach (QString s, toremove) {
|
2012-07-06 23:26:39 +04:00
|
|
|
this->CMakeInstance->UnwatchUnusedCli(s.toLocal8Bit().data());
|
2011-01-14 01:59:04 +03:00
|
|
|
|
2015-04-06 11:52:45 +03:00
|
|
|
state->RemoveCacheEntry(s.toLocal8Bit().data());
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2007-11-13 07:54:49 +03:00
|
|
|
// add some new properites
|
2016-05-16 17:34:04 +03:00
|
|
|
foreach (QCMakeProperty s, props) {
|
2012-07-06 23:26:39 +04:00
|
|
|
this->CMakeInstance->WatchUnusedCli(s.Key.toLocal8Bit().data());
|
2010-09-22 20:43:15 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (s.Type == QCMakeProperty::BOOL) {
|
|
|
|
this->CMakeInstance->AddCacheEntry(
|
|
|
|
s.Key.toLocal8Bit().data(), s.Value.toBool() ? "ON" : "OFF",
|
|
|
|
s.Help.toLocal8Bit().data(), cmState::BOOL);
|
|
|
|
} else if (s.Type == QCMakeProperty::STRING) {
|
|
|
|
this->CMakeInstance->AddCacheEntry(
|
|
|
|
s.Key.toLocal8Bit().data(), s.Value.toString().toLocal8Bit().data(),
|
|
|
|
s.Help.toLocal8Bit().data(), cmState::STRING);
|
|
|
|
} else if (s.Type == QCMakeProperty::PATH) {
|
|
|
|
this->CMakeInstance->AddCacheEntry(
|
|
|
|
s.Key.toLocal8Bit().data(), s.Value.toString().toLocal8Bit().data(),
|
|
|
|
s.Help.toLocal8Bit().data(), cmState::PATH);
|
|
|
|
} else if (s.Type == QCMakeProperty::FILEPATH) {
|
|
|
|
this->CMakeInstance->AddCacheEntry(
|
|
|
|
s.Key.toLocal8Bit().data(), s.Value.toString().toLocal8Bit().data(),
|
|
|
|
s.Help.toLocal8Bit().data(), cmState::FILEPATH);
|
2007-11-13 07:54:49 +03:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2015-04-05 01:07:04 +03:00
|
|
|
this->CMakeInstance->SaveCache(this->BinaryDirectory.toLocal8Bit().data());
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
|
|
|
|
2008-05-16 03:21:01 +04:00
|
|
|
QCMakePropertyList QCMake::properties() const
|
2007-11-02 18:50:17 +03:00
|
|
|
{
|
2008-05-16 03:21:01 +04:00
|
|
|
QCMakePropertyList ret;
|
2007-11-02 18:50:17 +03:00
|
|
|
|
2015-04-06 11:52:45 +03:00
|
|
|
cmState* state = this->CMakeInstance->GetState();
|
|
|
|
std::vector<std::string> cacheKeys = state->GetCacheEntryKeys();
|
2015-04-06 13:14:40 +03:00
|
|
|
for (std::vector<std::string>::const_iterator i = cacheKeys.begin();
|
2016-05-16 17:34:04 +03:00
|
|
|
i != cacheKeys.end(); ++i) {
|
2015-04-07 23:45:54 +03:00
|
|
|
cmState::CacheEntryType t = state->GetCacheEntryType(*i);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (t == cmState::INTERNAL || t == cmState::STATIC ||
|
|
|
|
t == cmState::UNINITIALIZED) {
|
2007-11-02 18:50:17 +03:00
|
|
|
continue;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2007-11-02 18:50:17 +03:00
|
|
|
|
2015-04-06 11:52:45 +03:00
|
|
|
const char* cachedValue = state->GetCacheEntryValue(*i);
|
2015-04-08 00:14:41 +03:00
|
|
|
|
2015-04-06 13:14:40 +03:00
|
|
|
QCMakeProperty prop;
|
|
|
|
prop.Key = QString::fromLocal8Bit(i->c_str());
|
2016-05-16 17:34:04 +03:00
|
|
|
prop.Help =
|
|
|
|
QString::fromLocal8Bit(state->GetCacheEntryProperty(*i, "HELPSTRING"));
|
2015-04-06 13:14:40 +03:00
|
|
|
prop.Value = QString::fromLocal8Bit(cachedValue);
|
2015-04-06 11:52:45 +03:00
|
|
|
prop.Advanced = state->GetCacheEntryPropertyAsBool(*i, "ADVANCED");
|
2016-05-16 17:34:04 +03:00
|
|
|
if (t == cmState::BOOL) {
|
2008-05-16 03:21:01 +04:00
|
|
|
prop.Type = QCMakeProperty::BOOL;
|
2015-04-06 13:14:40 +03:00
|
|
|
prop.Value = cmSystemTools::IsOn(cachedValue);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (t == cmState::PATH) {
|
2008-05-16 03:21:01 +04:00
|
|
|
prop.Type = QCMakeProperty::PATH;
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (t == cmState::FILEPATH) {
|
2008-05-16 03:21:01 +04:00
|
|
|
prop.Type = QCMakeProperty::FILEPATH;
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (t == cmState::STRING) {
|
2008-05-16 03:21:01 +04:00
|
|
|
prop.Type = QCMakeProperty::STRING;
|
2015-04-06 13:14:40 +03:00
|
|
|
const char* stringsProperty =
|
2016-05-16 17:34:04 +03:00
|
|
|
state->GetCacheEntryProperty(*i, "STRINGS");
|
|
|
|
if (stringsProperty) {
|
2015-04-06 13:14:40 +03:00
|
|
|
prop.Strings = QString::fromLocal8Bit(stringsProperty).split(";");
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2007-11-02 18:50:17 +03:00
|
|
|
|
|
|
|
ret.append(prop);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2007-11-02 18:50:17 +03:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2007-11-02 18:50:17 +03:00
|
|
|
void QCMake::interrupt()
|
|
|
|
{
|
2012-01-02 22:07:43 +04:00
|
|
|
this->InterruptFlag.ref();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QCMake::interruptCallback(void* cd)
|
|
|
|
{
|
|
|
|
QCMake* self = reinterpret_cast<QCMake*>(cd);
|
2012-02-23 15:35:53 +04:00
|
|
|
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
2012-01-02 22:07:43 +04:00
|
|
|
return self->InterruptFlag;
|
2012-02-23 15:35:53 +04:00
|
|
|
#else
|
|
|
|
return self->InterruptFlag.load();
|
|
|
|
#endif
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void QCMake::progressCallback(const char* msg, float percent, void* cd)
|
|
|
|
{
|
|
|
|
QCMake* self = reinterpret_cast<QCMake*>(cd);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (percent >= 0) {
|
2012-07-06 23:26:39 +04:00
|
|
|
emit self->progressChanged(QString::fromLocal8Bit(msg), percent);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2012-07-06 23:26:39 +04:00
|
|
|
emit self->outputMessage(QString::fromLocal8Bit(msg));
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2008-02-01 18:41:29 +03:00
|
|
|
QCoreApplication::processEvents();
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
|
|
|
|
2014-05-15 17:38:30 +04:00
|
|
|
void QCMake::messageCallback(const char* msg, const char* /*title*/,
|
|
|
|
bool& /*stop*/, void* cd)
|
2007-11-02 18:50:17 +03:00
|
|
|
{
|
|
|
|
QCMake* self = reinterpret_cast<QCMake*>(cd);
|
2012-07-06 23:26:39 +04:00
|
|
|
emit self->errorMessage(QString::fromLocal8Bit(msg));
|
2008-02-01 18:41:29 +03:00
|
|
|
QCoreApplication::processEvents();
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
|
|
|
|
2014-05-15 17:47:25 +04:00
|
|
|
void QCMake::stdoutCallback(const char* msg, size_t len, void* cd)
|
|
|
|
{
|
|
|
|
QCMake* self = reinterpret_cast<QCMake*>(cd);
|
2016-05-16 17:34:04 +03:00
|
|
|
emit self->outputMessage(QString::fromLocal8Bit(msg, int(len)));
|
2014-05-15 17:47:25 +04:00
|
|
|
QCoreApplication::processEvents();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCMake::stderrCallback(const char* msg, size_t len, void* cd)
|
|
|
|
{
|
|
|
|
QCMake* self = reinterpret_cast<QCMake*>(cd);
|
2016-05-16 17:34:04 +03:00
|
|
|
emit self->outputMessage(QString::fromLocal8Bit(msg, int(len)));
|
2014-05-15 17:47:25 +04:00
|
|
|
QCoreApplication::processEvents();
|
|
|
|
}
|
|
|
|
|
2007-11-07 03:25:43 +03:00
|
|
|
QString QCMake::binaryDirectory() const
|
|
|
|
{
|
|
|
|
return this->BinaryDirectory;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString QCMake::sourceDirectory() const
|
|
|
|
{
|
|
|
|
return this->SourceDirectory;
|
|
|
|
}
|
|
|
|
|
2007-11-05 21:20:54 +03:00
|
|
|
QString QCMake::generator() const
|
|
|
|
{
|
|
|
|
return this->Generator;
|
|
|
|
}
|
|
|
|
|
2015-02-15 22:17:54 +03:00
|
|
|
std::vector<cmake::GeneratorInfo> const& QCMake::availableGenerators() const
|
2007-11-05 21:20:54 +03:00
|
|
|
{
|
2015-02-15 22:17:54 +03:00
|
|
|
return AvailableGenerators;
|
2007-11-05 21:20:54 +03:00
|
|
|
}
|
|
|
|
|
2007-11-06 09:16:11 +03:00
|
|
|
void QCMake::deleteCache()
|
|
|
|
{
|
|
|
|
// delete cache
|
2015-04-05 01:07:04 +03:00
|
|
|
this->CMakeInstance->DeleteCache(this->BinaryDirectory.toLocal8Bit().data());
|
2007-11-06 09:16:11 +03:00
|
|
|
// reload to make our cache empty
|
2015-04-05 01:07:04 +03:00
|
|
|
this->CMakeInstance->LoadCache(this->BinaryDirectory.toLocal8Bit().data());
|
2007-11-06 09:16:11 +03:00
|
|
|
// emit no generator and no properties
|
|
|
|
this->setGenerator(QString());
|
2015-02-15 22:17:54 +03:00
|
|
|
this->setToolset(QString());
|
2008-05-16 03:21:01 +04:00
|
|
|
QCMakePropertyList props = this->properties();
|
2007-11-06 09:16:11 +03:00
|
|
|
emit this->propertiesChanged(props);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCMake::reloadCache()
|
|
|
|
{
|
|
|
|
// emit that the cache was cleaned out
|
2008-05-16 03:21:01 +04:00
|
|
|
QCMakePropertyList props;
|
2007-11-06 09:16:11 +03:00
|
|
|
emit this->propertiesChanged(props);
|
|
|
|
// reload
|
2015-04-05 01:07:04 +03:00
|
|
|
this->CMakeInstance->LoadCache(this->BinaryDirectory.toLocal8Bit().data());
|
2007-11-06 09:16:11 +03:00
|
|
|
// emit new cache properties
|
|
|
|
props = this->properties();
|
|
|
|
emit this->propertiesChanged(props);
|
|
|
|
}
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2008-04-03 01:41:24 +04:00
|
|
|
void QCMake::setDebugOutput(bool flag)
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (flag != this->CMakeInstance->GetDebugOutput()) {
|
2008-04-03 01:41:24 +04:00
|
|
|
this->CMakeInstance->SetDebugOutputOn(flag);
|
|
|
|
emit this->debugOutputChanged(flag);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2008-04-03 01:41:24 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool QCMake::getDebugOutput() const
|
|
|
|
{
|
|
|
|
return this->CMakeInstance->GetDebugOutput();
|
|
|
|
}
|
|
|
|
|
2015-12-06 15:33:13 +03:00
|
|
|
bool QCMake::getSuppressDevWarnings()
|
|
|
|
{
|
|
|
|
return this->CMakeInstance->GetSuppressDevWarnings();
|
|
|
|
}
|
2007-11-06 09:16:11 +03:00
|
|
|
|
2008-05-16 03:21:01 +04:00
|
|
|
void QCMake::setSuppressDevWarnings(bool value)
|
2008-03-12 05:51:56 +03:00
|
|
|
{
|
2015-12-06 15:33:13 +03:00
|
|
|
this->CMakeInstance->SetSuppressDevWarnings(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QCMake::getSuppressDeprecatedWarnings()
|
|
|
|
{
|
|
|
|
return this->CMakeInstance->GetSuppressDeprecatedWarnings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCMake::setSuppressDeprecatedWarnings(bool value)
|
|
|
|
{
|
|
|
|
this->CMakeInstance->SetSuppressDeprecatedWarnings(value);
|
2008-03-12 05:51:56 +03:00
|
|
|
}
|
2010-07-12 23:48:51 +04:00
|
|
|
|
2015-12-26 19:04:13 +03:00
|
|
|
bool QCMake::getDevWarningsAsErrors()
|
|
|
|
{
|
|
|
|
return this->CMakeInstance->GetDevWarningsAsErrors();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCMake::setDevWarningsAsErrors(bool value)
|
|
|
|
{
|
|
|
|
this->CMakeInstance->SetDevWarningsAsErrors(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QCMake::getDeprecatedWarningsAsErrors()
|
|
|
|
{
|
|
|
|
return this->CMakeInstance->GetDeprecatedWarningsAsErrors();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCMake::setDeprecatedWarningsAsErrors(bool value)
|
|
|
|
{
|
|
|
|
this->CMakeInstance->SetDeprecatedWarningsAsErrors(value);
|
|
|
|
}
|
|
|
|
|
2010-08-25 20:35:40 +04:00
|
|
|
void QCMake::setWarnUninitializedMode(bool value)
|
2010-07-12 23:48:51 +04:00
|
|
|
{
|
2010-08-25 20:35:40 +04:00
|
|
|
this->WarnUninitializedMode = value;
|
2010-07-12 23:48:51 +04:00
|
|
|
}
|
2010-08-25 20:43:02 +04:00
|
|
|
|
|
|
|
void QCMake::setWarnUnusedMode(bool value)
|
|
|
|
{
|
|
|
|
this->WarnUnusedMode = value;
|
|
|
|
}
|