summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/tools/moc/main.cpp1
-rw-r--r--src/tools/moc/moc.cpp12
-rw-r--r--src/tools/moc/parser.h9
-rw-r--r--src/tools/moc/preprocessor.h8
4 files changed, 22 insertions, 8 deletions
diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp
index 905eed1c5d..97b7075bac 100644
--- a/src/tools/moc/main.cpp
+++ b/src/tools/moc/main.cpp
@@ -394,6 +394,7 @@ int runMoc(int _argc, char **_argv)
}
moc.currentFilenames.push(filename);
+ moc.includes = pp.includes;
// 1. preprocess
moc.symbols = pp.preprocessed(moc.filename, in);
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index e76f2c1776..f63404c3c2 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -1103,6 +1103,18 @@ void Moc::parsePluginData(ClassDef *def)
next(STRING_LITERAL);
QByteArray metaDataFile = unquotedLexem();
QFileInfo fi(QFileInfo(QString::fromLocal8Bit(currentFilenames.top().constData())).dir(), QString::fromLocal8Bit(metaDataFile.constData()));
+ for (int j = 0; j < includes.size() && !fi.exists(); ++j) {
+ const IncludePath &p = includes.at(j);
+ if (p.isFrameworkPath)
+ continue;
+
+ fi.setFile(QString::fromLocal8Bit(p.path.constData()), QString::fromLocal8Bit(metaDataFile.constData()));
+ // try again, maybe there's a file later in the include paths with the same name
+ if (fi.isDir()) {
+ fi = QFileInfo();
+ continue;
+ }
+ }
if (!fi.exists()) {
QByteArray msg;
msg += "Plugin Metadata file ";
diff --git a/src/tools/moc/parser.h b/src/tools/moc/parser.h
index 1d69e6472f..654168fb08 100644
--- a/src/tools/moc/parser.h
+++ b/src/tools/moc/parser.h
@@ -56,6 +56,15 @@ public:
bool displayWarnings;
bool displayNotes;
+ struct IncludePath
+ {
+ inline explicit IncludePath(const QByteArray &_path)
+ : path(_path), isFrameworkPath(false) {}
+ QByteArray path;
+ bool isFrameworkPath;
+ };
+ QList<IncludePath> includes;
+
QStack<QByteArray> currentFilenames;
inline bool hasNext() const { return (index < symbols.size()); }
diff --git a/src/tools/moc/preprocessor.h b/src/tools/moc/preprocessor.h
index 4e0bd6343d..e5bc7d4a03 100644
--- a/src/tools/moc/preprocessor.h
+++ b/src/tools/moc/preprocessor.h
@@ -69,14 +69,6 @@ class Preprocessor : public Parser
public:
Preprocessor(){}
static bool preprocessOnly;
- struct IncludePath
- {
- inline explicit IncludePath(const QByteArray &_path)
- : path(_path), isFrameworkPath(false) {}
- QByteArray path;
- bool isFrameworkPath;
- };
- QList<IncludePath> includes;
QList<QByteArray> frameworks;
QSet<QByteArray> preprocessedIncludes;
Macros macros;