From 153b79efac39c33e528650cca35f832e47f7302b Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 19 Oct 2010 10:10:08 +0200 Subject: Added object script support to RVCT when using MinGW qmake generator. RevBy: Oswald Buddenhagen --- mkspecs/common/symbian/symbian-makefile.conf | 2 ++ qmake/generators/win32/mingw_make.cpp | 46 +++++++++++++++++++++++----- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/mkspecs/common/symbian/symbian-makefile.conf b/mkspecs/common/symbian/symbian-makefile.conf index 4fc5812..cffc859 100644 --- a/mkspecs/common/symbian/symbian-makefile.conf +++ b/mkspecs/common/symbian/symbian-makefile.conf @@ -28,6 +28,8 @@ CONFIG *= no_plugin_name_prefix QMAKE_PREFIX_STATICLIB = QMAKE_SYMBIAN_SHLIB = 1 +QMAKE_LINK_OBJECT_SCRIPT = objects + is_using_gnupoc { DEFINES *= __QT_PRODUCT_INCLUDE_IS_LOWERCASE__ } diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index ea9e9e1..006a7d5 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -199,6 +199,23 @@ void createArObjectScriptFile(const QString &fileName, const QString &target, co } } +void createRvctObjectScriptFile(const QString &fileName, const QStringList &objList) +{ + QString filePath = Option::output_dir + QDir::separator() + fileName; + QFile file(filePath); + if (file.open(QIODevice::WriteOnly | QIODevice::Text)) { + QTextStream t(&file); + for (QStringList::ConstIterator it = objList.constBegin(); it != objList.constEnd(); ++it) { + if (QDir::isRelativePath(*it)) + t << "./" << *it << endl; + else + t << *it << endl; + } + t.flush(); + file.close(); + } +} + void MingwMakefileGenerator::writeMingwParts(QTextStream &t) { writeStandardParts(t); @@ -367,20 +384,33 @@ void MingwMakefileGenerator::writeObjectsPart(QTextStream &t) if (!var("BUILD_NAME").isEmpty()) { ar_script_file += "." + var("BUILD_NAME"); } - createArObjectScriptFile(ar_script_file, var("DEST_TARGET"), project->values("OBJECTS")); // QMAKE_LIB is used for win32, including mingw, whereas QMAKE_AR is used on Unix. - // Strip off any options since the ar commands will be read from file. - QString ar_cmd = var("QMAKE_LIB").section(" ", 0, 0);; - if (ar_cmd.isEmpty()) - ar_cmd = "ar"; - objectsLinkLine = ar_cmd + " -M < " + ar_script_file; + if (project->isActiveConfig("rvct_linker")) { + createRvctObjectScriptFile(ar_script_file, project->values("OBJECTS")); + QString ar_cmd = project->values("QMAKE_LIB").join(" "); + if (ar_cmd.isEmpty()) + ar_cmd = "armar --create"; + objectsLinkLine = ar_cmd + " " + var("DEST_TARGET") + " --via " + ar_script_file; + } else { + // Strip off any options since the ar commands will be read from file. + QString ar_cmd = var("QMAKE_LIB").section(" ", 0, 0);; + if (ar_cmd.isEmpty()) + ar_cmd = "ar"; + createArObjectScriptFile(ar_script_file, var("DEST_TARGET"), project->values("OBJECTS")); + objectsLinkLine = ar_cmd + " -M < " + ar_script_file; + } } else { QString ld_script_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET"); if (!var("BUILD_NAME").isEmpty()) { ld_script_file += "." + var("BUILD_NAME"); } - createLdObjectScriptFile(ld_script_file, project->values("OBJECTS")); - objectsLinkLine = ld_script_file; + if (project->isActiveConfig("rvct_linker")) { + createRvctObjectScriptFile(ld_script_file, project->values("OBJECTS")); + objectsLinkLine = QString::fromLatin1("--via ") + ld_script_file; + } else { + createLdObjectScriptFile(ld_script_file, project->values("OBJECTS")); + objectsLinkLine = ld_script_file; + } } Win32MakefileGenerator::writeObjectsPart(t); } -- cgit v0.12