MinGW: Use a response file for long include paths
Change-Id: I55ce73ad08473bca27c7ab5730f633fb77c9b8cd Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
1f0299b029
commit
4c20a35cd9
@ -3456,7 +3456,10 @@ ProKey MakefileGenerator::fullTargetVariable() const
|
|||||||
return "TARGET";
|
return "TARGET";
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MakefileGenerator::createResponseFile(const QString &baseName, const ProStringList &objList)
|
QString MakefileGenerator::createResponseFile(
|
||||||
|
const QString &baseName,
|
||||||
|
const ProStringList &objList,
|
||||||
|
const QString &prefix)
|
||||||
{
|
{
|
||||||
QString fileName = baseName + '.' + fileVar("QMAKE_ORIG_TARGET");
|
QString fileName = baseName + '.' + fileVar("QMAKE_ORIG_TARGET");
|
||||||
if (!var("BUILD_NAME").isEmpty())
|
if (!var("BUILD_NAME").isEmpty())
|
||||||
@ -3479,7 +3482,7 @@ QString MakefileGenerator::createResponseFile(const QString &baseName, const Pro
|
|||||||
.replace(QLatin1Char('\t'), QLatin1String("\\\t"))
|
.replace(QLatin1Char('\t'), QLatin1String("\\\t"))
|
||||||
.replace(QLatin1Char('"'), QLatin1String("\\\""))
|
.replace(QLatin1Char('"'), QLatin1String("\\\""))
|
||||||
.replace(QLatin1Char('\''), QLatin1String("\\'"));
|
.replace(QLatin1Char('\''), QLatin1String("\\'"));
|
||||||
t << path << Qt::endl;
|
t << prefix << path << Qt::endl;
|
||||||
}
|
}
|
||||||
t.flush();
|
t.flush();
|
||||||
file.close();
|
file.close();
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include <qlist.h>
|
#include <qlist.h>
|
||||||
#include <qhash.h>
|
#include <qhash.h>
|
||||||
#include <qfileinfo.h>
|
#include <qfileinfo.h>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@ -264,7 +265,9 @@ protected:
|
|||||||
QStringView fixedBase, int slashOff);
|
QStringView fixedBase, int slashOff);
|
||||||
bool processPrlFileCore(QString &origFile, QStringView origName,
|
bool processPrlFileCore(QString &origFile, QStringView origName,
|
||||||
const QString &fixedFile);
|
const QString &fixedFile);
|
||||||
QString createResponseFile(const QString &baseName, const ProStringList &objList);
|
QString createResponseFile(const QString &baseName,
|
||||||
|
const ProStringList &objList,
|
||||||
|
const QString &prefix = QString());
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QMakeProject *projectFile() const;
|
QMakeProject *projectFile() const;
|
||||||
|
@ -201,11 +201,26 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t)
|
|||||||
t << "INCPATH = ";
|
t << "INCPATH = ";
|
||||||
|
|
||||||
const ProStringList &incs = project->values("INCLUDEPATH");
|
const ProStringList &incs = project->values("INCLUDEPATH");
|
||||||
for (ProStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit) {
|
QFile responseFile;
|
||||||
QString inc = (*incit).toQString();
|
QTextStream responseStream;
|
||||||
|
QChar sep(' ');
|
||||||
|
int totalLength = std::accumulate(incs.constBegin(), incs.constEnd(), 0,
|
||||||
|
[](int total, const ProString &inc) {
|
||||||
|
return total + inc.size() + 2;
|
||||||
|
});
|
||||||
|
if (totalLength > project->intValue("QMAKE_RESPONSEFILE_THRESHOLD", 8000)) {
|
||||||
|
const QString fileName = createResponseFile("incpath", incs, "-I");
|
||||||
|
if (!fileName.isEmpty()) {
|
||||||
|
t << '@' + fileName;
|
||||||
|
t << Qt::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const ProString &incit: qAsConst(incs)) {
|
||||||
|
QString inc = incit.toQString();
|
||||||
inc.replace(QRegularExpression("\\\\$"), "");
|
inc.replace(QRegularExpression("\\\\$"), "");
|
||||||
|
inc.replace('\\', '/');
|
||||||
t << "-I" << escapeFilePath(inc) << ' ';
|
t << "-I" << escapeFilePath(inc) << sep;
|
||||||
}
|
}
|
||||||
t << Qt::endl;
|
t << Qt::endl;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user