Merge branch '0.9.1-beta' of git@scm.dev.nokia.troll.no:creator/mainline into 0.9.1-beta

This commit is contained in:
hjk
2008-12-08 14:26:41 +01:00
33 changed files with 228 additions and 183 deletions

View File

@@ -138,19 +138,9 @@ void Document::addIncludeFile(const QString &fileName)
_includedFiles.append(fileName);
}
QByteArray Document::definedMacros() const
void Document::appendMacro(const Macro &macro)
{
return _definedMacros;
}
void Document::appendMacro(const QByteArray &macroName, const QByteArray &text)
{
int index = macroName.indexOf('(');
if (index == -1)
_macroNames.insert(macroName);
else
_macroNames.insert(macroName.left(index));
_definedMacros += text;
_definedMacros.append(macro);
}
void Document::addMacroUse(unsigned offset, unsigned length)
@@ -251,11 +241,6 @@ void Document::stopSkippingBlocks(unsigned stop)
_skippedBlocks.back() = Block(start, stop);
}
QSet<QByteArray> Document::macroNames() const
{
return _macroNames;
}
bool Document::parse(ParseMode mode)
{
TranslationUnit::ParseMode m = TranslationUnit::ParseTranlationUnit;

View File

@@ -36,6 +36,8 @@
#include <CPlusPlusForwardDeclarations.h>
#include "pp-macro.h"
#include <QByteArray>
#include <QList>
#include <QSet>
@@ -45,6 +47,8 @@
namespace CPlusPlus {
class Macro;
class CPLUSPLUS_EXPORT Document
{
Document(const Document &other);
@@ -63,10 +67,7 @@ public:
QStringList includedFiles() const;
void addIncludeFile(const QString &fileName);
QByteArray definedMacros() const;
QSet<QByteArray> macroNames() const;
void appendMacro(const QByteArray &macroName, const QByteArray &text);
void appendMacro(const Macro &macro);
void addMacroUse(unsigned offset, unsigned length);
@@ -81,6 +82,9 @@ public:
Scope *globalSymbols() const; // ### deprecate?
Namespace *globalNamespace() const;
QList<Macro> definedMacros() const
{ return _definedMacros; }
Symbol *findSymbolAt(unsigned line, unsigned column) const;
void setSource(const QByteArray &source);
@@ -191,8 +195,7 @@ private:
TranslationUnit *_translationUnit;
Namespace *_globalNamespace;
QList<DiagnosticMessage> _diagnosticMessages;
QByteArray _definedMacros;
QSet<QByteArray> _macroNames;
QList<Macro> _definedMacros;
QList<Block> _skippedBlocks;
QList<Block> _macroUses;
};

View File

@@ -48,6 +48,7 @@ TypeOfExpression::TypeOfExpression():
void TypeOfExpression::setDocuments(const QMap<QString, Document::Ptr> &documents)
{
m_documents = documents;
m_lookupContext = LookupContext();
}
QList<TypeOfExpression::Result> TypeOfExpression::operator()(const QString &expression,

View File

@@ -54,6 +54,9 @@ public:
/**
* Sets the documents used to evaluate expressions. Should be set before
* calling this functor.
*
* Also clears the lookup context, so can be used to make sure references
* to the documents previously used are removed.
*/
void setDocuments(const QMap<QString, Document::Ptr> &documents);

View File

@@ -21,7 +21,16 @@ HEADERS += \
TypeOfExpression.h \
TypePrettyPrinter.h \
ResolveExpression.h \
LookupContext.h
LookupContext.h \
pp-cctype.h \
pp-engine.h \
pp-fwd.h \
pp-macro-expander.h \
pp-scanner.h \
pp-client.h \
pp-environment.h \
pp-internal.h \
pp-macro.h
SOURCES += \
SimpleLexer.cpp \
@@ -35,6 +44,9 @@ SOURCES += \
TypeOfExpression.cpp \
TypePrettyPrinter.cpp \
ResolveExpression.cpp \
LookupContext.cpp
LookupContext.cpp \
pp-engine.cpp \
pp-environment.cpp \
pp-macro-expander.cpp
RESOURCES += cplusplus.qrc

View File

@@ -53,22 +53,24 @@
#ifndef PP_CCTYPE_H
#define PP_CCTYPE_H
#include <CPlusPlusForwardDeclarations.h>
#include <cctype>
namespace rpp {
namespace CPlusPlus {
inline bool pp_isalpha (int __ch)
inline bool CPLUSPLUS_EXPORT pp_isalpha (int __ch)
{ return std::isalpha ((unsigned char) __ch) != 0; }
inline bool pp_isalnum (int __ch)
inline bool CPLUSPLUS_EXPORT pp_isalnum (int __ch)
{ return std::isalnum ((unsigned char) __ch) != 0; }
inline bool pp_isdigit (int __ch)
inline bool CPLUSPLUS_EXPORT pp_isdigit (int __ch)
{ return std::isdigit ((unsigned char) __ch) != 0; }
inline bool pp_isspace (int __ch)
inline bool CPLUSPLUS_EXPORT pp_isspace (int __ch)
{ return std::isspace ((unsigned char) __ch) != 0; }
} // namespace rpp
} // namespace CPlusPlus
#endif // PP_CCTYPE_H

View File

@@ -34,15 +34,17 @@
#ifndef PP_CLIENT_H
#define PP_CLIENT_H
#include <CPlusPlusForwardDeclarations.h>
#include <QByteArray>
#include <QString>
#include <QFile>
namespace rpp {
namespace CPlusPlus {
class Macro;
class Client
class CPLUSPLUS_EXPORT Client
{
Client(const Client &other);
void operator=(const Client &other);
@@ -60,7 +62,7 @@ public:
virtual ~Client()
{ }
virtual void macroAdded(const QByteArray &macroId, const QByteArray &text) = 0;
virtual void macroAdded(const Macro &macro) = 0;
virtual void sourceNeeded(QString &fileName, IncludeType mode) = 0; // ### FIX the signature.
virtual void startExpandingMacro(unsigned offset,
@@ -74,6 +76,6 @@ public:
virtual void stopSkippingBlocks(unsigned offset) = 0;
};
} // namespace rpp
} // namespace CPlusPlus
#endif // PP_CLIENT_H

View File

@@ -57,7 +57,6 @@
#include <QtDebug>
#include <algorithm>
using namespace rpp;
using namespace CPlusPlus;
namespace {
@@ -907,16 +906,8 @@ void pp::processDefine(TokenIterator firstToken, TokenIterator lastToken)
env.bind(macro);
QByteArray macroText;
macroText.reserve(64);
macroText += "#define ";
macroText += macroId;
macroText += ' ';
macroText += macro.definition;
macroText += '\n';
client->macroAdded(macroId, macroText);
if (client)
client->macroAdded(macro);
}
void pp::processIf(TokenIterator firstToken, TokenIterator lastToken)
@@ -1020,13 +1011,10 @@ void pp::processUndef(TokenIterator firstToken, TokenIterator lastToken)
if (tk->is(T_IDENTIFIER)) {
const QByteArray macroName = tokenText(*tk);
env.remove(macroName);
const Macro *macro = env.remove(macroName);
QByteArray macroText;
macroText += "#undef ";
macroText += macroName;
macroText += '\n';
client->macroAdded(macroName, macroText);
if (client && macro)
client->macroAdded(*macro);
}
}

View File

@@ -62,7 +62,7 @@ namespace CPlusPlus {
class Token;
}
namespace rpp {
namespace CPlusPlus {
struct Value
{
@@ -134,7 +134,7 @@ namespace rpp {
#undef PP_DEFINE_BIN_OP
};
class pp
class CPLUSPLUS_EXPORT pp
{
Client *client;
Environment &env;
@@ -200,7 +200,7 @@ namespace rpp {
Value evalExpression(TokenIterator firstToken,
TokenIterator lastToken,
const QByteArray &source) const;
const QByteArray &source) const;
QVector<CPlusPlus::Token> tokenize(const QByteArray &text) const;
@@ -226,6 +226,6 @@ namespace rpp {
bool isQtReservedWord(const QByteArray &name) const;
};
} // namespace rpp
} // namespace CPlusPlus
#endif // PP_ENGINE_H

View File

@@ -54,7 +54,7 @@
#include "pp.h"
#include <cstring>
using namespace rpp;
using namespace CPlusPlus;
Environment::Environment ()
: currentLine(0),
@@ -115,12 +115,12 @@ Macro *Environment::bind(const Macro &__macro)
return m;
}
void Environment::remove (const QByteArray &name)
Macro *Environment::remove (const QByteArray &name)
{
Macro macro;
macro.name = name;
macro.hidden = true;
bind(macro);
return bind(macro);
}
bool Environment::isBuiltinMacro(const QByteArray &s) const

View File

@@ -53,14 +53,16 @@
#ifndef PP_ENVIRONMENT_H
#define PP_ENVIRONMENT_H
#include "CPlusPlusForwardDeclarations.h"
#include <QVector>
#include <QByteArray>
namespace rpp {
namespace CPlusPlus {
struct Macro;
class Macro;
class Environment
class CPLUSPLUS_EXPORT Environment
{
public:
Environment();
@@ -70,7 +72,7 @@ public:
Macro *macroAt(unsigned index) const;
Macro *bind(const Macro &macro);
void remove(const QByteArray &name);
Macro *remove(const QByteArray &name);
Macro *resolve(const QByteArray &name) const;
bool isBuiltinMacro(const QByteArray &name) const;
@@ -104,6 +106,6 @@ private:
int _hash_count;
};
} // namespace rpp
} // namespace CPlusPlus
#endif // PP_ENVIRONMENT_H

View File

@@ -55,7 +55,7 @@
#include <QByteArray>
namespace rpp {
namespace CPlusPlus {
namespace _PP_internal {
inline bool comment_p (const char *__first, const char *__last)
@@ -73,6 +73,6 @@ inline bool comment_p (const char *__first, const char *__last)
}
} // _PP_internal
} // namespace rpp
} // namespace CPlusPlus
#endif // PP_INTERNAL_H

View File

@@ -35,7 +35,7 @@
#include "pp-macro-expander.h"
#include <QDateTime>
using namespace rpp;
using namespace CPlusPlus;
MacroExpander::MacroExpander (Environment &env, pp_frame *frame)
: env(env), frame(frame),

View File

@@ -53,7 +53,7 @@
#ifndef PP_MACRO_EXPANDER_H
#define PP_MACRO_EXPANDER_H
namespace rpp {
namespace CPlusPlus {
struct pp_frame
{
@@ -97,7 +97,7 @@ namespace rpp {
int generated_lines;
};
} // namespace rpp
} // namespace CPlusPlus
#endif // PP_MACRO_EXPANDER_H

View File

@@ -53,43 +53,44 @@
#ifndef PP_MACRO_H
#define PP_MACRO_H
#include <CPlusPlusForwardDeclarations.h>
#include <QByteArray>
#include <QVector>
namespace rpp {
namespace CPlusPlus {
struct Macro
class CPLUSPLUS_EXPORT Macro
{
public:
QByteArray name;
QByteArray definition;
QVector<QByteArray> formals;
QByteArray fileName;
int line;
Macro *next;
unsigned hashcode;
union
{
QByteArray name;
QByteArray definition;
QVector<QByteArray> formals;
QByteArray fileName;
int line;
int lines;
Macro *next;
unsigned hashcode;
unsigned state;
union
struct
{
unsigned state;
struct
{
unsigned hidden: 1;
unsigned function_like: 1;
unsigned variadics: 1;
};
unsigned hidden: 1;
unsigned function_like: 1;
unsigned variadics: 1;
};
};
inline Macro():
inline Macro():
line(0),
lines(0),
next(0),
hashcode(0),
state(0)
{ }
};
{ }
};
} // namespace rpp
} // namespace CPlusPlus
#endif // PP_MACRO_H

View File

@@ -53,7 +53,7 @@
#ifndef PP_SCANNER_H
#define PP_SCANNER_H
namespace rpp {
namespace CPlusPlus {
struct pp_skip_blanks
{
@@ -373,7 +373,7 @@ struct pp_skip_argument
}
};
} // namespace rpp
} // namespace CPlusPlus
#endif // PP_SCANNER_H

View File

@@ -34,6 +34,8 @@
#include "cmakeproject.h"
#include "cmakeprojectconstants.h"
#include "cmakeprojectnodes.h"
#include "cmakestep.h"
#include "makestep.h"
#include <extensionsystem/pluginmanager.h>
#include <cpptools/cppmodelmanagerinterface.h>
@@ -188,7 +190,7 @@ QString CMakeProject::buildDirectory(const QString &buildConfiguration) const
{
Q_UNUSED(buildConfiguration)
//TODO
return "";
return QFileInfo(m_fileName).absolutePath();
}
ProjectExplorer::BuildStepConfigWidget *CMakeProject::createConfigWidget()
@@ -225,13 +227,29 @@ QStringList CMakeProject::files(FilesMode fileMode) const
void CMakeProject::saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer)
{
// TODO
Q_UNUSED(writer)
Q_UNUSED(writer);
}
void CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader &reader)
{
// TODO
Q_UNUSED(reader)
Q_UNUSED(reader);
if (buildConfigurations().isEmpty()) {
// No build configuration, adding those
// TODO do we want to create one build configuration per target?
// or how do we want to handle that?
CMakeStep *cmakeStep = new CMakeStep(this);
MakeStep *makeStep = new MakeStep(this);
insertBuildStep(0, cmakeStep);
insertBuildStep(1, makeStep);
addBuildConfiguration("all");
setActiveBuildConfiguration("all");
}
// Restoring is fine
}
@@ -376,12 +394,36 @@ void CMakeCbpParser::parseBuild()
void CMakeCbpParser::parseTarget()
{
m_targetOutput.clear();
m_targetType = false;
while(!atEnd()) {
readNext();
if (isEndElement()) {
if (m_targetType && !m_targetOutput.isEmpty()) {
qDebug()<<"found target "<<m_targetOutput;
m_targets.insert(m_targetOutput);
}
return;
} else if (name() == "Compiler") {
parseCompiler();
} else if (name() == "Option") {
parseTargetOption();
} else if (isStartElement()) {
parseUnknownElement();
}
}
}
void CMakeCbpParser::parseTargetOption()
{
if (attributes().hasAttribute("output"))
m_targetOutput = attributes().value("output").toString();
else if (attributes().hasAttribute("type") && attributes().value("type") == "1")
m_targetType = true;
while(!atEnd()) {
readNext();
if (isEndElement()) {
return;
} else if (name() == "Compiler") {
parseCompiler();
} else if (isStartElement()) {
parseUnknownElement();
}

View File

@@ -123,13 +123,18 @@ private:
void parseProject();
void parseBuild();
void parseTarget();
void parseTargetOption();
void parseCompiler();
void parseAdd();
void parseUnit();
void parseUnknownElement();
QSet<QString> m_targets;
QList<ProjectExplorer::FileNode *> m_fileList;
QStringList m_includeFiles;
QString m_targetOutput;
bool m_targetType;
};
class CMakeFile : public Core::IFile

View File

@@ -54,7 +54,7 @@ bool CMakeStep::init(const QString &buildConfiguration)
setEnabled(buildConfiguration, true);
setWorkingDirectory(buildConfiguration, m_pro->buildDirectory(buildConfiguration));
setCommand(buildConfiguration, "cmake"); // TODO give full path here?
setArguments(buildConfiguration, QStringList()); // TODO
setArguments(buildConfiguration, QStringList() << "-GUnix Makefiles"); // TODO
setEnvironment(buildConfiguration, m_pro->environment(buildConfiguration));
return AbstractProcessStep::init(buildConfiguration);
}

