diff options
author | Rohan McGovern <rohan.mcgovern@nokia.com> | 2011-05-15 23:09:31 (GMT) |
---|---|---|
committer | Rohan McGovern <rohan.mcgovern@nokia.com> | 2011-05-15 23:09:31 (GMT) |
commit | 5aa1cbcdacd19b2e526e358eddac1b7d55a994b5 (patch) | |
tree | 4aba78405e3d98081662fcb934f673acd1b79d42 /qmake | |
parent | 8592bcc80b7ec245b485fa54f8bd41c4484e93e0 (diff) | |
parent | 7e4a9187bb11b794e45d95d2e9fae026d6b0d07d (diff) | |
download | Qt-5aa1cbcdacd19b2e526e358eddac1b7d55a994b5.zip Qt-5aa1cbcdacd19b2e526e358eddac1b7d55a994b5.tar.gz Qt-5aa1cbcdacd19b2e526e358eddac1b7d55a994b5.tar.bz2 |
Merge remote branch 'origin/4.8' into qa-review-master
Conflicts:
tests/auto/qaccessibility/tst_qaccessibility.cpp
tests/auto/qsslsocket/tst_qsslsocket.cpp
Diffstat (limited to 'qmake')
28 files changed, 249 insertions, 209 deletions
diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index fd502e0..9dbe035 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -21,7 +21,8 @@ QOBJS=qtextcodec.o qutfcodec.o qstring.o qtextstream.o qiodevice.o qmalloc.o qgl qfsfileengine_iterator.o qregexp.o qvector.o qbitarray.o qdir.o qdiriterator.o quuid.o qhash.o \ qfileinfo.o qdatetime.o qstringlist.o qabstractfileengine.o qtemporaryfile.o \ qmap.o qmetatype.o qsettings.o qsystemerror.o qlibraryinfo.o qvariant.o qvsnprintf.o \ - qlocale.o qlinkedlist.o qurl.o qnumeric.o qcryptographichash.o qxmlstream.o qxmlutils.o \ + qlocale.o qlocale_tools.o qlocale_unix.o qlinkedlist.o qurl.o qnumeric.o qcryptographichash.o \ + qxmlstream.o qxmlutils.o \ $(QTOBJS) @@ -58,7 +59,10 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge $(SOURCE_PATH)/src/corelib/io/qfileinfo.cpp $(SOURCE_PATH)/src/corelib/tools/qdatetime.cpp \ $(SOURCE_PATH)/src/corelib/tools/qstringlist.cpp $(SOURCE_PATH)/src/corelib/tools/qmap.cpp \ $(SOURCE_PATH)/src/corelib/global/qconfig.cpp $(SOURCE_PATH)/src/corelib/io/qurl.cpp \ - $(SOURCE_PATH)/src/corelib/tools/qlocale.cpp $(SOURCE_PATH)/src/corelib/tools/qlinkedlist.cpp \ + $(SOURCE_PATH)/src/corelib/tools/qlocale.cpp \ + $(SOURCE_PATH)/src/corelib/tools/qlocale_tools.cpp \ + $(SOURCE_PATH)/src/corelib/tools/qlocale_unix.cpp \ + $(SOURCE_PATH)/src/corelib/tools/qlinkedlist.cpp \ $(SOURCE_PATH)/src/corelib/tools/qhash.cpp $(SOURCE_PATH)/src/corelib/kernel/qcore_mac.cpp \ $(SOURCE_PATH)/src/corelib/io/qtemporaryfile.cpp $(SOURCE_PATH)/src/corelib/kernel/qmetatype.cpp \ $(SOURCE_PATH)/src/corelib/io/qsettings.cpp $(SOURCE_PATH)/src/corelib/kernel/qvariant.cpp \ @@ -158,6 +162,12 @@ qstring.o: $(SOURCE_PATH)/src/corelib/tools/qstring.cpp qlocale.o: $(SOURCE_PATH)/src/corelib/tools/qlocale.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qlocale.cpp +qlocale_tools.o: $(SOURCE_PATH)/src/corelib/tools/qlocale_tools.cpp + $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qlocale_tools.cpp + +qlocale_unix.o: $(SOURCE_PATH)/src/corelib/tools/qlocale_unix.cpp + $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qlocale_unix.cpp + qdatastream.o: $(SOURCE_PATH)/src/corelib/io/qdatastream.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qdatastream.cpp diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index 0ab2932..6fd3939 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -98,6 +98,8 @@ QTOBJS= \ qlist.obj \ qlinkedlist.obj \ qlocale.obj \ + qlocale_tools.obj \ + qlocale_win.obj \ qmalloc.obj \ qmap.obj \ qregexp.obj \ diff --git a/qmake/Makefile.win32-g++ b/qmake/Makefile.win32-g++ index 0707a3a..d40dc29 100644 --- a/qmake/Makefile.win32-g++ +++ b/qmake/Makefile.win32-g++ @@ -28,7 +28,7 @@ CFLAGS = -c -o$@ -O \ -DQT_BOOTSTRAPPED -DQLIBRARYINFO_EPOCROOT CXXFLAGS = $(CFLAGS) LFLAGS = -static-libgcc -static-libstdc++ -s -LIBS = -lole32 -luuid +LIBS = -lole32 -luuid -ladvapi32 -lkernel32 LINKQMAKE = g++ $(LFLAGS) -o qmake.exe $(OBJS) $(QTOBJS) $(LIBS) ADDCLEAN = @@ -75,6 +75,8 @@ QTOBJS= \ qlist.o \ qlinkedlist.o \ qlocale.o \ + qlocale_tools.o \ + qlocale_win.o \ qmalloc.o \ qmap.o \ qregexp.o \ @@ -176,6 +178,12 @@ qstring.o: $(SOURCE_PATH)/src/corelib/tools/qstring.cpp qlocale.o: $(SOURCE_PATH)/src/corelib/tools/qlocale.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qlocale.cpp +qlocale_tools.o: $(SOURCE_PATH)/src/corelib/tools/qlocale_tools.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qlocale_tools.cpp + +qlocale_win.o: $(SOURCE_PATH)/src/corelib/tools/qlocale_win.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qlocale_win.cpp + quuid.o: $(SOURCE_PATH)/src/corelib/plugin/quuid.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/plugin/quuid.cpp diff --git a/qmake/Makefile.win32-g++-sh b/qmake/Makefile.win32-g++-sh index c3537e3..49ccfbc 100644 --- a/qmake/Makefile.win32-g++-sh +++ b/qmake/Makefile.win32-g++-sh @@ -28,7 +28,7 @@ CFLAGS = -c -o$@ -O \ -DQT_BOOTSTRAPPED -DQLIBRARYINFO_EPOCROOT CXXFLAGS = $(CFLAGS) LFLAGS = -static-libgcc -static-libstdc++ -s -LIBS = -lole32 -luuid +LIBS = -lole32 -luuid -ladvapi32 -lkernel32 LINKQMAKE = g++ $(LFLAGS) -o qmake.exe $(OBJS) $(QTOBJS) $(LIBS) ADDCLEAN = @@ -75,6 +75,8 @@ QTOBJS= \ qlist.o \ qlinkedlist.o \ qlocale.o \ + qlocale_tools.o \ + qlocale_win.o \ qmalloc.o \ qmap.o \ qregexp.o \ @@ -175,6 +177,12 @@ qstring.o: $(SOURCE_PATH)/src/corelib/tools/qstring.cpp qlocale.o: $(SOURCE_PATH)/src/corelib/tools/qlocale.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qlocale.cpp +qlocale_tools.o: $(SOURCE_PATH)/src/corelib/tools/qlocale_tools.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qlocale_tools.cpp + +qlocale_win.o: $(SOURCE_PATH)/src/corelib/tools/qlocale_win.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qlocale_win.cpp + quuid.o: $(SOURCE_PATH)/src/corelib/plugin/quuid.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/plugin/quuid.cpp diff --git a/qmake/cachekeys.h b/qmake/cachekeys.h index 2957d61..b29e4f2 100644 --- a/qmake/cachekeys.h +++ b/qmake/cachekeys.h @@ -118,54 +118,6 @@ struct FileInfoCacheKey inline uint qHash(const FileInfoCacheKey &f) { return f.hashCode(); } // ------------------------------------------------------------------------------------------------- -struct FileFixifyCacheKey -{ - mutable uint hash; - QString in_d, out_d; - QString file, pwd; - uint fixType; - bool canonicalize; - FileFixifyCacheKey(const QString &f, const QString &od, const QString &id, - uint ft, bool c) - { - hash = 0; - pwd = qmake_getpwd(); - file = f; - if(od.isNull()) - out_d = Option::output_dir; - else - out_d = od; - if(id.isNull()) - in_d = qmake_getpwd(); - else - in_d = id; - fixType = ft; - canonicalize = c; - } - QString toString() const { - return file + "--" + in_d + "--" + out_d + "--" + pwd + "--" + - QString::number(fixType) + "--" + QString::number((int)canonicalize); - } - bool operator==(const FileFixifyCacheKey &f) const - { - return (f.canonicalize == canonicalize && - f.fixType == fixType && - f.file == file && - f.in_d == in_d && - f.out_d == out_d && - f.pwd == pwd); - } - inline uint hashCode() const { - if(!hash) - hash = uint(canonicalize) | uint(fixType) | - qHash(file) | qHash(in_d) | qHash(out_d) /*|qHash(pwd)*/; - return hash; - } -}; - -inline uint qHash(const FileFixifyCacheKey &f) { return f.hashCode(); } -// ------------------------------------------------------------------------------------------------- - template <typename T> inline void qmakeDeleteCacheClear(void *i) { delete reinterpret_cast<T*>(i); } diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index e4764e0..626e41b 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -364,7 +364,7 @@ MakefileGenerator::findFilesInVPATH(QStringList l, uchar flags, const QString &v dir = regex.left(regex.lastIndexOf(Option::dir_sep) + 1); real_dir = dir; if(!(flags & VPATH_NoFixify)) - real_dir = fileFixify(real_dir, qmake_getpwd(), Option::output_dir); + real_dir = fileFixify(real_dir, qmake_getpwd(), Option::output_dir) + '/'; regex.remove(0, dir.length()); } if(real_dir.isEmpty() || exists(real_dir)) { @@ -383,16 +383,15 @@ MakefileGenerator::findFilesInVPATH(QStringList l, uchar flags, const QString &v for(int i = (int)files.count()-1; i >= 0; i--) { if(files[i] == "." || files[i] == "..") continue; - a = dir + files[i]; + a = real_dir + files[i]; if(!(flags & VPATH_NoFixify)) a = fileFixify(a); l.insert(val_it, a); } } } else { - debug_msg(1, "%s:%d Cannot match %s%c%s, as %s does not exist.", + debug_msg(1, "%s:%d Cannot match %s%s, as %s does not exist.", __FILE__, __LINE__, real_dir.toLatin1().constData(), - QDir::separator().toLatin1(), regex.toLatin1().constData(), real_dir.toLatin1().constData()); if(flags & VPATH_RemoveMissingFiles) remove_file = true; @@ -484,19 +483,22 @@ MakefileGenerator::init() subs.at(i).toLatin1().constData()); continue; } - inn = tinn.first(); - outn = toutn.first(); + inn = fileFixify(tinn.first(), qmake_getpwd()); + outn = fileFixify(toutn.first(), qmake_getpwd(), Option::output_dir); } else { - inn = subs.at(i); + inn = fileFixify(subs.at(i), qmake_getpwd()); + if (!QFile::exists(inn)) { + // random insanity for backwards compat: .in file specified with absolute out dir + inn = fileFixify(subs.at(i)); + } if(!inn.endsWith(".in")) { warn_msg(WarnLogic, "Substitute '%s' does not end with '.in'", inn.toLatin1().constData()); continue; } - outn = inn.left(inn.length()-3); + outn = fileFixify(inn.left(inn.length()-3), qmake_getpwd(), Option::output_dir); } - QFile in(fileFixify(inn)); - QFile out(fileFixify(outn, qmake_getpwd(), Option::output_dir)); + QFile in(inn); if(in.open(QFile::ReadOnly)) { QString contents; QStack<int> state; @@ -545,9 +547,10 @@ MakefileGenerator::init() else state.pop(); } else if(state.isEmpty() || state.top() == IN_CONDITION) { - contents += project->expand(line).join(QString(Option::field_sep)); + contents += project->expand(line, in.fileName(), count); } } + QFile out(outn); if(out.exists() && out.open(QFile::ReadOnly)) { QString old = QString::fromUtf8(out.readAll()); if(contents == old) { @@ -782,10 +785,8 @@ MakefileGenerator::init() } { //get the output_dir into the pwd - if(fileFixify(Option::output_dir) != fileFixify(qmake_getpwd())) - project->values("INCLUDEPATH").append(fileFixify(Option::output_dir, - Option::output_dir, - Option::output_dir)); + if(Option::output_dir != qmake_getpwd()) + project->values("INCLUDEPATH").append("."); } //fix up the target deps @@ -1485,18 +1486,20 @@ MakefileGenerator::createObjectList(const QStringList &sources) ReplaceExtraCompilerCacheKey::ReplaceExtraCompilerCacheKey(const QString &v, const QStringList &i, const QStringList &o) { + static QString doubleColon = QLatin1String("::"); + hash = 0; pwd = qmake_getpwd(); var = v; { QStringList il = i; il.sort(); - in = il.join("::"); + in = il.join(doubleColon); } { QStringList ol = o; ol.sort(); - out = ol.join("::"); + out = ol.join(doubleColon); } } @@ -1746,7 +1749,7 @@ MakefileGenerator::writeExtraTargets(QTextStream &t) deps += " " + escapeDependencyPath(dep); } if(project->values((*it) + ".CONFIG").indexOf("fix_target") != -1) - targ = fileFixify(targ); + targ = fileFixify(targ, Option::output_dir, Option::output_dir); if(project->isEmpty("QMAKE_NOFORCE") && project->values((*it) + ".CONFIG").indexOf("phony") != -1) deps += QString(" ") + "FORCE"; @@ -2373,6 +2376,14 @@ MakefileGenerator::writeSubDirs(QTextStream &t) qDeleteAll(targets); } +void MakefileGenerator::writeSubMakeCall(QTextStream &t, const QString &callPrefix, + const QString &makeArguments, const QString &callPostfix) +{ + t << callPrefix + << "$(MAKE)" << makeArguments + << callPostfix << endl; +} + void MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubTarget*> targets, int flags) { @@ -2462,7 +2473,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT //qmake it if(!subtarget->profile.isEmpty()) { QString out = subtarget->makefile; - QString in = fileFixify(in_directory + subtarget->profile, out_directory, QString(), FileFixifyAbsolute); + QString in = fileFixify(in_directory + subtarget->profile, FileFixifyAbsolute); if(out.startsWith(in_directory)) out = out.mid(in_directory.length()); t << mkfile << ": " << "\n\t"; @@ -2496,9 +2507,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT t << " " << valList(subtarget->depends); if(project->isEmpty("QMAKE_NOFORCE")) t << " FORCE"; - t << out_directory_cdin - << "$(MAKE)" << makefilein - << out_directory_cdout << endl; + writeSubMakeCall(t, out_directory_cdin, makefilein, out_directory_cdout); } for(int suffix = 0; suffix < targetSuffixes.size(); ++suffix) { @@ -2518,9 +2527,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT t << " " << targets.at(target-1)->target << "-" << targetSuffixes.at(suffix) << "-ordered "; if(project->isEmpty("QMAKE_NOFORCE")) t << " FORCE"; - t << out_directory_cdin - << "$(MAKE)" << makefilein << " " << s - << out_directory_cdout << endl; + writeSubMakeCall(t, out_directory_cdin, makefilein + " " + s, out_directory_cdout); } t << subtarget->target << "-" << targetSuffixes.at(suffix) << ": " << mkfile; if(!subtarget->depends.isEmpty()) @@ -2528,9 +2535,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT "-"+targetSuffixes.at(suffix)); if(project->isEmpty("QMAKE_NOFORCE")) t << " FORCE"; - t << out_directory_cdin - << "$(MAKE)" << makefilein << " " << s - << out_directory_cdout << endl; + writeSubMakeCall(t, out_directory_cdin, makefilein + " " + s, out_directory_cdout); } } t << endl; @@ -2661,12 +2666,10 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT //write the commands if(!out_directory.isEmpty()) { - t << out_directory_cdin - << "$(MAKE)" << makefilein << " " << sub_targ - << out_directory_cdout << endl; + writeSubMakeCall(t, out_directory_cdin, makefilein + " " + sub_targ, + out_directory_cdout); } else { - t << "\n\t" - << "$(MAKE)" << makefilein << " " << sub_targ << endl; + writeSubMakeCall(t, "\n\t", makefilein + " " + sub_targ, QString()); } } } @@ -2810,21 +2813,7 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q return file; QString ret = unescapeFilePath(file); - //setup the cache - static QHash<FileFixifyCacheKey, QString> *cache = 0; - if(!cache) { - cache = new QHash<FileFixifyCacheKey, QString>; - qmakeAddCacheClear(qmakeDeleteCacheClear<QHash<FileFixifyCacheKey, QString> >, (void**)&cache); - } - FileFixifyCacheKey cacheKey(ret, out_d, in_d, fix, canon); - QString cacheVal = cache->value(cacheKey); - if(!cacheVal.isNull()) - return cacheVal; - //do the fixin' - QString pwd = qmake_getpwd(); - if (!pwd.endsWith('/')) - pwd += '/'; QString orig_file = ret; if(ret.startsWith(QLatin1Char('~'))) { if(ret.startsWith(QLatin1String("~/"))) @@ -2833,12 +2822,16 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q warn_msg(WarnLogic, "Unable to expand ~ in %s", ret.toLatin1().constData()); } if(fix == FileFixifyAbsolute || (fix == FileFixifyDefault && project->isActiveConfig("no_fixpath"))) { - if(fix == FileFixifyAbsolute && QDir::isRelativePath(ret)) //already absolute + if(fix == FileFixifyAbsolute && QDir::isRelativePath(ret)) { //already absolute + QString pwd = qmake_getpwd(); + if (!pwd.endsWith(QLatin1Char('/'))) + pwd += QLatin1Char('/'); ret.prepend(pwd); + } ret = Option::fixPathToTargetOS(ret, false, canon); } else { //fix it.. QString out_dir = QDir(Option::output_dir).absoluteFilePath(out_d); - QString in_dir = QDir(pwd).absoluteFilePath(in_d); + QString in_dir = QDir(qmake_getpwd()).absoluteFilePath(in_d); { QFileInfo in_fi(fileInfo(in_dir)); if(in_fi.exists()) @@ -2892,6 +2885,7 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q //prepend for(int o = 0; o < i; o++) dot_prefix += ".." + Option::dir_sep; + break; } } ret.prepend(dot_prefix); @@ -2904,8 +2898,7 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q ret = "."; debug_msg(3, "Fixed[%d,%d] %s :: to :: %s [%s::%s] [%s::%s]", fix, canon, orig_file.toLatin1().constData(), ret.toLatin1().constData(), in_d.toLatin1().constData(), out_d.toLatin1().constData(), - pwd.toLatin1().constData(), Option::output_dir.toLatin1().constData()); - cache->insert(cacheKey, ret); + qmake_getpwd().toLatin1().constData(), Option::output_dir.toLatin1().constData()); return ret; } diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index e0ef52d..417370a 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -127,6 +127,8 @@ protected: SubTargetsNoFlags=0x00 }; QList<MakefileGenerator::SubTarget*> findSubDirsSubTargets() const; + virtual void writeSubMakeCall(QTextStream &t, const QString &outDirectory_cdin, + const QString &makeFileIn, const QString &outDirectory_cdout); void writeSubTargets(QTextStream &t, QList<SubTarget*> subtargets, int flags); //extra compiler interface diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.cpp b/qmake/generators/symbian/initprojectdeploy_symbian.cpp index f9fae9d..8d04a42 100644 --- a/qmake/generators/symbian/initprojectdeploy_symbian.cpp +++ b/qmake/generators/symbian/initprojectdeploy_symbian.cpp @@ -169,9 +169,7 @@ void initProjectDeploySymbian(QMakeProject* project, QStringList& generatedDirs, QStringList& generatedFiles) { - QString targetPath = project->values("deploy.path").join(" "); - if (targetPath.isEmpty()) - targetPath = testPath; + QString targetPath = testPath; if (targetPath.endsWith("/") || targetPath.endsWith("\\")) targetPath = targetPath.mid(0, targetPath.size() - 1); @@ -225,7 +223,10 @@ void initProjectDeploySymbian(QMakeProject* project, } else { if (0 == platform.compare(QLatin1String(EMULATOR_DEPLOYMENT_PLATFORM))) { if (devicePathHasDriveLetter) { - devicePath = qt_epocRoot() + "epoc32/winscw/" + devicePath.remove(1, 1); + if (devicePath.startsWith("!")) + devicePath = qt_epocRoot() + "epoc32/winscw/c" + devicePath.remove(0, 2); + else + devicePath = qt_epocRoot() + "epoc32/winscw/" + devicePath.remove(1, 1); } else { devicePath = qt_epocRoot() + "epoc32/winscw/c" + devicePath; } diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index 0fdef86..767645a 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -84,6 +84,12 @@ static void fixFlmCmd(QString *cmdLine, const QMap<QString, QString> &commandsTo // separator, so replace it with "&&" command concatenator. cmdLine->replace("\n\t", "&&"); + // Strip output suppression, as sbsv2 can't handle it in FLMs. Cannot be done by simply + // adding "@" to commandsToReplace, as it'd get handled last due to alphabetical ordering, + // potentially masking other commands that need replacing. + if (cmdLine->contains("@")) + cmdLine->replace(QRegExp(cmdFind.arg("@")), cmdReplace.arg("")); + // Iterate command replacements in reverse alphabetical order of keys so // that keys which are starts of other longer keys are iterated after longer keys. QMapIterator<QString, QString> cmdIter(commandsToReplace); diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 212f8bd..82f2366 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -96,7 +96,8 @@ UnixMakefileGenerator::writeMakefile(QTextStream &t) } if (project->values("TEMPLATE").first() == "app" || - project->values("TEMPLATE").first() == "lib") { + project->values("TEMPLATE").first() == "lib" || + project->values("TEMPLATE").first() == "aux") { if(Option::mkfile::do_stub_makefile && MakefileGenerator::writeStubMakefile(t)) return true; writeMakeParts(t); @@ -795,7 +796,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) ddir = project->first("QMAKE_DISTDIR"); QString ddir_c = escapeFilePath(fileFixify((project->isEmpty("OBJECTS_DIR") ? QString(".tmp/") : - project->first("OBJECTS_DIR")) + ddir)); + project->first("OBJECTS_DIR")) + ddir, + Option::output_dir, Option::output_dir)); t << "dist: " << "\n\t" << mkdir_p_asstring(ddir_c) << "\n\t" << "$(COPY_FILE) --parents $(SOURCES) $(DIST) " << ddir_c << Option::dir_sep << " && "; @@ -1016,6 +1018,9 @@ void UnixMakefileGenerator::init2() if(project->isEmpty("QMAKE_FRAMEWORK_VERSION")) project->values("QMAKE_FRAMEWORK_VERSION").append(project->values("VER_MAJ").first()); + if (project->values("TEMPLATE").first() == "aux") + return; + if (!project->values("QMAKE_APP_FLAG").isEmpty()) { if(!project->isEmpty("QMAKE_BUNDLE")) { QString bundle_loc = project->first("QMAKE_BUNDLE_LOCATION"); diff --git a/qmake/generators/win32/borland_bmake.cpp b/qmake/generators/win32/borland_bmake.cpp index 585a0f4..1f7de00 100644 --- a/qmake/generators/win32/borland_bmake.cpp +++ b/qmake/generators/win32/borland_bmake.cpp @@ -68,7 +68,8 @@ BorlandMakefileGenerator::writeMakefile(QTextStream &t) } if(project->first("TEMPLATE") == "app" || - project->first("TEMPLATE") == "lib") { + project->first("TEMPLATE") == "lib" || + project->first("TEMPLATE") == "aux") { writeBorlandParts(t); return MakefileGenerator::writeMakefile(t); } @@ -136,6 +137,11 @@ BorlandMakefileGenerator::init() void BorlandMakefileGenerator::writeBuildRulesPart(QTextStream &t) { + if (project->first("TEMPLATE") == "aux") { + t << "first:" << endl; + return; + } + t << "first: all" << endl; t << "all: " << fileFixify(Option::output.fileName()) << " " << varGlue("ALL_DEPS"," "," "," ") << " $(DESTDIR_TARGET)" << endl << endl; t << "$(DESTDIR_TARGET): " << var("PRE_TARGETDEPS") << " $(OBJECTS) " << var("POST_TARGETDEPS"); diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 462920e..0d15cfb 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -141,7 +141,8 @@ bool MingwMakefileGenerator::writeMakefile(QTextStream &t) } if(project->first("TEMPLATE") == "app" || - project->first("TEMPLATE") == "lib") { + project->first("TEMPLATE") == "lib" || + project->first("TEMPLATE") == "aux") { if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib") writePkgConfigFile(); @@ -436,6 +437,11 @@ void MingwMakefileGenerator::writeObjectsPart(QTextStream &t) void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t) { + if (project->first("TEMPLATE") == "aux") { + t << "first:" << endl; + return; + } + t << "first: all" << endl; t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName())) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS"))," "," "," ") << " $(DESTDIR_TARGET)" << endl << endl; t << "$(DESTDIR_TARGET): " << var("PRE_TARGETDEPS") << " $(OBJECTS) " << var("POST_TARGETDEPS"); diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index 9fd5fa9..d4d2400 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -1670,21 +1670,21 @@ void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, Xml for (int i = 0; i < project.SingleProjects.count(); ++i) { VCFilter filter; const VCProjectSingleConfig &singleCfg = project.SingleProjects.at(i); - if (filtername == "Root Files") { + if (filtername.startsWith("Root Files")) { filter = singleCfg.RootFiles; - } else if (filtername == "Source Files") { + } else if (filtername.startsWith("Source Files")) { filter = singleCfg.SourceFiles; - } else if (filtername == "Header Files") { + } else if (filtername.startsWith("Header Files")) { filter = singleCfg.HeaderFiles; - } else if (filtername == "Generated Files") { + } else if (filtername.startsWith("Generated Files")) { filter = singleCfg.GeneratedFiles; - } else if (filtername == "LexYacc Files") { + } else if (filtername.startsWith("LexYacc Files")) { filter = singleCfg.LexYaccFiles; - } else if (filtername == "Translation Files") { + } else if (filtername.startsWith("Translation Files")) { filter = singleCfg.TranslationFiles; - } else if (filtername == "Form Files") { + } else if (filtername.startsWith("Form Files")) { filter = singleCfg.FormFiles; - } else if (filtername == "Resource Files") { + } else if (filtername.startsWith("Resource Files")) { filter = singleCfg.ResourceFiles; } else { // ExtraCompilers @@ -1698,7 +1698,7 @@ void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, Xml if ( !fileAdded ) { - if (filtername == "Source Files") { + if (filtername.startsWith("Source Files")) { xmlFilter << tag("ClCompile") << attrTag("Include",Option::fixPathToLocalOS(info.file)) @@ -1707,7 +1707,7 @@ void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, Xml xml << tag("ClCompile") << attrTag("Include",Option::fixPathToLocalOS(info.file)); - } else if(filtername == "Header Files") { + } else if(filtername.startsWith("Header Files")) { xmlFilter << tag("ClInclude") << attrTag("Include",Option::fixPathToLocalOS(info.file)) @@ -1715,7 +1715,7 @@ void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, Xml xml << tag("ClInclude") << attrTag("Include",Option::fixPathToLocalOS(info.file)); - } else if(filtername == "Generated Files" || filtername == "Form Files") { + } else if(filtername.startsWith("Generated Files") || filtername.startsWith("Form Files")) { if (info.file.endsWith(".h")) { @@ -1751,7 +1751,7 @@ void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, Xml << attrTag("Include",Option::fixPathToLocalOS(info.file)); } - } else if(filtername == "Root Files") { + } else if(filtername.startsWith("Root Files")) { if (info.file.endsWith(".rc")) { @@ -1831,7 +1831,7 @@ bool VCXProjectWriter::outputFileConfig(VCFilter &filter, XmlOutput &xml, XmlOut xml << tag("CustomBuild") << attrTag("Include",Option::fixPathToLocalOS(filename)); - if ( filtername == "Form Files" || filtername == "Generated Files" || filtername == "Resource Files" ) + if ( filtername.startsWith("Form Files") || filtername.startsWith("Generated Files") || filtername.startsWith("Resource Files") ) xml << attrTagS("FileType", "Document"); } @@ -1842,7 +1842,7 @@ bool VCXProjectWriter::outputFileConfig(VCFilter &filter, XmlOutput &xml, XmlOut { fileAdded = true; - if (filtername == "Source Files") { + if (filtername.startsWith("Source Files")) { xmlFilter << tag("ClCompile") << attrTag("Include",Option::fixPathToLocalOS(filename)) @@ -1851,7 +1851,7 @@ bool VCXProjectWriter::outputFileConfig(VCFilter &filter, XmlOutput &xml, XmlOut xml << tag("ClCompile") << attrTag("Include",Option::fixPathToLocalOS(filename)); - } else if(filtername == "Header Files") { + } else if(filtername.startsWith("Header Files")) { xmlFilter << tag("ClInclude") << attrTag("Include",Option::fixPathToLocalOS(filename)) @@ -1859,7 +1859,7 @@ bool VCXProjectWriter::outputFileConfig(VCFilter &filter, XmlOutput &xml, XmlOut xml << tag("ClInclude") << attrTag("Include",Option::fixPathToLocalOS(filename)); - } else if(filtername == "Generated Files" || filtername == "Form Files") { + } else if(filtername.startsWith("Generated Files") || filtername.startsWith("Form Files")) { if (filename.endsWith(".h")) { @@ -1894,7 +1894,7 @@ bool VCXProjectWriter::outputFileConfig(VCFilter &filter, XmlOutput &xml, XmlOut xml << tag("CustomBuild") << attrTag("Include",Option::fixPathToLocalOS(filename)); } - } else if(filtername == "Root Files") { + } else if(filtername.startsWith("Root Files")) { if (filename.endsWith(".rc")) { diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index c55806d..52eaace 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -70,7 +70,8 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) } if(project->first("TEMPLATE") == "app" || - project->first("TEMPLATE") == "lib") { + project->first("TEMPLATE") == "lib" || + project->first("TEMPLATE") == "aux") { #if 0 if(Option::mkfile::do_stub_makefile) return MakefileGenerator::writeStubMakefile(t); @@ -85,6 +86,15 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) return false; } +void NmakeMakefileGenerator::writeSubMakeCall(QTextStream &t, const QString &callPrefix, + const QString &makeArguments, const QString &callPostfix) +{ + // Pass MAKEFLAGS as environment variable to sub-make calls. + // Unlike other make tools nmake doesn't do this automatically. + t << "\n\t@set MAKEFLAGS=$(MAKEFLAGS)"; + Win32MakefileGenerator::writeSubMakeCall(t, callPrefix, makeArguments, callPostfix); +} + QString NmakeMakefileGenerator::getPdbTarget() { return QString(project->first("TARGET") + project->first("TARGET_VERSION_EXT") + ".pdb"); @@ -332,6 +342,11 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t) void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) { + if (project->first("TEMPLATE") == "aux") { + t << "first:" << endl; + return; + } + t << "first: all" << endl; t << "all: " << fileFixify(Option::output.fileName()) << " " << varGlue("ALL_DEPS"," "," "," ") << "$(DESTDIR_TARGET)" << endl << endl; t << "$(DESTDIR_TARGET): " << var("PRE_TARGETDEPS") << " $(OBJECTS) " << var("POST_TARGETDEPS"); diff --git a/qmake/generators/win32/msvc_nmake.h b/qmake/generators/win32/msvc_nmake.h index 8954655..689cc19 100644 --- a/qmake/generators/win32/msvc_nmake.h +++ b/qmake/generators/win32/msvc_nmake.h @@ -57,6 +57,8 @@ class NmakeMakefileGenerator : public Win32MakefileGenerator void init(); protected: + virtual void writeSubMakeCall(QTextStream &t, const QString &callPrefix, + const QString &makeArguments, const QString &callPostfix); virtual QString getPdbTarget(); virtual QString defaultInstall(const QString &t); virtual QStringList &findDependencies(const QString &file); diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 815a476..88a5043 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -2219,6 +2219,9 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) Option::fixPathToLocalOS(inFile, true, false), out); if(Project->canExecute(dep_cmd)) { + dep_cmd.prepend(QLatin1String("cd ") + + Project->escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false)) + + QLatin1String(" && ")); if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) { QString indeps; while(!feof(proc)) { @@ -2233,7 +2236,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) for (int i = 0; i < extradeps.count(); ++i) { QString dd = extradeps.at(i).simplified(); if (!dd.isEmpty()) - deps += Project->fileFixify(dd); + deps += Project->fileFixify(dd, QString(), Option::output_dir); } } } diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 80f5bde..5807787 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -208,6 +208,7 @@ const char _slnExtSections[] = "\n\tGlobalSection(ExtensibilityGlobals) = pos VcprojGenerator::VcprojGenerator() : Win32MakefileGenerator(), init_flag(false), + is64Bit(false), projectWriter(0) { } @@ -360,6 +361,25 @@ QUuid VcprojGenerator::increaseUUID(const QUuid &id) return result; } +QStringList VcprojGenerator::collectSubDirs(QMakeProject *proj) +{ + QStringList subdirs; + QStringList tmp_proj_subdirs = proj->variables()["SUBDIRS"]; + for(int x = 0; x < tmp_proj_subdirs.size(); ++x) { + QString tmpdir = tmp_proj_subdirs.at(x); + if(!proj->isEmpty(tmpdir + ".file")) { + if(!proj->isEmpty(tmpdir + ".subdir")) + warn_msg(WarnLogic, "Cannot assign both file and subdir for subdir %s", + tmpdir.toLatin1().constData()); + tmpdir = proj->first(tmpdir + ".file"); + } else if(!proj->isEmpty(tmpdir + ".subdir")) { + tmpdir = proj->first(tmpdir + ".subdir"); + } + subdirs += tmpdir; + } + return subdirs; +} + void VcprojGenerator::writeSubDirs(QTextStream &t) { // Check if all requirements are fulfilled @@ -394,7 +414,6 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) QHash<QString, VcsolutionDepend*> solution_depends; QList<VcsolutionDepend*> solution_cleanup; - QStringList subdirs = project->values("SUBDIRS"); QString oldpwd = qmake_getpwd(); // Make sure that all temp projects are configured @@ -403,16 +422,9 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) QStringList old_after_vars = Option::after_user_vars; Option::after_user_vars.append("CONFIG+=release"); + QStringList subdirs = collectSubDirs(project); for(int i = 0; i < subdirs.size(); ++i) { QString tmp = subdirs.at(i); - if(!project->isEmpty(tmp + ".file")) { - if(!project->isEmpty(tmp + ".subdir")) - warn_msg(WarnLogic, "Cannot assign both file and subdir for subdir %s", - tmp.toLatin1().constData()); - tmp = project->first(tmp + ".file"); - } else if(!project->isEmpty(tmp + ".subdir")) { - tmp = project->first(tmp + ".subdir"); - } QFileInfo fi(fileInfo(Option::fixPathToLocalOS(tmp, true))); if(fi.exists()) { if(fi.isDir()) { @@ -436,19 +448,8 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) continue; } if(tmp_proj.first("TEMPLATE") == "vcsubdirs") { - QStringList tmp_proj_subdirs = tmp_proj.variables()["SUBDIRS"]; - for(int x = 0; x < tmp_proj_subdirs.size(); ++x) { - QString tmpdir = tmp_proj_subdirs.at(x); - if(!tmp_proj.isEmpty(tmpdir + ".file")) { - if(!tmp_proj.isEmpty(tmpdir + ".subdir")) - warn_msg(WarnLogic, "Cannot assign both file and subdir for subdir %s", - tmpdir.toLatin1().constData()); - tmpdir = tmp_proj.first(tmpdir + ".file"); - } else if(!tmp_proj.isEmpty(tmpdir + ".subdir")) { - tmpdir = tmp_proj.first(tmpdir + ".subdir"); - } + foreach(const QString &tmpdir, collectSubDirs(&tmp_proj)) subdirs += fileFixify(tmpdir); - } } else if(tmp_proj.first("TEMPLATE") == "vcapp" || tmp_proj.first("TEMPLATE") == "vclib") { // Initialize a 'fake' project to get the correct variables // and to be able to extract all the dependencies @@ -597,14 +598,16 @@ nextfile: } } t << _slnGlobalBeg; + + QString slnConf = _slnSolutionConf; if (!project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH")) { - QString slnConfCE = _slnSolutionConf; - QString platform = QString("|") + project->values("CE_SDK").join(" ") + " (" + project->first("CE_ARCH") + ")"; - slnConfCE.replace(QString("|Win32"), platform); - t << slnConfCE; - } else { - t << _slnSolutionConf; + QString slnPlatform = QString("|") + project->values("CE_SDK").join(" ") + " (" + project->first("CE_ARCH") + ")"; + slnConf.replace(QString("|Win32"), slnPlatform); + } else if (is64Bit) { + slnConf.replace(QString("|Win32"), "|x64"); } + t << slnConf; + t << _slnProjDepBeg; // Restore previous after_user_var options @@ -621,7 +624,7 @@ nextfile: t << _slnProjDepEnd; t << _slnProjConfBeg; for(QList<VcsolutionDepend*>::Iterator it = solution_cleanup.begin(); it != solution_cleanup.end(); ++it) { - QString platform = "Win32"; + QString platform = is64Bit ? "x64" : "Win32"; if (!project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH")) platform = project->values("CE_SDK").join(" ") + " (" + project->first("CE_ARCH") + ")"; t << "\n\t\t" << (*it)->uuid << QString(_slnProjDbgConfTag1).arg(platform) << platform; @@ -661,6 +664,7 @@ void VcprojGenerator::init() if (init_flag) return; init_flag = true; + is64Bit = (project->first("QMAKE_TARGET.arch") == "x86_64"); projectWriter = createProjectWriter(); if(project->first("TEMPLATE") == "vcsubdirs") //too much work for subdirs @@ -831,7 +835,7 @@ void VcprojGenerator::initProject() vcProject.Keyword = project->first("VCPROJ_KEYWORD"); if (project->isEmpty("CE_SDK") || project->isEmpty("CE_ARCH")) { - vcProject.PlatformName = (vcProject.Configuration.idl.TargetEnvironment == midlTargetWin64 ? "Win64" : "Win32"); + vcProject.PlatformName = (is64Bit ? "x64" : "Win32"); } else { vcProject.PlatformName = project->values("CE_SDK").join(" ") + " (" + project->first("CE_ARCH") + ")"; } @@ -895,7 +899,7 @@ void VcprojGenerator::initConfiguration() conf.Name = isDebug ? "Debug" : "Release"; conf.ConfigurationName = conf.Name; if (project->isEmpty("CE_SDK") || project->isEmpty("CE_ARCH")) { - conf.Name += (conf.idl.TargetEnvironment == midlTargetWin64 ? "|Win64" : "|Win32"); + conf.Name += (is64Bit ? "|x64" : "|Win32"); } else { conf.Name += "|" + project->values("CE_SDK").join(" ") + " (" + project->first("CE_ARCH") + ")"; } @@ -1319,6 +1323,9 @@ void VcprojGenerator::initResourceFiles() dep_cmd = Option::fixPathToLocalOS(dep_cmd, true, false); if(canExecute(dep_cmd)) { + dep_cmd.prepend(QLatin1String("cd ") + + escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false)) + + QLatin1String(" && ")); if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) { QString indeps; while(!feof(proc)) { @@ -1329,7 +1336,8 @@ void VcprojGenerator::initResourceFiles() } QT_PCLOSE(proc); if(!indeps.isEmpty()) - deps += fileFixify(indeps.replace('\n', ' ').simplified().split(' ')); + deps += fileFixify(indeps.replace('\n', ' ').simplified().split(' '), + QString(), Option::output_dir); } } } diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h index fdcd73f..c7f5c1b 100644 --- a/qmake/generators/win32/msvc_vcproj.h +++ b/qmake/generators/win32/msvc_vcproj.h @@ -57,6 +57,7 @@ struct QUuid; class VcprojGenerator : public Win32MakefileGenerator { bool init_flag; + bool is64Bit; bool writeVcprojParts(QTextStream &); bool writeMakefile(QTextStream &); @@ -131,6 +132,7 @@ protected: QList<VcprojGenerator*> mergedProjects; private: + QStringList collectSubDirs(QMakeProject *proj); QUuid increaseUUID(const QUuid &id); friend class VCFilter; }; diff --git a/qmake/generators/win32/msvc_vcxproj.cpp b/qmake/generators/win32/msvc_vcxproj.cpp index 1e7c4b7..5b75cfa 100644 --- a/qmake/generators/win32/msvc_vcxproj.cpp +++ b/qmake/generators/win32/msvc_vcxproj.cpp @@ -41,26 +41,9 @@ #include "msvc_vcxproj.h" #include "msbuild_objectmodel.h" -#include <qdir.h> -#include <qdiriterator.h> -#include <quuid.h> - - -QT_BEGIN_NAMESPACE -// Filter GUIDs (Do NOT change these!) ------------------------------ -const char _GUIDSourceFiles[] = "{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"; -const char _GUIDHeaderFiles[] = "{93995380-89BD-4b04-88EB-625FBE52EBFB}"; -const char _GUIDGeneratedFiles[] = "{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}"; -const char _GUIDResourceFiles[] = "{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}"; -const char _GUIDLexYaccFiles[] = "{E12AE0D2-192F-4d59-BD23-7D3FA58D3183}"; -const char _GUIDTranslationFiles[] = "{639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}"; -const char _GUIDFormFiles[] = "{99349809-55BA-4b9d-BF79-8FDBB0286EB3}"; -const char _GUIDExtraCompilerFiles[] = "{E0D8C965-CC5F-43d7-AD63-FAEF0BBC0F85}"; -QT_END_NAMESPACE QT_BEGIN_NAMESPACE - VcxprojGenerator::VcxprojGenerator() : VcprojGenerator() { } @@ -71,4 +54,3 @@ VCProjectWriter *VcxprojGenerator::createProjectWriter() } QT_END_NAMESPACE - diff --git a/qmake/generators/win32/msvc_vcxproj.h b/qmake/generators/win32/msvc_vcxproj.h index 3283cc7..90f6652 100644 --- a/qmake/generators/win32/msvc_vcxproj.h +++ b/qmake/generators/win32/msvc_vcxproj.h @@ -42,8 +42,6 @@ #ifndef MSVC_VCXPROJ_H #define MSVC_VCXPROJ_H -#include "winmakefile.h" -#include "msbuild_objectmodel.h" #include "msvc_vcproj.h" QT_BEGIN_NAMESPACE @@ -52,19 +50,11 @@ class VcxprojGenerator : public VcprojGenerator { public: VcxprojGenerator(); - ~VcxprojGenerator(); protected: virtual VCProjectWriter *createProjectWriter(); - -private: - friend class VCFilter; - }; -inline VcxprojGenerator::~VcxprojGenerator() -{ } - QT_END_NAMESPACE #endif // MSVC_VCXPROJ_H diff --git a/qmake/main.cpp b/qmake/main.cpp index 7dab23d..7d4d458 100644 --- a/qmake/main.cpp +++ b/qmake/main.cpp @@ -126,7 +126,9 @@ int runQMake(int argc, char **argv) } QMakeProperty prop; - if(Option::qmake_mode == Option::QMAKE_QUERY_PROPERTY || Option::qmake_mode == Option::QMAKE_SET_PROPERTY) + if(Option::qmake_mode == Option::QMAKE_QUERY_PROPERTY || + Option::qmake_mode == Option::QMAKE_SET_PROPERTY || + Option::qmake_mode == Option::QMAKE_UNSET_PROPERTY) return prop.exec() ? 0 : 101; QMakeProject project(&prop); diff --git a/qmake/option.cpp b/qmake/option.cpp index 1354281..dd28336 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -192,6 +192,7 @@ bool usage(const char *a0) " -norecursive Don't do a recursive search\n" " -recursive Do a recursive search\n" " -set <prop> <value> Set persistent property\n" + " -unset <prop> Unset persistent property\n" " -query <prop> Query persistent property. Show all if <prop> is empty.\n" " -cache file Use file as cache [makefile mode only]\n" " -spec spec Use spec as QMAKESPEC [makefile mode only]\n" @@ -226,6 +227,8 @@ Option::parseCommandLine(int argc, char **argv, int skip) Option::qmake_mode = Option::QMAKE_GENERATE_PRL; } else if(opt == "set") { Option::qmake_mode = Option::QMAKE_SET_PROPERTY; + } else if(opt == "unset") { + Option::qmake_mode = Option::QMAKE_UNSET_PROPERTY; } else if(opt == "query") { Option::qmake_mode = Option::QMAKE_QUERY_PROPERTY; } else if(opt == "makefile") { @@ -336,7 +339,8 @@ Option::parseCommandLine(int argc, char **argv, int skip) } else { bool handled = true; if(Option::qmake_mode == Option::QMAKE_QUERY_PROPERTY || - Option::qmake_mode == Option::QMAKE_SET_PROPERTY) { + Option::qmake_mode == Option::QMAKE_SET_PROPERTY || + Option::qmake_mode == Option::QMAKE_UNSET_PROPERTY) { Option::prop::properties.append(arg); } else { QFileInfo fi(arg); @@ -626,16 +630,18 @@ Option::fixString(QString string, uchar flags) qmakeAddCacheClear(qmakeDeleteCacheClear<QHash<FixStringCacheKey, QString> >, (void**)&cache); } FixStringCacheKey cacheKey(string, flags); - if(cache->contains(cacheKey)) { - const QString ret = cache->value(cacheKey); - //qDebug() << "Fix (cached) " << orig_string << "->" << ret; - return ret; + + QHash<FixStringCacheKey, QString>::const_iterator it = cache->constFind(cacheKey); + + if (it != cache->constEnd()) { + //qDebug() << "Fix (cached) " << orig_string << "->" << it.value(); + return it.value(); } //fix the environment variables if(flags & Option::FixEnvVars) { int rep; - QRegExp reg_var("\\$\\(.*\\)"); + static QRegExp reg_var("\\$\\(.*\\)"); reg_var.setMinimal(true); while((rep = reg_var.indexIn(string)) != -1) string.replace(rep, reg_var.matchedLength(), diff --git a/qmake/option.h b/qmake/option.h index bc87343..e17ce5a 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -148,8 +148,9 @@ struct Option } //global qmake mode, can only be in one mode per invocation! - enum QMAKE_MODE { QMAKE_GENERATE_NOTHING, QMAKE_GENERATE_PROJECT, QMAKE_GENERATE_MAKEFILE, - QMAKE_GENERATE_PRL, QMAKE_SET_PROPERTY, QMAKE_QUERY_PROPERTY }; + enum QMAKE_MODE { QMAKE_GENERATE_NOTHING, + QMAKE_GENERATE_PROJECT, QMAKE_GENERATE_MAKEFILE, QMAKE_GENERATE_PRL, + QMAKE_SET_PROPERTY, QMAKE_UNSET_PROPERTY, QMAKE_QUERY_PROPERTY }; static QMAKE_MODE qmake_mode; //all modes diff --git a/qmake/project.cpp b/qmake/project.cpp index 815f210..d4fa786 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1342,10 +1342,10 @@ QMakeProject::read(uchar cmd) } if(QDir::isRelativePath(qmakespec)) { - if (QFile::exists(qmakespec+"/qmake.conf")) { - Option::mkfile::qmakespec = QFileInfo(Option::mkfile::qmakespec).absoluteFilePath(); - } else if (QFile::exists(Option::output_dir+"/"+qmakespec+"/qmake.conf")) { + if (QFile::exists(Option::output_dir+"/"+qmakespec+"/qmake.conf")) { qmakespec = Option::mkfile::qmakespec = QFileInfo(Option::output_dir+"/"+qmakespec).absoluteFilePath(); + } else if (QFile::exists(qmakespec+"/qmake.conf")) { + Option::mkfile::qmakespec = QFileInfo(Option::mkfile::qmakespec).absoluteFilePath(); } else { bool found_mkspec = false; for(QStringList::ConstIterator it = mkspec_roots.begin(); it != mkspec_roots.end(); ++it) { @@ -2770,6 +2770,20 @@ QMakeProject::expand(const QString &str) return QStringList(); } +QString +QMakeProject::expand(const QString &str, const QString &file, int line) +{ + bool ok; + parser_info pi = parser; + parser.file = file; + parser.line_no = line; + parser.from_file = false; + QMap<QString, QStringList> tmp = vars; + const QStringList ret = doVariableReplaceExpand(str, tmp, &ok); + parser = pi; + return ok ? ret.join(QString(Option::field_sep)) : QString(); +} + QStringList QMakeProject::expand(const QString &func, const QList<QStringList> &args) { @@ -3025,17 +3039,17 @@ QStringList &QMakeProject::values(const QString &_var, QMap<QString, QStringList if(!Option::user_template.isEmpty()) { var = ".BUILTIN.USER." + var; place[var] = QStringList(Option::user_template); - } else if(!place[var].isEmpty()) { - QString orig_template = place["TEMPLATE"].first(), real_template; + } else { + QString orig_template, real_template; + if(!place[var].isEmpty()) + orig_template = place[var].first(); + real_template = orig_template.isEmpty() ? "app" : orig_template; if(!Option::user_template_prefix.isEmpty() && !orig_template.startsWith(Option::user_template_prefix)) - real_template = Option::user_template_prefix + orig_template; - if(!real_template.isEmpty()) { + real_template.prepend(Option::user_template_prefix); + if(real_template != orig_template) { var = ".BUILTIN." + var; place[var] = QStringList(real_template); } - } else { - var = ".BUILTIN." + var; - place[var] = QStringList("app"); } } else if(var.startsWith(QLatin1String("QMAKE_HOST."))) { QString ret, type = var.mid(11); diff --git a/qmake/project.h b/qmake/project.h index 09aa45e..0e6131d 100644 --- a/qmake/project.h +++ b/qmake/project.h @@ -144,6 +144,7 @@ public: QMap<QString, QStringList> &place); QStringList expand(const QString &v); + QString expand(const QString &v, const QString &file, int line); QStringList expand(const QString &func, const QList<QStringList> &args); bool test(const QString &v); bool test(const QString &func, const QList<QStringList> &args); diff --git a/qmake/property.cpp b/qmake/property.cpp index d84f8e1..0c36c1c 100644 --- a/qmake/property.cpp +++ b/qmake/property.cpp @@ -160,6 +160,13 @@ QMakeProperty::setValue(QString var, const QString &val) settings->setValue(keyBase() + var, val); } +void +QMakeProperty::remove(const QString &var) +{ + initSettings(); + settings->remove(keyBase() + var); +} + bool QMakeProperty::exec() { @@ -230,6 +237,13 @@ QMakeProperty::exec() if(!var.startsWith(".")) setValue(var, (*it)); } + } else if(Option::qmake_mode == Option::QMAKE_UNSET_PROPERTY) { + for(QStringList::ConstIterator it = Option::prop::properties.begin(); + it != Option::prop::properties.end(); it++) { + QString var = (*it); + if(!var.startsWith(".")) + remove(var); + } } return ret; } diff --git a/qmake/property.h b/qmake/property.h index 43b7529..5e8379e 100644 --- a/qmake/property.h +++ b/qmake/property.h @@ -62,6 +62,7 @@ public: bool hasValue(QString); QString value(QString v) { return value(v, false); } void setValue(QString, const QString &); + void remove(const QString &); bool exec(); }; diff --git a/qmake/qmake.pri b/qmake/qmake.pri index bc7ddb8..d6c5f09 100644 --- a/qmake/qmake.pri +++ b/qmake/qmake.pri @@ -141,7 +141,7 @@ bootstrap { #Qt code SOURCES += qfilesystemengine_win.cpp qfsfileengine_win.cpp qfilesystemiterator_win.cpp qsettings_win.cpp \ qsystemlibrary.cpp win32-msvc*:LIBS += ole32.lib advapi32.lib - win32-g++*:LIBS += -lole32 -luuid + win32-g++*:LIBS += -lole32 -luuid -ladvapi32 -lkernel32 } qnx { |