From f9ebe26aaedf07421f62e7ac47a944c21b3a7f28 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 6 Dec 2012 16:29:30 +0100 Subject: 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 Reviewed-by: Joerg Bornemann --- qmake/generators/win32/mingw_make.cpp | 17 +++++++++++++---- qmake/generators/win32/msvc_vcproj.cpp | 11 +++++++++++ qmake/generators/win32/winmakefile.cpp | 14 +++++++++++++- 3 files changed, 37 insertions(+), 5 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 234817bcba..1665e23f40 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -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; } } diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 1e3f66a9c0..9f14b61f49 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -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. diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index fcc9ceb5aa..fc98c3ddd1 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -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; } } -- cgit v1.2.3