diff options
author | Eric Lemanissier <eric.lemanissier@gmail.com> | 2014-10-29 15:11:57 +0100 |
---|---|---|
committer | Eric Lemanissier <eric.lemanissier@gmail.com> | 2014-12-09 07:34:35 +0100 |
commit | 459e22a9dfd7105918528def302604a6c0628115 (patch) | |
tree | 9804f177f0dd690c54c2e5e4da0bef5f4d77a838 /qmake | |
parent | 8f6b3284106fa11129e4fa6e5ec3adc6cb1f489f (diff) |
Handling of qmake variable defining the manifest file on MinGW
On Windows, the application manifest file can be linked with the
executable, to specify for example the requested privileges of the
application. On MSVC nmake, the manifest is already handled in
NmakeMakefileGenerator::writeBuildRulesPart, but it is not compatible
with MinGW. On MinGW, this manifest file has to be referenced in the
Rc File. This patch simply handles the existing variable
"QMAKE_MANIFEST" which defines the appropriate line RT_MANIFEST in
the RC file.
Task-number: QTBUG-42454
Change-Id: I921606e002ffe3801c537f30ac2365891f97d5c9
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/generators/win32/mingw_make.cpp | 5 | ||||
-rw-r--r-- | qmake/generators/win32/mingw_make.h | 1 | ||||
-rw-r--r-- | qmake/generators/win32/winmakefile.cpp | 18 | ||||
-rw-r--r-- | qmake/generators/win32/winmakefile.h | 1 |
4 files changed, 23 insertions, 2 deletions
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 3c53421fc4..42431f0131 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -66,6 +66,11 @@ QString MingwMakefileGenerator::getLibTarget() return QString("lib" + project->first("TARGET") + project->first("TARGET_VERSION_EXT") + ".a"); } +QString MingwMakefileGenerator::getManifestFileForRcFile() const +{ + return project->first("QMAKE_MANIFEST").toQString(); +} + bool MingwMakefileGenerator::findLibraries() { QList<QMakeLocalFileName> dirs; diff --git a/qmake/generators/win32/mingw_make.h b/qmake/generators/win32/mingw_make.h index 2442ea852b..bd26f343dc 100644 --- a/qmake/generators/win32/mingw_make.h +++ b/qmake/generators/win32/mingw_make.h @@ -46,6 +46,7 @@ public: protected: QString escapeDependencyPath(const QString &path) const; QString getLibTarget(); + virtual QString getManifestFileForRcFile() const; bool writeMakefile(QTextStream &); void init(); private: diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 81bc16a3c6..b6bcdbf366 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -368,7 +368,8 @@ void Win32MakefileGenerator::processRcFileVar() if (Option::qmake_mode == Option::QMAKE_GENERATE_NOTHING) return; - if (((!project->values("VERSION").isEmpty() || !project->values("RC_ICONS").isEmpty()) + const QString manifestFile = getManifestFileForRcFile(); + if (((!project->values("VERSION").isEmpty() || !project->values("RC_ICONS").isEmpty() || !manifestFile.isEmpty()) && project->values("RC_FILE").isEmpty() && project->values("RES_FILE").isEmpty() && !project->isActiveConfig("no_generated_target_info") @@ -412,7 +413,7 @@ void Win32MakefileGenerator::processRcFileVar() ts << "# if defined(UNDER_CE)\n"; ts << "# include <winbase.h>\n"; ts << "# else\n"; - ts << "# include <winver.h>\n"; + ts << "# include <windows.h>\n"; ts << "# endif\n"; ts << endl; if (!rcIcons.isEmpty()) { @@ -420,6 +421,14 @@ void Win32MakefileGenerator::processRcFileVar() ts << QString("IDI_ICON%1\tICON\tDISCARDABLE\t%2").arg(i + 1).arg(cQuoted(rcIcons[i])) << endl; ts << endl; } + if (!manifestFile.isEmpty()) { + QString manifestResourceId; + if (project->first("TEMPLATE") == "lib") + manifestResourceId = QStringLiteral("ISOLATIONAWARE_MANIFEST_RESOURCE_ID"); + else + manifestResourceId = QStringLiteral("CREATEPROCESS_MANIFEST_RESOURCE_ID"); + ts << manifestResourceId << " RT_MANIFEST \"" << manifestFile << "\"\n"; + } ts << "VS_VERSION_INFO VERSIONINFO\n"; ts << "\tFILEVERSION " << QString(versionString).replace(".", ",") << endl; ts << "\tPRODUCTVERSION " << QString(versionString).replace(".", ",") << endl; @@ -894,4 +903,9 @@ QString Win32MakefileGenerator::cQuoted(const QString &str) return ret; } +QString Win32MakefileGenerator::getManifestFileForRcFile() const +{ + return QString(); +} + QT_END_NAMESPACE diff --git a/qmake/generators/win32/winmakefile.h b/qmake/generators/win32/winmakefile.h index 3016bad5b4..468f2f3ee6 100644 --- a/qmake/generators/win32/winmakefile.h +++ b/qmake/generators/win32/winmakefile.h @@ -66,6 +66,7 @@ protected: void processRcFileVar(); virtual QString getLibTarget(); static QString cQuoted(const QString &str); + virtual QString getManifestFileForRcFile() const; }; inline Win32MakefileGenerator::~Win32MakefileGenerator() |