From 3f00eed4c329670bf10640c43467cd122347e0d2 Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 7 Jan 2011 08:24:41 +0100 Subject: Added MinGW support for adding lib prefix and extension via profile. RevBy: Oswald Buddenhagen --- mkspecs/win32-g++/qmake.conf | 2 ++ qmake/generators/win32/mingw_make.cpp | 5 +---- qmake/generators/win32/winmakefile.cpp | 22 +++++++++++++++++----- qmake/generators/win32/winmakefile.h | 1 + 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/mkspecs/win32-g++/qmake.conf b/mkspecs/win32-g++/qmake.conf index ec216aa..8e49b18 100644 --- a/mkspecs/win32-g++/qmake.conf +++ b/mkspecs/win32-g++/qmake.conf @@ -62,6 +62,8 @@ QMAKE_LFLAGS_WINDOWS = -Wl,-subsystem,windows QMAKE_LFLAGS_DLL = -shared QMAKE_LINK_OBJECT_MAX = 10 QMAKE_LINK_OBJECT_SCRIPT= object_script +QMAKE_PREFIX_STATICLIB = lib +QMAKE_EXTENSION_STATICLIB = a QMAKE_LIBS = diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 648776d..95795b8 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -335,12 +335,9 @@ void MingwMakefileGenerator::init() void MingwMakefileGenerator::fixTargetExt() { if (project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") { - project->values("TARGET_EXT").append(".a"); project->values("QMAKE_LFLAGS").append("-static"); - project->values("TARGET").first() = "lib" + project->first("TARGET"); - } else { - Win32MakefileGenerator::fixTargetExt(); } + Win32MakefileGenerator::fixTargetExt(); } void MingwMakefileGenerator::writeIncPart(QTextStream &t) diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 8530825..a2f4c7b 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -57,6 +57,14 @@ Win32MakefileGenerator::Win32MakefileGenerator() : MakefileGenerator() { } +void Win32MakefileGenerator::init() +{ + if (project->isEmpty("QMAKE_EXTENSION_STATICLIB")) + project->values("QMAKE_EXTENSION_STATICLIB").append("lib"); + if (project->isEmpty("QMAKE_EXTENSION_SHLIB")) + project->values("QMAKE_EXTENSION_SHLIB").append("lib"); +} + int Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem, const QString &ext) { @@ -365,12 +373,16 @@ void Win32MakefileGenerator::processVars() void Win32MakefileGenerator::fixTargetExt() { - if (!project->values("QMAKE_APP_FLAG").isEmpty()) + if (!project->values("QMAKE_APP_FLAG").isEmpty()) { project->values("TARGET_EXT").append(".exe"); - else if (project->isActiveConfig("shared")) - project->values("TARGET_EXT").append(project->first("TARGET_VERSION_EXT") + ".dll"); - else - project->values("TARGET_EXT").append(".lib"); + } else if (project->isActiveConfig("shared")) { + project->values("TARGET_EXT").append(project->first("TARGET_VERSION_EXT") + "." + + project->first("QMAKE_EXTENSION_SHLIB")); + project->values("TARGET").first() = project->first("QMAKE_PREFIX_SHLIB") + project->first("TARGET"); + } else { + project->values("TARGET_EXT").append("." + project->first("QMAKE_EXTENSION_STATICLIB")); + project->values("TARGET").first() = project->first("QMAKE_PREFIX_STATICLIB") + project->first("TARGET"); + } } void Win32MakefileGenerator::processRcFileVar() diff --git a/qmake/generators/win32/winmakefile.h b/qmake/generators/win32/winmakefile.h index 5437524..0e95beb 100644 --- a/qmake/generators/win32/winmakefile.h +++ b/qmake/generators/win32/winmakefile.h @@ -59,6 +59,7 @@ class Win32MakefileGenerator : public MakefileGenerator public: Win32MakefileGenerator(); ~Win32MakefileGenerator(); + void init(); protected: virtual QString defaultInstall(const QString &); virtual void writeCleanParts(QTextStream &t); -- cgit v0.12