View File

@@ -699,7 +699,9 @@ void CppCodeCompletion::addMacros(const LookupContext &context)
continue;
processed.insert(fn);
if (Document::Ptr doc = context.document(fn)) {
macroNames += doc->macroNames();
foreach (const Macro macro, doc->definedMacros()) {
macroNames.insert(macro.name);
}
todo += doc->includedFiles();
}
}
@@ -1025,6 +1027,10 @@ bool CppCodeCompletion::partiallyComplete(const QList<TextEditor::CompletionItem
void CppCodeCompletion::cleanup()
{
m_completions.clear();
// Set empty map in order to avoid referencing old versions of the documents
// until the next completion
typeOfExpression.setDocuments(QMap<QString, Document::Ptr>());
}
int CppCodeCompletion::findStartOfName(const TextEditor::ITextEditor *editor)

View File

@@ -31,7 +31,7 @@
**
***************************************************************************/
#include "pp.h"
#include <cplusplus/pp.h>
#include "cppmodelmanager.h"
#include "cpphoverhandler.h"
@@ -107,7 +107,7 @@ static const char pp_configuration[] =
namespace CppTools {
namespace Internal {
class CppPreprocessor: public rpp::Client
class CppPreprocessor: public CPlusPlus::Client
{
public:
CppPreprocessor(QPointer<CppModelManager> modelManager);
@@ -129,12 +129,11 @@ protected:
void mergeEnvironment(CPlusPlus::Document::Ptr doc);
void mergeEnvironment(CPlusPlus::Document::Ptr doc, QSet<QString> *processed);
virtual void macroAdded(const QByteArray &macroName,
const QByteArray &macroText);
virtual void macroAdded(const Macro &macro);
virtual void startExpandingMacro(unsigned offset,
const rpp::Macro &macro,
const Macro &macro,
const QByteArray &originalText);
virtual void stopExpandingMacro(unsigned offset, const rpp::Macro &macro);
virtual void stopExpandingMacro(unsigned offset, const Macro &macro);
virtual void startSkippingBlocks(unsigned offset);
virtual void stopSkippingBlocks(unsigned offset);
virtual void sourceNeeded(QString &fileName, IncludeType type);
@@ -142,8 +141,8 @@ protected:
private:
QPointer<CppModelManager> m_modelManager;
CppModelManager::DocumentTable m_documents;
rpp::Environment env;
rpp::pp m_proc;
Environment env;
pp m_proc;
QStringList m_includePaths;
QStringList m_systemIncludePaths;
QMap<QString, QByteArray> m_workingCopy;
@@ -295,16 +294,16 @@ QByteArray CppPreprocessor::tryIncludeFile(QString &fileName, IncludeType type)
return QByteArray();
}
void CppPreprocessor::macroAdded(const QByteArray &macroName, const QByteArray &macroText)
void CppPreprocessor::macroAdded(const Macro &macro)
{
if (! m_currentDoc)
return;
m_currentDoc->appendMacro(macroName, macroText);
m_currentDoc->appendMacro(macro);
}
void CppPreprocessor::startExpandingMacro(unsigned offset,
const rpp::Macro &,
const Macro &,
const QByteArray &originalText)
{
if (! m_currentDoc)
@@ -314,7 +313,7 @@ void CppPreprocessor::startExpandingMacro(unsigned offset,
m_currentDoc->addMacroUse(offset, originalText.length());
}
void CppPreprocessor::stopExpandingMacro(unsigned, const rpp::Macro &)
void CppPreprocessor::stopExpandingMacro(unsigned, const Macro &)
{
if (! m_currentDoc)
return;
@@ -340,14 +339,13 @@ void CppPreprocessor::mergeEnvironment(Document::Ptr doc, QSet<QString> *process
processed->insert(fn);
foreach (QString includedFile, doc->includedFiles())
foreach (QString includedFile, doc->includedFiles()) {
mergeEnvironment(m_documents.value(includedFile), processed);
}
const QByteArray macros = doc->definedMacros();
QByteArray localFileName = doc->fileName().toUtf8();
QByteArray dummy;
m_proc(localFileName, macros, &dummy);
foreach (const Macro macro, doc->definedMacros()) {
env.bind(macro);
}
}
void CppPreprocessor::startSkippingBlocks(unsigned offset)

View File

@@ -10,7 +10,7 @@ unix:QMAKE_CXXFLAGS_DEBUG += -O3
INCLUDEPATH += .
DEFINES += CPPTOOLS_LIBRARY
CONFIG += help
include(rpp/rpp.pri)|error("Can't find RPP")
HEADERS += cpptools_global.h \
cppquickopenfilter.h \
cppclassesfilter.h \

View File

@@ -1,18 +0,0 @@
DEPENDPATH += $$PWD
INCLUDEPATH += $$PWD
HEADERS += $$PWD/pp-cctype.h \
$$PWD/pp-engine.h \
$$PWD/pp-environment.h \
$$PWD/pp-internal.h \
$$PWD/pp-macro-expander.h \
$$PWD/pp-macro.h \
$$PWD/pp-scanner.h \
$$PWD/pp.h \
$$PWD/pp-client.h
SOURCES += $$PWD/pp-engine.cpp \
$$PWD/pp-environment.cpp \
$$PWD/pp-macro-expander.cpp

View File

@@ -194,7 +194,7 @@ QString SearchSymbols::symbolName(const Symbol *symbol) const
void SearchSymbols::appendItem(const QString &name,
const QString &info,
ModelItemInfo::ItemType type,
const CPlusPlus::Symbol *symbol)
const Symbol *symbol)
{
const QIcon icon = icons.iconForSymbol(symbol);
items.append(ModelItemInfo(name, info, type,

View File

@@ -605,7 +605,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList & /*arguments*/, QStrin
}
}
connect(m_sessionManagerAction, SIGNAL(triggered()), this, SLOT(sessionManager()));
connect(m_sessionManagerAction, SIGNAL(triggered()), this, SLOT(showSessionManager()));
connect(m_newAction, SIGNAL(triggered()), this, SLOT(newProject()));
#if 0
connect(m_loadAction, SIGNAL(triggered()), this, SLOT(loadAction()));
@@ -765,10 +765,10 @@ void ProjectExplorerPlugin::newProject()
updateActions();
}
void ProjectExplorerPlugin::sessionManager()
void ProjectExplorerPlugin::showSessionManager()
{
if (debug)
qDebug() << "ProjectExplorerPlugin::newSession";
qDebug() << "ProjectExplorerPlugin::showSessionManager";
if (m_session->isDefaultVirgin()) {
// do not save new virgin default sessions

View File

@@ -143,7 +143,7 @@ private slots:
void unloadProject();
void clearSession();
void newProject();
void sessionManager();
void showSessionManager();
void populateBuildConfigurationMenu();
void buildConfigurationMenuTriggered(QAction *);
void populateRunConfigurationMenu();

View File

@@ -709,7 +709,7 @@ void SessionManager::editDependencies()
dlg.exec();
}
QList<Project *> SessionManager::projects() const
const QList<Project *> &SessionManager::projects() const
{
return m_file->m_projects;
}
@@ -839,26 +839,26 @@ Project *SessionManager::projectForFile(const QString &fileName) const
if (debug)
qDebug() << "SessionManager::projectForFile(" << fileName << ")";
Project *project = 0;
const QList<Project *> &projectList = projects();
QList<Project *> projectList = projects();
// Check current project first
Project *currentProject = ProjectExplorerPlugin::instance()->currentProject();
if (currentProject && projectContainsFile(currentProject, fileName))
return currentProject;
// Always check current project first
if (Project *currentProject = ProjectExplorerPlugin::instance()->currentProject()) {
projectList.removeOne(currentProject);
projectList.insert(0, currentProject);
}
foreach (Project *p, projectList)
if (p != currentProject && projectContainsFile(p, fileName))
return p;
foreach (Project *p, projectList) {
if (!m_projectFileCache.contains(p)) {
m_projectFileCache.insert(p, p->files(Project::AllFiles));
}
if (m_projectFileCache.value(p).contains(fileName)) {
project = p;
break;
}
}
return project;
return 0;
}
bool SessionManager::projectContainsFile(Project *p, const QString &fileName) const
{
if (!m_projectFileCache.contains(p))
m_projectFileCache.insert(p, p->files(Project::AllFiles));
return m_projectFileCache.value(p).contains(fileName);
}
void SessionManager::setEditorCodec(Core::IEditor *editor, const QString &fileName)

View File

@@ -137,7 +137,7 @@ public:
Core::IFile *file() const;
Project *startupProject() const;
QList<Project *> projects() const;
const QList<Project *> &projects() const;
bool isDefaultVirgin() const;
bool isDefaultSession(const QString &session) const;
@@ -182,6 +182,7 @@ private:
bool loadImpl(const QString &fileName);
bool createImpl(const QString &fileName);
QString sessionNameToFileName(const QString &session);
bool projectContainsFile(Project *p, const QString &fileName) const;
bool recursiveDependencyCheck(const QString &newDep, const QString &checkDep) const;
QStringList dependencies(const QString &proName) const;

View File

@@ -474,6 +474,9 @@ void Qt4Project::updateCodeModel()
}
}
// Add mkspec directory
allIncludePaths.append(qtVersion(activeBuildConfiguration())->mkspecPath());
QStringList files;
files += m_projectFiles->files[HeaderType];
files += m_projectFiles->generatedFiles[HeaderType];

View File

@@ -728,6 +728,12 @@ QString QtVersion::mkspec() const
return m_mkspec;
}
QString QtVersion::mkspecPath() const
{
updateMkSpec();
return m_mkspecFullPath;
}
QHash<QString,QString> QtVersion::versionInfo() const
{
updateVersionInfo();
@@ -1023,25 +1029,25 @@ void QtVersion::updateMkSpec() const
//qDebug()<<"Finding mkspec for"<<path();
QString mkspec;
QFile f(path() + "/.qmake.cache");
if (f.exists() && f.open(QIODevice::ReadOnly)) {
while(!f.atEnd()) {
QByteArray line = f.readLine();
if(line.startsWith("QMAKESPEC")) {
const QList<QByteArray> &temp = line.split('=');
if(temp.size() == 2) {
mkspec = temp.at(1).trimmed();
if (mkspec.startsWith("$$QT_BUILD_TREE/mkspecs/"))
mkspec = mkspec.mid(QString("$$QT_BUILD_TREE/mkspecs/").length());
else if (mkspec.startsWith("$$QT_BUILD_TREE\\mkspecs\\"))
mkspec = mkspec.mid(QString("$$QT_BUILD_TREE\\mkspecs\\").length());
mkspec = QDir::fromNativeSeparators(mkspec);
}
break;
}
}
f.close();
} else {
// QFile f(path() + "/.qmake.cache");
// if (f.exists() && f.open(QIODevice::ReadOnly)) {
// while(!f.atEnd()) {
// QByteArray line = f.readLine();
// if(line.startsWith("QMAKESPEC")) {
// const QList<QByteArray> &temp = line.split('=');
// if(temp.size() == 2) {
// mkspec = temp.at(1).trimmed();
// if (mkspec.startsWith("$$QT_BUILD_TREE/mkspecs/"))
// mkspec = mkspec.mid(QString("$$QT_BUILD_TREE/mkspecs/").length());
// else if (mkspec.startsWith("$$QT_BUILD_TREE\\mkspecs\\"))
// mkspec = mkspec.mid(QString("$$QT_BUILD_TREE\\mkspecs\\").length());
// mkspec = QDir::fromNativeSeparators(mkspec);
// }
// break;
// }
// }
// f.close();
// } else {
// no .qmake.cache so look at the default mkspec
QString mkspecPath = versionInfo().value("QMAKE_MKSPECS");
if (mkspecPath.isEmpty())
@@ -1096,8 +1102,9 @@ void QtVersion::updateMkSpec() const
mkspec = f2.symLinkTarget();
}
#endif
}
// }
m_mkspecFullPath = mkspec;
int index = mkspec.lastIndexOf('/');
if(index == -1)
index = mkspec.lastIndexOf('\\');

View File

@@ -67,6 +67,7 @@ public:
QString path() const;
QString sourcePath() const;
QString mkspec() const;
QString mkspecPath() const;
QString makeCommand() const;
QString qmakeCommand() const;
// Returns the PREFIX, BINPREFIX, DOCPREFIX and similar information
@@ -107,6 +108,7 @@ private:
QString m_path;
QString m_sourcePath;
mutable QString m_mkspec; // updated lazily
mutable QString m_mkspecFullPath;
QString m_mingwDirectory;
QString m_prependPath;
QString m_msvcVersion;