support include paths for the Windows resource compiler

In RC_INCLUDEPATH one can add include paths for the Windows resource
compiler.

Task-number: QTBUG-13776

Change-Id: If1d9ed44097adb7789df03e4ccd4e3b7df9e8d08
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
Joerg Bornemann 2012-12-06 16:29:30 +01:00 committed by The Qt Project
parent e23e224498
commit f9ebe26aae
3 changed files with 37 additions and 5 deletions

View File

@ -416,14 +416,23 @@ void MingwMakefileGenerator::writeRcFilePart(QTextStream &t)
{
const QString rc_file = fileFixify(project->first("RC_FILE").toQString());
QString incPathStr = fileInfo(rc_file).path();
if (incPathStr != "." && QDir::isRelativePath(incPathStr))
incPathStr.prepend("./");
ProStringList rcIncPaths = project->values("RC_INCLUDEPATH");
rcIncPaths.prepend(fileInfo(rc_file).path());
QString incPathStr;
for (int i = 0; i < rcIncPaths.count(); ++i) {
const ProString &path = rcIncPaths.at(i);
if (path.isEmpty())
continue;
incPathStr += QStringLiteral(" --include-dir=");
if (path != "." && QDir::isRelativePath(path.toQString()))
incPathStr += "./";
incPathStr += escapeFilePath(path);
}
if (!rc_file.isEmpty()) {
t << escapeDependencyPath(var("RES_FILE")) << ": " << rc_file << "\n\t"
<< var("QMAKE_RC") << " -i " << rc_file << " -o " << var("RES_FILE")
<< " --include-dir=" << incPathStr << " $(DEFINES)" << endl << endl;
<< incPathStr << " $(DEFINES)" << endl << endl;
}
}

View File

@ -1072,6 +1072,17 @@ void VcprojGenerator::initResourceTool()
VCConfiguration &conf = vcProject.Configuration;
conf.resource.PreprocessorDefinitions = conf.compiler.PreprocessorDefinitions;
foreach (const ProString &path, project->values("RC_INCLUDEPATH")) {
QString fixedPath = fileFixify(path.toQString());
if (fileInfo(fixedPath).isRelative()) {
if (fixedPath == QStringLiteral("."))
fixedPath = QStringLiteral("$(ProjectDir)");
else
fixedPath.prepend(QStringLiteral("$(ProjectDir)\\"));
}
conf.resource.AdditionalIncludeDirectories << escapeFilePath(fixedPath);
}
// We need to add _DEBUG for the debug version of the project, since the normal compiler defines
// do not contain it. (The compiler defines this symbol automatically, which is wy we don't need
// to add it for the compiler) However, the resource tool does not do this.

View File

@ -783,8 +783,20 @@ void Win32MakefileGenerator::writeRcFilePart(QTextStream &t)
// use these defines in the .rc file itself. Also, we need to add the _DEBUG define manually
// since the compiler defines this symbol by itself, and we use it in the automatically
// created rc file when VERSION is define the .pro file.
const ProStringList rcIncPaths = project->values("RC_INCLUDEPATH");
QString incPathStr;
for (int i = 0; i < rcIncPaths.count(); ++i) {
const ProString &path = rcIncPaths.at(i);
if (path.isEmpty())
continue;
incPathStr += QStringLiteral(" /i ");
incPathStr += escapeFilePath(path);
}
t << res_file << ": " << rc_file << "\n\t"
<< var("QMAKE_RC") << (project->isActiveConfig("debug") ? " -D_DEBUG" : "") << " $(DEFINES) -fo " << res_file << " " << rc_file;
<< var("QMAKE_RC") << (project->isActiveConfig("debug") ? " -D_DEBUG" : "")
<< " $(DEFINES)" << incPathStr << " -fo " << res_file << " " << rc_file;
t << endl << endl;
}
}