diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-09-21 08:06:18 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-09-21 08:06:18 (GMT) |
commit | a4d1be727573a7a87c523a2ef28074c77d16f165 (patch) | |
tree | d4f8f218c41771ca17c7ab324390485af868fa8e /qmake/generators | |
parent | cd2fd21578a80bc5ac121c0419ee00b1799d0a60 (diff) | |
parent | 660ec910ef60513b511e2292255e53701dbb239b (diff) | |
download | Qt-a4d1be727573a7a87c523a2ef28074c77d16f165.zip Qt-a4d1be727573a7a87c523a2ef28074c77d16f165.tar.gz Qt-a4d1be727573a7a87c523a2ef28074c77d16f165.tar.bz2 |
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts:
src/corelib/kernel/qobject.h
src/declarative/graphicsitems/qdeclarativeflickable.cpp
src/declarative/graphicsitems/qdeclarativeflickable_p_p.h
src/declarative/util/qdeclarativelistmodel.cpp
Diffstat (limited to 'qmake/generators')
-rw-r--r-- | qmake/generators/makefile.cpp | 4 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake_sbsv2.cpp | 351 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake_sbsv2.h | 15 | ||||
-rw-r--r-- | qmake/generators/unix/unixmake.cpp | 51 |
4 files changed, 280 insertions, 141 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 6214d33..9579ae4 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -1794,10 +1794,12 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) const QString c = Option::fixPathToLocalOS(cmdline.at(argv0), true); if(exists(c)) { cmdline[argv0] = escapeFilePath(Option::fixPathToLocalOS(cmdline.at(argv0), false)); - tmp_dep_cmd = cmdline.join(" "); } else { cmdline[argv0] = escapeFilePath(cmdline.at(argv0)); } + QFileInfo cmdFileInfo(cmdline[argv0]); + if (!cmdFileInfo.isAbsolute() || cmdFileInfo.exists()) + tmp_dep_cmd = cmdline.join(" "); } dep_cd_cmd = QLatin1String("cd ") + escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false)) diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index c66c1b8..32c31ee 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -56,12 +56,21 @@ SymbianSbsv2MakefileGenerator::~SymbianSbsv2MakefileGenerator() { } #define FLM_DEST_DIR "epoc32/tools/makefile_templates/qt" #define FLM_SOURCE_DIR "/mkspecs/symbian-sbsv2/flm/qt" -#define UNDETECTED_GCCE_VERSION "0" #define PLATFORM_GCCE "gcce" #define PLATFORM_WINSCW "winscw" -#define PLATFORM_ARMV5 "armv5" +#define PLATFORM_ARM_PREFIX "arm" #define BUILD_DEBUG "udeb" #define BUILD_RELEASE "urel" +#define SBS_RVCT_PREFIX "rvct" + +static QString winscwPlatform; +static QString armPlatformPrefix; +static QString gccePlatform; +static QString sbsRvctPrefix; + +#if defined(Q_OS_UNIX) + extern char **environ; +#endif // Copies Qt FLMs to correct location under epocroot. // This is not done by configure as it is possible to change epocroot after configure. @@ -96,64 +105,95 @@ void SymbianSbsv2MakefileGenerator::exportFlm() } } -QString SymbianSbsv2MakefileGenerator::gcceVersion() +void SymbianSbsv2MakefileGenerator::findInstalledCompilerVersions(const QString &matchExpression, + const QString &versionPrefix, + QStringList *versionList) { - static QString gcceVersionStr; - - if (gcceVersionStr.isEmpty()) { - // First check if QT_GCCE_VERSION has been set, and use that if it is - QByteArray qtGcceVersion = qgetenv("QT_GCCE_VERSION"); - if (!qtGcceVersion.isEmpty()) { - // Check that QT_GCCE_VERSION is in proper format - QString check(qtGcceVersion); - check.replace(QRegExp("^\\d+\\.\\d+\\.\\d+$"),QString()); - if (check.isEmpty()) { - gcceVersionStr = PLATFORM_GCCE + QString(qtGcceVersion).replace(".","_"); - return gcceVersionStr; - } else { - fprintf(stderr, "Warning: Environment variable QT_GCCE_VERSION ('%s') is in incorrect " - "format, expected format is: '1.2.3'. Attempting to autodetect GCCE version.", - qtGcceVersion.constData()); + // No need to be able to find env variables on other operating systems, + // as only linux and windows have support for symbian-sbsv2 toolchain +#if defined(Q_OS_UNIX) || defined(Q_OS_WIN) + char *entry = 0; + int count = 0; + QRegExp matcher(matchExpression); + while ((entry = environ[count++])) { + if (matcher.exactMatch(QString::fromLocal8Bit(entry)) + && fileInfo(matcher.cap(matcher.captureCount())).exists()) { + // First capture (index 0) is the whole match, which is skipped. + // Next n captures are version numbers, which are interesting. + // Final capture is the env var value, which we alrady used, so that is skipped, too. + int capture = 1; + int finalCapture = matcher.captureCount() - 1; + QString version = versionPrefix; + while (capture <= finalCapture) { + version.append(matcher.cap(capture)); + if (capture != finalCapture) + version.append(QLatin1Char('.')); + capture++; } + *versionList << version; } - // Sbsv2 has separate env variable defined for each gcce version, so try to determine - // which user is likely to want to use by checking version 4.0.0 to 9.9.9 and taking - // the highest found version that actually points to a valid path. - // This is kind of a kludge, but since qmake doesn't bootstrap QProcess, there - // is no Qt API available to get all environment variables. - for (int i = 9; i >= 4; i--) { - for (int j = 9; j >= 0; j--) { - for (int k = 9; k >= 0; k--) { - QByteArray gcceVar = qgetenv(qPrintable(QString("SBS_GCCE%1%2%3BIN").arg(i).arg(j).arg(k))); - if (!gcceVar.isEmpty() && fileInfo(QString::fromLocal8Bit(gcceVar.constData())).exists()) { - gcceVersionStr = QString(PLATFORM_GCCE "%1_%2_%3").arg(i).arg(j).arg(k); - return gcceVersionStr; - } - } - } + } +#endif +} + +void SymbianSbsv2MakefileGenerator::findGcceVersions(QStringList *gcceVersionList, + QString *defaultVersion) +{ + QString matchStr = QLatin1String("SBS_GCCE(\\d)(\\d)(\\d)BIN=(.*)"); + findInstalledCompilerVersions(matchStr, gccePlatform, gcceVersionList); + + QString qtGcceVersion = QString::fromLocal8Bit(qgetenv("QT_GCCE_VERSION")); + + if (!qtGcceVersion.isEmpty()) { + if (QRegExp("\\d+\\.\\d+\\.\\d+").exactMatch(qtGcceVersion)) { + *defaultVersion = gccePlatform + qtGcceVersion; + } else { + fprintf(stderr, "Warning: Variable QT_GCCE_VERSION ('%s') is in incorrect " + "format, expected format is: 'x.y.z'. Attempting to autodetect GCCE version.\n", + qPrintable(qtGcceVersion)); } } - // Indicate undetected version to avoid rechecking multiple times - if (gcceVersionStr.isEmpty()) - gcceVersionStr = UNDETECTED_GCCE_VERSION; + if (defaultVersion->isEmpty() && gcceVersionList->size()) { + gcceVersionList->sort(); + *defaultVersion = gcceVersionList->last(); + } +} + +void SymbianSbsv2MakefileGenerator::findRvctVersions(QStringList *rvctVersionList, + QString *defaultVersion) +{ + QString matchStr = QLatin1String("RVCT(\\d)(\\d)BIN=(.*)"); + findInstalledCompilerVersions(matchStr, sbsRvctPrefix, rvctVersionList); + + QString qtRvctVersion = QString::fromLocal8Bit(qgetenv("QT_RVCT_VERSION")); - return gcceVersionStr; + if (!qtRvctVersion.isEmpty()) { + if (QRegExp("\\d+\\.\\d+").exactMatch(qtRvctVersion)) { + *defaultVersion = sbsRvctPrefix + qtRvctVersion; + } else { + fprintf(stderr, "Warning: Variable QT_RVCT_VERSION ('%s') is in incorrect " + "format, expected format is: 'x.y'.\n", + qPrintable(qtRvctVersion)); + } + } } -QString SymbianSbsv2MakefileGenerator::configClause(QString &platform, - QString &build, - QString &winscwClauseTemplate, - QString &gcceClauseTemplate, - QString &genericClauseTemplate) +QString SymbianSbsv2MakefileGenerator::configClause(const QString &platform, + const QString &build, + const QString &compilerVersion, + const QString &clauseTemplate) { QString retval; - if (QString::compare(platform, PLATFORM_WINSCW) == 0) - retval = winscwClauseTemplate.arg(build); - else if (QString::compare(platform, PLATFORM_GCCE) == 0) - retval = gcceClauseTemplate.arg(build); - else - retval = genericClauseTemplate.arg(platform).arg(build); + if (QString::compare(platform, winscwPlatform) == 0) { + retval = clauseTemplate.arg(build); + } else if (platform.startsWith(armPlatformPrefix)) { + QString fixedCompilerVersion = compilerVersion; + fixedCompilerVersion.replace(".","_"); + retval = clauseTemplate.arg(platform.mid(sizeof(PLATFORM_ARM_PREFIX)-1)) + .arg(build) + .arg(fixedCompilerVersion); + } // else - Unsupported platform for makefile target, return empty clause return retval; } @@ -185,52 +225,101 @@ void SymbianSbsv2MakefileGenerator::writeMkFile(const QString& wrapperFileName, void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile) { - static QString debugBuild(BUILD_DEBUG); - static QString releaseBuild(BUILD_RELEASE); + static QString debugBuild; + static QString releaseBuild; + static QString defaultGcceCompilerVersion; + static QString defaultRvctCompilerVersion; + static QStringList rvctVersions; + static QStringList gcceVersions; + static QStringList allArmCompilerVersions; + + // Initialize static variables used in makefile creation + if (debugBuild.isEmpty()) { + debugBuild.append(QLatin1String(BUILD_DEBUG)); + releaseBuild.append(QLatin1String(BUILD_RELEASE)); + winscwPlatform.append(QLatin1String(PLATFORM_WINSCW)); + gccePlatform.append(QLatin1String(PLATFORM_GCCE)); + armPlatformPrefix.append(QLatin1String(PLATFORM_ARM_PREFIX)); + sbsRvctPrefix.append(QLatin1String(SBS_RVCT_PREFIX)); + + findGcceVersions(&gcceVersions, &defaultGcceCompilerVersion); + findRvctVersions(&rvctVersions, &defaultRvctCompilerVersion); + + allArmCompilerVersions << rvctVersions << gcceVersions; + + if (!allArmCompilerVersions.size()) { + fprintf(stderr, "Warning: No HW compilers detected. " + "Please install either GCCE or RVCT compiler to enable release builds.\n"); + } + } QStringList allPlatforms; foreach(QString platform, project->values("SYMBIAN_PLATFORMS")) { allPlatforms << platform.toLower(); } + if (!gcceVersions.size()) + allPlatforms.removeAll(gccePlatform); + QString testClause; if (project->isActiveConfig(SYMBIAN_TEST_CONFIG)) testClause = QLatin1String(".test"); else testClause = QLatin1String(""); - QString genericClause = " -c %1_%2" + testClause; - QString winscwClause = " -c winscw_%1.mwccinc" + testClause; - QString gcceClause; - bool stripArmv5 = false; + // Note: armClause is used for gcce, too, which has a side effect + // of requiring armv* platform(s) in SYMBIAN_PLATFORMS in order + // to get any compiler version specific targets. + QString armClause = " -c " PLATFORM_ARM_PREFIX ".%1.%2.%3" + testClause; + QString genericArmClause; + if (defaultRvctCompilerVersion.isEmpty()) { + // Note: Argument %3 needs to be empty string in this version of clause + genericArmClause = " -c " PLATFORM_ARM_PREFIX "%1_%2%3" + testClause; + } else { + // If defaultRvctCompilerVersion is defined, use specific sbs clause for "generic" clause + genericArmClause = armClause; + } + QString winscwClause = " -c " PLATFORM_WINSCW "_%1.mwccinc" + testClause;; - if (allPlatforms.contains(PLATFORM_GCCE)) { - if (QString::compare(gcceVersion(), UNDETECTED_GCCE_VERSION) == 0) { - allPlatforms.removeAll(PLATFORM_GCCE); - } else { - gcceClause = " -c arm.v5.%1." + gcceVersion() + testClause; - // Since gcce building is enabled, do not add armv5 for any sbs command - // that also contains gcce, because those will build same targets. - stripArmv5 = true; + QStringList armPlatforms = allPlatforms.filter(QRegExp("^" PLATFORM_ARM_PREFIX)); + + if (!allArmCompilerVersions.size()) { + foreach (QString item, armPlatforms) { + allPlatforms.removeAll(item); } + armPlatforms.clear(); } QStringList allClauses; QStringList debugClauses; QStringList releaseClauses; + // Only winscw and arm platforms are supported QStringList debugPlatforms = allPlatforms; QStringList releasePlatforms = allPlatforms; - releasePlatforms.removeAll(PLATFORM_WINSCW); // No release for emulator + releasePlatforms.removeAll(winscwPlatform); // No release for emulator - foreach(QString item, debugPlatforms) { - if (item != PLATFORM_ARMV5 || !stripArmv5) - debugClauses << configClause(item, debugBuild, winscwClause, gcceClause, genericClause); + if (!releasePlatforms.size()) { + fprintf(stderr, "Warning: No valid release platforms in SYMBIAN_PLATFORMS (%s)\n" + "Most likely required compiler(s) are not properly installed.\n", + qPrintable(project->values("SYMBIAN_PLATFORMS").join(" "))); } - foreach(QString item, releasePlatforms) { - if (item != PLATFORM_ARMV5 || !stripArmv5) - releaseClauses << configClause(item, releaseBuild, winscwClause, gcceClause, genericClause); + + if (debugPlatforms.contains(winscwPlatform)) + debugClauses << configClause(winscwPlatform, debugBuild, QString(), winscwClause); + + foreach(QString item, armPlatforms) { + // Only use single clause per arm platform even if multiple compiler versions were found, + // otherwise we get makefile target collisions from sbsv2 toolchain. + if (rvctVersions.size()) { + debugClauses << configClause(item, debugBuild, defaultRvctCompilerVersion, genericArmClause); + releaseClauses << configClause(item, releaseBuild, defaultRvctCompilerVersion, genericArmClause); + } else { + debugClauses << configClause(item, debugBuild, defaultGcceCompilerVersion, armClause); + releaseClauses << configClause(item, releaseBuild, defaultGcceCompilerVersion, armClause); + } } + allClauses << debugClauses << releaseClauses; QTextStream t(&wrapperFile); @@ -270,22 +359,20 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo t << " -I\"" << values.at(i) << "\" "; } } - t << endl; - t << "first: default" << endl; - if (debugPlatforms.contains(PLATFORM_WINSCW)) - t << "default: debug-winscw"; - else if (debugPlatforms.contains(PLATFORM_ARMV5)) - t << "default: debug-armv5"; - else if (debugPlatforms.size()) - t << "default: debug-" << debugPlatforms.first(); - else - t << "default: all"; t << endl; + t << "first: default" << endl << endl; if (!isPrimaryMakefile) { - t << "all:" << endl; + t << "all:" << endl << endl; + t << "default: all" << endl << endl; } else { - t << "all: debug release" << endl; + t << "all: debug release" << endl << endl; + if (debugPlatforms.contains(winscwPlatform)) + t << "default: debug-winscw"; + else if (debugPlatforms.size()) + t << "default: debug-" << debugPlatforms.first(); + else + t << "default: all"; t << endl; QString qmakeCmd = "\t$(QMAKE) \"" + project->projectFile() + "\" " + buildArgs(); @@ -302,30 +389,80 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo t << "debug: " << BLD_INF_FILENAME << endl; t << "\t$(SBS)"; - foreach(QString item, debugClauses) { - t << item; + foreach(QString clause, debugClauses) { + t << clause; + } + t << endl; + t << "clean-debug: " << BLD_INF_FILENAME << endl; + t << "\t$(SBS) reallyclean"; + foreach(QString clause, debugClauses) { + t << clause; } t << endl; t << "release: " << BLD_INF_FILENAME << endl; t << "\t$(SBS)"; - foreach(QString item, releaseClauses) { - t << item; + foreach(QString clause, releaseClauses) { + t << clause; } t << endl; + t << "clean-release: " << BLD_INF_FILENAME << endl; + t << "\t$(SBS) reallyclean"; + foreach(QString clause, releaseClauses) { + t << clause; + } + t << endl << endl; + + QString defaultGcceArmVersion; + if (armPlatforms.size()) { + defaultGcceArmVersion = armPlatforms.first(); + } else { + defaultGcceArmVersion = QLatin1String("armv5"); + } - // For more specific builds, targets are in this form: build-platform, e.g. release-armv5 + // For more specific builds, targets are in this form: + // release-armv5 - generic target, compiler version determined by toolchain or autodetection + // release-armv5-rvct4.0 - compiler version specific target foreach(QString item, debugPlatforms) { + QString clause; + if (item.compare(winscwPlatform) == 0) + clause = configClause(item, debugBuild, QString(), winscwClause); + else if (item.compare(gccePlatform) == 0 ) + clause = configClause(defaultGcceArmVersion, debugBuild, defaultGcceCompilerVersion, armClause); + else // use generic arm clause + clause = configClause(item, debugBuild, defaultRvctCompilerVersion, genericArmClause); + t << "debug-" << item << ": " << BLD_INF_FILENAME << endl; - t << "\t$(SBS)"; - t << configClause(item, debugBuild, winscwClause, gcceClause, genericClause); - t << endl; + t << "\t$(SBS)" << clause << endl; + t << "clean-debug-" << item << ": " << BLD_INF_FILENAME << endl; + t << "\t$(SBS) reallyclean" << clause << endl; } foreach(QString item, releasePlatforms) { + QString clause; + if (item.compare(gccePlatform) == 0 ) + clause = configClause(defaultGcceArmVersion, releaseBuild, defaultGcceCompilerVersion, armClause); + else // use generic arm clause + clause = configClause(item, releaseBuild, defaultRvctCompilerVersion, genericArmClause); + t << "release-" << item << ": " << BLD_INF_FILENAME << endl; - t << "\t$(SBS)"; - t << configClause(item, releaseBuild, winscwClause, gcceClause, genericClause); - t << endl; + t << "\t$(SBS)" << clause << endl; + t << "clean-release-" << item << ": " << BLD_INF_FILENAME << endl; + t << "\t$(SBS) reallyclean" << clause << endl; + } + + foreach(QString item, armPlatforms) { + foreach(QString compilerVersion, allArmCompilerVersions) { + QString debugClause = configClause(item, debugBuild, compilerVersion, armClause); + QString releaseClause = configClause(item, releaseBuild, compilerVersion, armClause); + t << "debug-" << item << "-" << compilerVersion << ": " << BLD_INF_FILENAME << endl; + t << "\t$(SBS)" << debugClause << endl; + t << "clean-debug-" << item << "-" << compilerVersion << ": " << BLD_INF_FILENAME << endl; + t << "\t$(SBS) reallyclean" << debugClause << endl; + t << "release-" << item << "-" << compilerVersion << ": " << BLD_INF_FILENAME << endl; + t << "\t$(SBS)" << releaseClause << endl; + t << "clean-release-" << item << "-" << compilerVersion << ": " << BLD_INF_FILENAME << endl; + t << "\t$(SBS) reallyclean" << releaseClause << endl; + } } t << endl; @@ -344,7 +481,7 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo t << endl << endl; } - // Add all extra targets including extra compiler targest also to wrapper makefile, + // Add all extra targets including extra compiler targets also to wrapper makefile, // even though many of them may have already been added to bld.inf as FLMs. // This is to enable use of targets like 'mocables', which call targets generated by extra compilers. if (targetType != TypeSubdirs) { @@ -365,32 +502,6 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo } t << endl << endl; - t << "clean-debug: " << BLD_INF_FILENAME << endl; - t << "\t$(SBS) reallyclean"; - foreach(QString clause, debugClauses) { - t << clause; - } - t << endl << endl; - t << "clean-release: " << BLD_INF_FILENAME << endl; - t << "\t$(SBS) reallyclean"; - foreach(QString clause, releaseClauses) { - t << clause; - } - t << endl << endl; - - // For more specific builds, targets are in this form: clean-build-platform, e.g. clean-release-armv5 - foreach(QString item, debugPlatforms) { - t << "clean-debug-" << item << ": " << BLD_INF_FILENAME << endl; - t << "\t$(SBS) reallyclean"; - t << configClause(item, debugBuild, winscwClause, gcceClause, genericClause); - t << endl; - } - foreach(QString item, releasePlatforms) { - t << "clean-release-" << item << ": " << BLD_INF_FILENAME << endl; - t << "\t$(SBS) reallyclean"; - t << configClause(item, releaseBuild, winscwClause, gcceClause, genericClause); - t << endl; - } t << endl; } diff --git a/qmake/generators/symbian/symmake_sbsv2.h b/qmake/generators/symbian/symmake_sbsv2.h index 6644a03..557e3dd 100644 --- a/qmake/generators/symbian/symmake_sbsv2.h +++ b/qmake/generators/symbian/symmake_sbsv2.h @@ -65,12 +65,15 @@ public: private: void exportFlm(); - QString gcceVersion(); - QString configClause(QString &platform, - QString &build, - QString &winscwClauseTemplate, - QString &gcceClauseTemplate, - QString &genericClauseTemplate); + void findGcceVersions(QStringList *gcceVersionList, QString *defaultVersion); + void findRvctVersions(QStringList *rvctVersionList, QString *defaultVersion); + void findInstalledCompilerVersions(const QString &matchExpression, + const QString &versionPrefix, + QStringList *versionList); + QString configClause(const QString &platform, + const QString &build, + const QString &compilerVersion, + const QString &clauseTemplate); void writeSbsDeploymentList(const DeploymentList& depList, QTextStream& t); diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index db5b957..da4bbb7 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -622,31 +622,42 @@ UnixMakefileGenerator::processPrlFiles() //merge them into a logical order if(!project->isActiveConfig("no_smart_library_merge") && !project->isActiveConfig("no_lflags_merge")) { - QStringList lflags; + QHash<QString, QStringList> lflags; for(int lit = 0; lit < l.size(); ++lit) { + QString arch("default"); QString opt = l.at(lit).trimmed(); if(opt.startsWith("-")) { + if (Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-Xarch")) { + if (opt.length() > 7) { + arch = opt.mid(7); + opt = l.at(++lit); + } + } + if(opt.startsWith("-L") || (Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-F"))) { - if(lit == 0 || l.lastIndexOf(opt, lit-1) == -1) - lflags.append(opt); + if(lit == 0 || !lflags[arch].contains(opt)) + lflags[arch].append(opt); } else if(opt.startsWith("-l")) { - if(lit == l.size()-1 || l.indexOf(opt, lit+1) == -1) - lflags.append(opt); + if(lit == l.size()-1 || !lflags[arch].contains(opt)) + lflags[arch].append(opt); } else if(Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-framework")) { if(opt.length() > 11) opt = opt.mid(11); - else + else { opt = l.at(++lit); + if (Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-Xarch")) + opt = l.at(++lit); // The user has done the right thing and prefixed each part + } bool found = false; - for(int x = lit+1; x < l.size(); ++x) { - QString xf = l.at(x); + for(int x = 0; x < lflags[arch].size(); ++x) { + QString xf = lflags[arch].at(x); if(xf.startsWith("-framework")) { QString framework; if(xf.length() > 11) framework = xf.mid(11); else - framework = l.at(++x); + framework = lflags[arch].at(++x); if(framework == opt) { found = true; break; @@ -654,18 +665,30 @@ UnixMakefileGenerator::processPrlFiles() } } if(!found) { - lflags.append("-framework"); - lflags.append(opt); + lflags[arch].append("-framework"); + lflags[arch].append(opt); } } else { - lflags.append(opt); + lflags[arch].append(opt); } } else if(!opt.isNull()) { if(lit == 0 || l.lastIndexOf(opt, lit-1) == -1) - lflags.append(opt); + lflags[arch].append(opt); + } + } + + l = lflags.take("default"); + + // Process architecture specific options (Xarch) + QHash<QString, QStringList>::const_iterator archIterator = lflags.constBegin(); + while (archIterator != lflags.constEnd()) { + const QStringList archOptions = archIterator.value(); + for (int i = 0; i < archOptions.size(); ++i) { + l.append(QLatin1String("-Xarch_") + archIterator.key()); + l.append(archOptions.at(i)); } + ++archIterator; } - l = lflags; } } } |