diff options
Diffstat (limited to 'qmake')
26 files changed, 572 insertions, 641 deletions
diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index c7f4dc4..6ba5b6b 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -13,7 +13,7 @@ OBJS=project.o property.o main.o makefile.o unixmake2.o unixmake.o \ symmake.o initprojectdeploy_symbian.o symmake_abld.o symmake_sbsv2.o #qt code -QOBJS=qstring.o qtextstream.o qiodevice.o qmalloc.o qglobal.o \ +QOBJS=qtextcodec.o qutfcodec.o qstring.o qtextstream.o qiodevice.o qmalloc.o qglobal.o \ qbytearray.o qbytearraymatcher.o qdatastream.o qbuffer.o qlistdata.o qfile.o \ qfsfileengine_unix.o qfsfileengine_iterator_unix.o qfsfileengine.o \ qfsfileengine_iterator.o qregexp.o qvector.o qbitarray.o qdir.o qdiriterator.o quuid.o qhash.o \ @@ -47,6 +47,7 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge generators/win32/msvc_objectmodel.cpp generators/win32/msvc_nmake.cpp generators/win32/borland_bmake.cpp \ generators/symbian/symmake.cpp generators/symbian/initprojectdeploy_symbian.cpp \ generators/symbian/symmake_abld.cpp generators/symbian/symmake_sbsv2.cpp \ + $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp \ $(SOURCE_PATH)/src/corelib/tools/qstring.cpp $(SOURCE_PATH)/src/corelib/io/qfile.cpp \ $(SOURCE_PATH)/src/corelib/io/qtextstream.cpp $(SOURCE_PATH)/src/corelib/io/qiodevice.cpp \ $(SOURCE_PATH)/src/corelib/global/qmalloc.cpp \ @@ -165,6 +166,12 @@ qcore_mac.o: $(SOURCE_PATH)/src/corelib/kernel/qcore_mac.cpp qurl.o: $(SOURCE_PATH)/src/corelib/io/qurl.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qurl.cpp +qutfcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp + $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp + +qtextcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp + $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp + qstring.o: $(SOURCE_PATH)/src/corelib/tools/qstring.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qstring.cpp diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index 3f4f8d4..929f950 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -110,6 +110,8 @@ QTOBJS= \ qmalloc.obj \ qmap.obj \ qregexp.obj \ + qtextcodec.obj \ + qutfcodec.obj \ qstring.obj \ qstringlist.obj \ qtextstream.obj \ @@ -198,6 +200,8 @@ clean:: -del qmalloc.obj -del qmap.obj -del qregexp.obj + -del qtextcodec.obj + -del qutfcodec.obj -del qstring.obj -del qstringlist.obj -del qtextstream.obj @@ -347,6 +351,9 @@ qbytearraymatcher.obj: $(SOURCE_PATH)\src\corelib\tools\qbytearraymatcher.cpp qchar.obj: $(SOURCE_PATH)\src\corelib\tools\qchar.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\tools\qchar.cpp +qutfcodec.obj: $(SOURCE_PATH)\src\corelib\codecs\qutfcodec.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\codecs\qutfcodec.cpp + qstring.obj: $(SOURCE_PATH)\src\corelib\tools\qstring.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\tools\qstring.cpp @@ -389,8 +396,8 @@ qfsfileengine_iterator.obj: $(SOURCE_PATH)\src\corelib\io\qfsfileengine_iterator qabstractfileengine.obj: $(SOURCE_PATH)\src\corelib\io\qabstractfileengine.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\io\qabstractfileengine.cpp -qtextcodec.obj: $(SOURCE_PATH)\src\codecs\qtextcodec.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\codecs\qtextcodec.cpp +qtextcodec.obj: $(SOURCE_PATH)\src\corelib\codecs\qtextcodec.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\codecs\qtextcodec.cpp qregexp.obj: $(SOURCE_PATH)\src\corelib\tools\qregexp.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\tools\qregexp.cpp diff --git a/qmake/Makefile.win32-g++ b/qmake/Makefile.win32-g++ index 03ca6dd..c18201e 100644 --- a/qmake/Makefile.win32-g++ +++ b/qmake/Makefile.win32-g++ @@ -75,6 +75,8 @@ QTOBJS= \ qmalloc.o \ qmap.o \ qregexp.o \ + qtextcodec.o \ + qutfcodec.o \ qstring.o \ qstringlist.o \ qtextstream.o \ @@ -198,6 +200,9 @@ qvsnprintf.o: $(SOURCE_PATH)/src/corelib/tools/qvsnprintf.cpp qbytearraymatcher.o: $(SOURCE_PATH)/src/corelib/tools/qbytearraymatcher.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qbytearraymatcher.cpp +qutfcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp + qstring.o: $(SOURCE_PATH)/src/corelib/tools/qstring.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qstring.cpp @@ -237,8 +242,8 @@ qfsfileengine.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine.cpp qfsfileengine_iterator.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator.cpp -qtextcodec.o: $(SOURCE_PATH)/src/codecs/qtextcodec.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/codecs/qtextcodec.cpp +qtextcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp qregexp.o: $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp diff --git a/qmake/Makefile.win32-g++-sh b/qmake/Makefile.win32-g++-sh index bd1b8b5..e02a021 100644 --- a/qmake/Makefile.win32-g++-sh +++ b/qmake/Makefile.win32-g++-sh @@ -75,6 +75,8 @@ QTOBJS= \ qmalloc.o \ qmap.o \ qregexp.o \ + qtextcodec.o \ + qutfcodec.o \ qstring.o \ qstringlist.o \ qtextstream.o \ @@ -197,6 +199,9 @@ qvsnprintf.o: $(SOURCE_PATH)/src/corelib/tools/qvsnprintf.cpp qbytearraymatcher.o: $(SOURCE_PATH)/src/corelib/tools/qbytearraymatcher.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qbytearraymatcher.cpp +qutfcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp + qstring.o: $(SOURCE_PATH)/src/corelib/tools/qstring.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qstring.cpp @@ -236,8 +241,8 @@ qfsfileengine.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine.cpp qfsfileengine_iterator.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator.cpp -qtextcodec.o: $(SOURCE_PATH)/src/codecs/qtextcodec.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/codecs/qtextcodec.cpp +qtextcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp qregexp.o: $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index dae38fc..a983d3b 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -156,7 +156,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) QString profile = tmp; if(!profile.endsWith(Option::dir_sep)) profile += Option::dir_sep; - profile += fi.baseName() + ".pro"; + profile += fi.baseName() + Option::pro_ext; fi = QFileInfo(profile); } QMakeProject tmp_proj; diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 345f999..0db24ae 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -121,7 +121,7 @@ bool MakefileGenerator::mkdir(const QString &in_path) const QDir d; if(path.startsWith(QDir::separator())) { d.cd(QString(QDir::separator())); - path = path.right(path.length() - 1); + path.remove(0, 1); } bool ret = true; #ifdef Q_OS_WIN @@ -129,7 +129,7 @@ bool MakefileGenerator::mkdir(const QString &in_path) const if(!QDir::isRelativePath(path)) { if(QFile::exists(path.left(3))) { d.cd(path.left(3)); - path = path.right(path.length() - 3); + path.remove(0, 3); } else { warn_msg(WarnLogic, "Cannot access drive '%s' (%s)", path.left(3).toLatin1().data(), path.toLatin1().data()); @@ -201,13 +201,13 @@ MakefileGenerator::initOutPaths() if(Option::mkfile::do_cache && !Option::mkfile::cachefile.isEmpty() && v.contains("QMAKE_ABSOLUTE_SOURCE_ROOT")) { QString root = v["QMAKE_ABSOLUTE_SOURCE_ROOT"].first(); - root = Option::fixPathToTargetOS(root); + root = QDir::fromNativeSeparators(root); if(!root.isEmpty()) { QFileInfo fi = fileInfo(Option::mkfile::cachefile); if(!fi.makeAbsolute()) { QString cache_r = fi.path(), pwd = Option::output_dir; if(pwd.startsWith(cache_r) && !pwd.startsWith(root)) { - pwd = Option::fixPathToTargetOS(root + pwd.mid(cache_r.length())); + pwd = root + pwd.mid(cache_r.length()); if(exists(pwd)) v.insert("QMAKE_ABSOLUTE_SOURCE_PATH", QStringList(pwd)); } @@ -217,7 +217,7 @@ MakefileGenerator::initOutPaths() } if(!v["QMAKE_ABSOLUTE_SOURCE_PATH"].isEmpty()) { QString &asp = v["QMAKE_ABSOLUTE_SOURCE_PATH"].first(); - asp = Option::fixPathToTargetOS(asp); + asp = QDir::fromNativeSeparators(asp); if(asp.isEmpty() || asp == Option::output_dir) //if they're the same, why bother? v["QMAKE_ABSOLUTE_SOURCE_PATH"].clear(); } @@ -243,7 +243,7 @@ MakefileGenerator::initOutPaths() if(!(dirs[x] == "DLLDESTDIR")) #endif { - if(pathRef.right(Option::dir_sep.length()) != Option::dir_sep) + if(!pathRef.endsWith(Option::dir_sep)) pathRef += Option::dir_sep; } @@ -346,7 +346,7 @@ MakefileGenerator::findFilesInVPATH(QStringList l, uchar flags, const QString &v QString real_dir = Option::fixPathToLocalOS((*vpath_it)); if(exists(real_dir + QDir::separator() + val)) { QString dir = (*vpath_it); - if(dir.right(Option::dir_sep.length()) != Option::dir_sep) + if(!dir.endsWith(Option::dir_sep)) dir += Option::dir_sep; val = dir + val; if(!(flags & VPATH_NoFixify)) @@ -365,7 +365,7 @@ MakefileGenerator::findFilesInVPATH(QStringList l, uchar flags, const QString &v real_dir = dir; if(!(flags & VPATH_NoFixify)) real_dir = fileFixify(real_dir, qmake_getpwd(), Option::output_dir); - regex = regex.right(regex.length() - dir.length()); + regex.remove(0, dir.length()); } if(real_dir.isEmpty() || exists(real_dir)) { QStringList files = QDir(real_dir).entryList(QStringList(regex)); @@ -725,14 +725,14 @@ MakefileGenerator::init() if(project->isActiveConfig("qmake_cache")) { QString cache_file; if(!project->isEmpty("QMAKE_INTERNAL_CACHE_FILE")) { - cache_file = Option::fixPathToLocalOS(project->first("QMAKE_INTERNAL_CACHE_FILE")); + cache_file = QDir::fromNativeSeparators(project->first("QMAKE_INTERNAL_CACHE_FILE")); } else { cache_file = ".qmake.internal.cache"; if(project->isActiveConfig("build_pass")) cache_file += ".BUILD." + project->first("BUILD_PASS"); } - if(cache_file.indexOf(QDir::separator()) == -1) - cache_file.prepend(Option::output_dir + QDir::separator()); + if(cache_file.indexOf('/') == -1) + cache_file.prepend(Option::output_dir + '/'); QMakeSourceFileInfo::setCacheFile(cache_file); } @@ -789,7 +789,7 @@ MakefileGenerator::init() QString dir, regex = Option::fixPathToLocalOS((*dep_it)); if(regex.lastIndexOf(Option::dir_sep) != -1) { dir = regex.left(regex.lastIndexOf(Option::dir_sep) + 1); - regex = regex.right(regex.length() - dir.length()); + regex.remove(0, dir.length()); } QStringList files = QDir(dir).entryList(QStringList(regex)); if(files.isEmpty()) { @@ -939,7 +939,7 @@ MakefileGenerator::writePrlFile(QTextStream &t) QString target = project->first("TARGET"); int slsh = target.lastIndexOf(Option::dir_sep); if(slsh != -1) - target = target.right(target.length() - slsh - 1); + target.remove(0, slsh + 1); QString bdir = Option::output_dir; if(bdir.isEmpty()) bdir = qmake_getpwd(); @@ -1057,11 +1057,11 @@ MakefileGenerator::prlFileName(bool fixify) ret = project->first("TARGET"); int slsh = ret.lastIndexOf(Option::dir_sep); if(slsh != -1) - ret = ret.right(ret.length() - slsh); + ret.remove(0, slsh); if(!ret.endsWith(Option::prl_ext)) { int dot = ret.indexOf('.'); if(dot != -1) - ret = ret.left(dot); + ret.truncate(dot); ret += Option::prl_ext; } if(!project->isEmpty("QMAKE_BUNDLE")) @@ -1211,7 +1211,7 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs, bool n if(project->values((*it) + ".CONFIG").indexOf("no_path") == -1 && project->values((*it) + ".CONFIG").indexOf("dummy_install") == -1) { dst = fileFixify(unescapeFilePath(project->values(pvar).first()), FileFixifyAbsolute, false); - if(dst.right(1) != Option::dir_sep) + if(!dst.endsWith(Option::dir_sep)) dst += Option::dir_sep; } dst = escapeFilePath(dst); @@ -1240,9 +1240,9 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs, bool n int slsh = filestr.lastIndexOf(Option::dir_sep); if(slsh != -1) { dirstr = filestr.left(slsh+1); - filestr = filestr.right(filestr.length() - slsh - 1); + filestr.remove(0, slsh+1); } - if(dirstr.right(Option::dir_sep.length()) != Option::dir_sep) + if(!dirstr.endsWith(Option::dir_sep)) dirstr += Option::dir_sep; if(exists(wild)) { //real file QString file = wild; @@ -1342,7 +1342,7 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs, bool n const QStringList &dirs = project->values(pvar); for(QStringList::ConstIterator pit = dirs.begin(); pit != dirs.end(); ++pit) { QString tmp_dst = fileFixify((*pit), FileFixifyAbsolute, false); - if (!isWindowsShell() && tmp_dst.right(1) != Option::dir_sep) + if (!isWindowsShell() && !tmp_dst.endsWith(Option::dir_sep)) tmp_dst += Option::dir_sep; t << mkdir_p_asstring(filePrefixRoot(root, tmp_dst)) << "\n\t"; } @@ -2174,8 +2174,6 @@ QString MakefileGenerator::buildArgs(const QString &outdir) ret += " -unix"; else if(Option::target_mode == Option::TARG_WIN_MODE) ret += " -win32"; - else if(Option::target_mode == Option::TARG_QNX6_MODE) - ret += " -qnx6"; //configs for(QStringList::Iterator it = Option::user_configs.begin(); @@ -2277,8 +2275,8 @@ MakefileGenerator::findSubDirsSubTargets() const st->profile = file.section(Option::dir_sep, -1) + Option::pro_ext; st->in_directory = file; } - while(st->in_directory.right(1) == Option::dir_sep) - st->in_directory = st->in_directory.left(st->in_directory.length() - 1); + while(st->in_directory.endsWith(Option::dir_sep)) + st->in_directory.chop(1); if(fileInfo(st->in_directory).isRelative()) st->out_directory = st->in_directory; else @@ -2358,7 +2356,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT if (!(flags & SubTargetSkipDefaultVariables)) { QString ofile = Option::fixPathToTargetOS(Option::output.fileName()); if(ofile.lastIndexOf(Option::dir_sep) != -1) - ofile = ofile.right(ofile.length() - ofile.lastIndexOf(Option::dir_sep) -1); + ofile.remove(0, ofile.lastIndexOf(Option::dir_sep) +1); t << "MAKEFILE = " << ofile << endl; /* Calling Option::fixPathToTargetOS() is necessary for MinGW/MSYS, which requires * back-slashes to be turned into slashes. */ @@ -2802,11 +2800,13 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q return cacheVal; //do the fixin' - const QString pwd = qmake_getpwd() + "/"; + QString pwd = qmake_getpwd(); + if (!pwd.endsWith('/')) + pwd += '/'; QString orig_file = ret; if(ret.startsWith(QLatin1Char('~'))) { if(ret.startsWith(QLatin1String("~/"))) - ret = QDir::homePath() + Option::dir_sep + ret.mid(1); + ret = QDir::homePath() + ret.mid(1); else warn_msg(WarnLogic, "Unable to expand ~ in %s", ret.toLatin1().constData()); } @@ -2895,13 +2895,13 @@ MakefileGenerator::checkMultipleDefinition(const QString &f, const QString &w) QString file = f; int slsh = f.lastIndexOf(Option::dir_sep); if(slsh != -1) - file = file.right(file.length() - slsh - 1); + file.remove(0, slsh + 1); QStringList &l = project->values(w); for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { QString file2((*val_it)); slsh = file2.lastIndexOf(Option::dir_sep); if(slsh != -1) - file2 = file2.right(file2.length() - slsh - 1); + file2.remove(0, slsh + 1); if(file2 == file) { warn_msg(WarnLogic, "Found potential symbol conflict of %s (%s) in %s", file.toLatin1().constData(), (*val_it).toLatin1().constData(), w.toLatin1().constData()); @@ -3055,7 +3055,7 @@ MakefileGenerator::openOutput(QFile &file, const QString &build) const file.setFileName(Option::output_dir + "/" + file.fileName()); //pwd when qmake was run QFileInfo fi(fileInfo(file.fileName())); if(fi.isDir()) - outdir = file.fileName() + QDir::separator(); + outdir = file.fileName() + '/'; } if(!outdir.isEmpty() || file.fileName().isEmpty()) { QString fname = "Makefile"; @@ -3075,7 +3075,7 @@ MakefileGenerator::openOutput(QFile &file, const QString &build) const file.setFileName(file.fileName() + "." + build); if(project->isEmpty("QMAKE_MAKEFILE")) project->values("QMAKE_MAKEFILE").append(file.fileName()); - int slsh = file.fileName().lastIndexOf(Option::dir_sep); + int slsh = file.fileName().lastIndexOf('/'); if(slsh != -1) mkdir(file.fileName().left(slsh)); if(file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { @@ -3085,9 +3085,13 @@ MakefileGenerator::openOutput(QFile &file, const QString &build) const od = fileInfo(fi.readLink()).absolutePath(); else od = fi.path(); - od = Option::fixPathToTargetOS(od); - if(QDir::isRelativePath(od)) - od.prepend(Option::output_dir); + od = QDir::fromNativeSeparators(od); + if(QDir::isRelativePath(od)) { + QString dir = Option::output_dir; + if (!dir.endsWith('/') && !od.isEmpty()) + dir += '/'; + od.prepend(dir); + } Option::output_dir = od; return true; } diff --git a/qmake/generators/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp index 34a5322..d907394 100644 --- a/qmake/generators/makefiledeps.cpp +++ b/qmake/generators/makefiledeps.cpp @@ -378,17 +378,19 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file) files_changed = true; file->dep_checked = true; + const QMakeLocalFileName sourceFile = fixPathForFile(file->file, true); + struct stat fst; char *buffer = 0; int buffer_len = 0; { int fd; #if defined(_MSC_VER) && _MSC_VER >= 1400 - if (_sopen_s(&fd, fixPathForFile(file->file, true).local().toLatin1().constData(), + if (_sopen_s(&fd, sourceFile.local().toLatin1().constData(), _O_RDONLY, _SH_DENYNO, _S_IREAD) != 0) fd = -1; #else - fd = open(fixPathForFile(file->file, true).local().toLatin1().constData(), O_RDONLY); + fd = open(sourceFile.local().toLatin1().constData(), O_RDONLY); #endif if(fd == -1 || fstat(fd, &fst) || S_ISDIR(fst.st_mode)) return false; @@ -623,12 +625,8 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file) QMakeLocalFileName lfn(inc); if(QDir::isRelativePath(lfn.real())) { if(try_local) { - QString dir = findFileInfo(file->file).path(); - if(QDir::isRelativePath(dir)) - dir.prepend(qmake_getpwd() + "/"); - if(!dir.endsWith("/")) - dir += "/"; - QMakeLocalFileName f(dir + lfn.local()); + QDir sourceDir = findFileInfo(sourceFile).dir(); + QMakeLocalFileName f(sourceDir.absoluteFilePath(lfn.local())); if(findFileInfo(f).exists()) { lfn = fixPathForFile(f); exists = true; diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index 0b8fa17..4a9fd8d 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -294,9 +294,9 @@ SubdirsMetaMakefileGenerator::init() init_flag = true; if(Option::recursive) { - QString old_output_dir = QDir::cleanPath(Option::output_dir); + QString old_output_dir = Option::output_dir; QString old_output = Option::output.fileName(); - QString oldpwd = QDir::cleanPath(qmake_getpwd()); + QString oldpwd = qmake_getpwd(); QString thispwd = oldpwd; if(!thispwd.endsWith('/')) thispwd += '/'; @@ -452,18 +452,17 @@ QStringList SymbianSubdirsMetaMakefileGenerator::getDependencyList(QString mmpFi QStringList list; QList<QString> values = mmpDependency.values(mmpFilename); - if(recursionDepth < 0) { + if (recursionDepth < 0) { // special case; just first dependency level list = values; return list; } - if(values.size() == 0) { + if (values.size() == 0) { //reached recursion END condition - if(recursionDepth == 0) { + if (recursionDepth == 0) { --recursionDepth; return list; // empty list // no dependencies / return - } - else { + } else { list.append(mmpFilename); recursionDepth--; return list; // leaf // return @@ -473,13 +472,13 @@ QStringList SymbianSubdirsMetaMakefileGenerator::getDependencyList(QString mmpFi for (int i = 0; i < values.size(); ++i) { QString current = values.at(i); QStringList tailList = getDependencyList(current, recursionDepth); - for(int j = 0; j < tailList.size(); ++j) { - QString path = tailList.at(j); - list.append(path); + for (int j = 0; j < tailList.size(); ++j) { + QString path = tailList.at(j); + list.append(path); } } - if(recursionDepth > 0) { + if (recursionDepth > 0) { //for mmp somewhere in middle list.append(mmpFilename); } @@ -510,7 +509,7 @@ QString SymbianSubdirsMetaMakefileGenerator::cleanFromSpecialCharacters(QString& bool SymbianSubdirsMetaMakefileGenerator::init() { - if(init_flag) + if (init_flag) return false; init_flag = true; @@ -519,54 +518,53 @@ bool SymbianSubdirsMetaMakefileGenerator::init() Option::recursive = true; - if(Option::recursive) { + if (Option::recursive) { QString old_output_dir = QDir::cleanPath(Option::output_dir); - if(!old_output_dir.endsWith('/')) - old_output_dir += '/'; - QString old_output = Option::output.fileName(); + if (!old_output_dir.endsWith('/')) + old_output_dir += '/'; + QString old_output = Option::output.fileName(); QString oldpwd = QDir::cleanPath(qmake_getpwd()); - if(!oldpwd.endsWith('/')) - oldpwd += '/'; + if (!oldpwd.endsWith('/')) + oldpwd += '/'; // find the parent mmp filename int end = oldpwd.size() - 1; int start = oldpwd.lastIndexOf("/", end - 2); QString parentMmpFilename = oldpwd.mid(start + 1, end - start - 1); parentMmpFilename.prepend(oldpwd); - parentMmpFilename = parentMmpFilename.append(".mmp"); + parentMmpFilename = parentMmpFilename.append(Option::mmp_ext); const QStringList &subdirs = project->values("SUBDIRS"); static int recurseDepth = -1; ++recurseDepth; - for(int i = 0; i < subdirs.size(); ++i) { + for (int i = 0; i < subdirs.size(); ++i) { Subdir *sub = new Subdir; sub->indent = recurseDepth; QFileInfo subdir(subdirs.at(i)); // childMmpFielname should be derived from subdirName QString subdirName = subdirs.at(i); - if(!project->isEmpty(subdirs.at(i) + ".file")) + if (!project->isEmpty(subdirs.at(i) + ".file")) subdir = project->first(subdirs.at(i) + ".file"); - else if(!project->isEmpty(subdirs.at(i) + ".subdir")) + else if (!project->isEmpty(subdirs.at(i) + ".subdir")) subdir = project->first(subdirs.at(i) + ".subdir"); QString sub_name; QString childMmpFilename; - if(subdir.isDir()) { + if (subdir.isDir()) { subdir = QFileInfo(subdir.filePath() + "/" + subdir.fileName() + Option::pro_ext); childMmpFilename = subdir.fileName(); childMmpFilename = subdir.absoluteFilePath(); childMmpFilename.replace(Option::pro_ext, QString("")); - childMmpFilename.append(".mmp"); - } - else { + childMmpFilename.append(Option::mmp_ext); + } else { childMmpFilename = subdir.absoluteFilePath(); - childMmpFilename.replace(QString(".pro"), QString(".mmp")); + childMmpFilename.replace(Option::pro_ext, Option::mmp_ext); sub_name = childMmpFilename; - sub_name.replace(QString(".mmp"), QString("")); + sub_name.replace(Option::mmp_ext, QString("")); sub_name.replace(0, sub_name.lastIndexOf("/") + 1, QString("")); project->values("SHADOW_BLD_INFS").append(QString("bld.inf.") + sub_name); } @@ -576,7 +574,7 @@ bool SymbianSubdirsMetaMakefileGenerator::init() for (int ind = 0; ind < sub->indent; ++ind) printf(" "); sub->input_dir = subdir.absolutePath(); - if(subdir.isRelative() && old_output_dir != oldpwd) { + if (subdir.isRelative() && old_output_dir != oldpwd) { sub->output_dir = old_output_dir + "/" + subdir.path(); printf("Reading %s [%s]\n", subdir.absoluteFilePath().toLatin1().constData(), sub->output_dir.toLatin1().constData()); } else { @@ -590,10 +588,10 @@ bool SymbianSubdirsMetaMakefileGenerator::init() QString newpwd = qmake_getpwd(); Option::output_dir = sub->output_dir; - if(Option::output_dir.at(Option::output_dir.length()-1) != QLatin1Char('/')) + if (Option::output_dir.at(Option::output_dir.length() - 1) != QLatin1Char('/')) Option::output_dir += QLatin1Char('/'); sub_proj->read(subdir.fileName()); - if(!sub_proj->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { + if (!sub_proj->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { fprintf(stderr, "Project file(%s) not recursed because all requirements not met:\n\t%s\n", subdir.fileName().toLatin1().constData(), sub_proj->values("QMAKE_FAILED_REQUIREMENTS").join(" ").toLatin1().constData()); @@ -608,7 +606,7 @@ bool SymbianSubdirsMetaMakefileGenerator::init() mmpDependency.insert(parentMmpFilename, childMmpFilename); sub->makefile = MetaMakefileGenerator::createMetaGenerator(sub_proj, sub_name); - if(0 && sub->makefile->type() == SUBDIRSMETATYPE) { + if (0 && sub->makefile->type() == SUBDIRSMETATYPE) { subs.append(sub); } else { const QString output_name = Option::output.fileName(); @@ -626,7 +624,7 @@ bool SymbianSubdirsMetaMakefileGenerator::init() } --recurseDepth; - Option::output.setFileName(old_output); + Option::output.setFileName(old_output); Option::output_dir = old_output_dir; qmake_setpwd(oldpwd); } @@ -637,27 +635,27 @@ bool SymbianSubdirsMetaMakefileGenerator::init() // To fully expand find all dependencies: // Do as recursion, then insert result as subdirs data in project QString newpwd = qmake_getpwd(); - if(!newpwd.endsWith('/')) + if (!newpwd.endsWith('/')) newpwd += '/'; int end = newpwd.size() - 1; int start = newpwd.lastIndexOf("/", end - 2); QString mmpFilename = newpwd.mid(start + 1, end - start - 1); mmpFilename.prepend(newpwd); - mmpFilename = mmpFilename.append(".mmp"); + mmpFilename = mmpFilename.append(Option::mmp_ext); // map mmpfile to its absolute filepath mmpPaths.insert(mmpFilename, newpwd); QStringList directDependencyList = getDependencyList(mmpFilename, -1); - for(int i = 0; i < directDependencyList.size(); ++i) { + for (int i = 0; i < directDependencyList.size(); ++i) { project->values("MMPFILES_DIRECT_DEPENDS").append(directDependencyList.at(i)); } QStringList dependencyList = getDependencyList(mmpFilename, 0); self->output_dir = Option::output_dir; - if(!Option::recursive || (!Option::output.fileName().endsWith(Option::dir_sep) && !QFileInfo(Option::output).isDir())) - self->output_file = Option::output.fileName(); + if (!Option::recursive || (!Option::output.fileName().endsWith(Option::dir_sep) && !QFileInfo(Option::output).isDir())) + self->output_file = Option::output.fileName(); self->makefile = new BuildsMetaMakefileGenerator(project, name, false); self->makefile->init(); subs.append(self); @@ -665,17 +663,18 @@ bool SymbianSubdirsMetaMakefileGenerator::init() return true; } -QStringList SymbianSubdirsMetaMakefileGenerator::calculateRelativePaths(QString mmpParent, QStringList mmpChildren) { +QStringList SymbianSubdirsMetaMakefileGenerator::calculateRelativePaths(QString mmpParent, QStringList mmpChildren) +{ QStringList mmpRelativePaths; QString parentDir = mmpPaths.value(mmpParent); QDir directory(parentDir); - for(int i = 0; i < mmpChildren.size(); ++i) { + for (int i = 0; i < mmpChildren.size(); ++i) { QString childDir = mmpPaths.value(mmpChildren.at(i)); - if(mmpChildren.at(i) == mmpParent) + if (mmpChildren.at(i) == mmpParent) mmpRelativePaths.append(mmpChildren.at(i)); else { QString relativePath = directory.relativeFilePath(childDir); - if(relativePath.startsWith("..")) + if (relativePath.startsWith("..")) mmpRelativePaths.append(childDir); else directory.relativeFilePath(relativePath); @@ -750,15 +749,15 @@ MetaMakefileGenerator * MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &name, bool op) { MetaMakefileGenerator *ret = 0; - if((Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || - Option::qmake_mode == Option::QMAKE_GENERATE_PRL)) { - if(proj->first("MAKEFILE_GENERATOR").startsWith("SYMBIAN") && proj->values("TEMPLATE").contains("subdirs")) { + if ((Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || + Option::qmake_mode == Option::QMAKE_GENERATE_PRL)) { + if (proj->first("MAKEFILE_GENERATOR").startsWith("SYMBIAN") && proj->values("TEMPLATE").contains("subdirs")) { // new metamakefilegenerator type to support subdirs for symbian related projects ret = new SymbianSubdirsMetaMakefileGenerator(proj, name, op); } else if (proj->first("TEMPLATE").endsWith("subdirs")) ret = new SubdirsMetaMakefileGenerator(proj, name, op); } - if(!ret) + if (!ret) ret = new BuildsMetaMakefileGenerator(proj, name, op); ret->init(); return ret; diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.cpp b/qmake/generators/symbian/initprojectdeploy_symbian.cpp index 8e3e20b..392eca2 100644 --- a/qmake/generators/symbian/initprojectdeploy_symbian.cpp +++ b/qmake/generators/symbian/initprojectdeploy_symbian.cpp @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the qmake application of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -45,15 +45,20 @@ #include <qdebug.h> #define PLUGIN_STUB_DIR "qmakepluginstubs" +#define SYSBIN_DIR "\\sys\\bin" + +#define SUFFIX_DLL "dll" +#define SUFFIX_EXE "exe" +#define SUFFIX_QTPLUGIN "qtplugin" static bool isPlugin(const QFileInfo& info, const QString& devicePath) { // Libraries are plugins if deployment path is something else than - // \\sys\\bin or x:\\sys\\bin - if (0 == info.suffix().compare(QLatin1String("dll")) && - (devicePath.size() < 8 || - (0 != devicePath.compare(QLatin1String("\\sys\\bin")) && - 0 != devicePath.mid(1).compare(QLatin1String(":\\sys\\bin"))))) { + // SYSBIN_DIR with or without drive letter + if (0 == info.suffix().compare(QLatin1String(SUFFIX_DLL), Qt::CaseInsensitive) && + (devicePath.size() < 8 || + (0 != devicePath.compare(QLatin1String(SYSBIN_DIR), Qt::CaseInsensitive) && + 0 != devicePath.mid(1).compare(QLatin1String(":" SYSBIN_DIR), Qt::CaseInsensitive)))) { return true; } else { return false; @@ -62,8 +67,8 @@ static bool isPlugin(const QFileInfo& info, const QString& devicePath) static bool isBinary(const QFileInfo& info) { - if (0 == info.suffix().compare(QLatin1String("dll")) || - 0 == info.suffix().compare(QLatin1String("exe"))) { + if (0 == info.suffix().compare(QLatin1String(SUFFIX_DLL), Qt::CaseInsensitive) || + 0 == info.suffix().compare(QLatin1String(SUFFIX_EXE), Qt::CaseInsensitive)) { return true; } else { return false; @@ -74,27 +79,28 @@ static void createPluginStub(const QFileInfo& info, const QString& devicePath, DeploymentList &deploymentList, QStringList& generatedDirs, - QStringList& generatedFiles) { + QStringList& generatedFiles) +{ QDir().mkpath(QLatin1String(PLUGIN_STUB_DIR "\\")); if (!generatedDirs.contains(PLUGIN_STUB_DIR)) generatedDirs << PLUGIN_STUB_DIR; // Plugin stubs must have different name from the actual plugins, because // the toolchain for creating ROM images cannot handle non-binary .dll files properly. - QFile stubFile(QLatin1String(PLUGIN_STUB_DIR "\\") + info.completeBaseName() + ".qtplugin"); - if(stubFile.open(QIODevice::WriteOnly)) { + QFile stubFile(QLatin1String(PLUGIN_STUB_DIR "\\") + info.completeBaseName() + "." SUFFIX_QTPLUGIN); + if (stubFile.open(QIODevice::WriteOnly)) { if (!generatedFiles.contains(stubFile.fileName())) generatedFiles << stubFile.fileName(); QTextStream t(&stubFile); // Add note to stub so that people will not wonder what it is. // Creation date is added to make new stub to deploy always to // force plugin cache miss when loading plugins. - t << "This file is a Qt plugin stub file. The real Qt plugin is located in \\sys\\bin. Created:" << QDateTime::currentDateTime().toString(Qt::ISODate) << "\n"; + t << "This file is a Qt plugin stub file. The real Qt plugin is located in " SYSBIN_DIR ". Created:" << QDateTime::currentDateTime().toString(Qt::ISODate) << "\n"; } else { fprintf(stderr, "cannot deploy \"%s\" because of plugin stub file creation failed\n", info.fileName().toLatin1().constData()); } QFileInfo stubInfo(stubFile); deploymentList.append(CopyItem(Option::fixPathToLocalOS(stubInfo.absoluteFilePath()), - Option::fixPathToLocalOS(devicePath + "\\" + stubInfo.fileName()))); + Option::fixPathToLocalOS(devicePath + "\\" + stubInfo.fileName()))); } void initProjectDeploySymbian(QMakeProject* project, @@ -110,7 +116,7 @@ void initProjectDeploySymbian(QMakeProject* project, if (targetPath.isEmpty()) targetPath = testPath; if (targetPath.endsWith("/") || targetPath.endsWith("\\")) - targetPath = targetPath.mid(0,targetPath.size()-1); + targetPath = targetPath.mid(0, targetPath.size() - 1); bool targetPathHasDriveLetter = false; if (targetPath.size() > 1) { @@ -121,9 +127,9 @@ void initProjectDeploySymbian(QMakeProject* project, foreach(QString item, project->values("DEPLOYMENT")) { QString devicePath = project->first(item + ".path"); if (!deployBinaries - && !devicePath.isEmpty() - && (0 == devicePath.compare(project->values("APP_RESOURCE_DIR").join("")) - || 0 == devicePath.compare(project->values("REG_RESOURCE_IMPORT_DIR").join("")))) { + && !devicePath.isEmpty() + && (0 == devicePath.compare(project->values("APP_RESOURCE_DIR").join(""), Qt::CaseInsensitive) + || 0 == devicePath.compare(project->values("REG_RESOURCE_IMPORT_DIR").join(""), Qt::CaseInsensitive))) { // Do not deploy resources in emulator builds, as that seems to cause conflicts // If there is ever a real need to deploy pre-built resources for emulator, // BLD_INF_RULES.prj_exports can be used as a workaround. @@ -140,14 +146,14 @@ void initProjectDeploySymbian(QMakeProject* project, } // check if item.path is relative (! either / or \) else if (!(devicePath.at(0) == QLatin1Char('/') - || devicePath.at(0) == QLatin1Char('\\') - || devicePathHasDriveLetter)) { + || devicePath.at(0) == QLatin1Char('\\') + || devicePathHasDriveLetter)) { // create output path devicePath = Option::fixPathToLocalOS(QDir::cleanPath(targetPath + QLatin1Char('\\') + devicePath)); } else { - if (0 == platform.compare(QLatin1String("winscw"))) { + if (0 == platform.compare(QLatin1String("winscw"), Qt::CaseInsensitive)) { if (devicePathHasDriveLetter) { - devicePath = epocRoot() + "epoc32\\winscw\\" + devicePath.remove(1,1); + devicePath = epocRoot() + "epoc32\\winscw\\" + devicePath.remove(1, 1); } else { devicePath = epocRoot() + "epoc32\\winscw\\c" + devicePath; } @@ -162,13 +168,13 @@ void initProjectDeploySymbian(QMakeProject* project, devicePath.replace(QLatin1String("/"), QLatin1String("\\")); if (!deployBinaries && - 0 == devicePath.right(8).compare(QLatin1String("\\sys\\bin"))) { - // Skip deploying to \\sys\\bin for anything but binary deployments - // Note: Deploying pre-built binaries also follow this rule, so emulator builds - // will not get those deployed. Since there is no way to differentiate currently - // between pre-built binaries for emulator and HW anyway, this is not a major issue. - continue; - } + 0 == devicePath.right(8).compare(QLatin1String(SYSBIN_DIR), Qt::CaseInsensitive)) { + // Skip deploying to SYSBIN_DIR for anything but binary deployments + // Note: Deploying pre-built binaries also follow this rule, so emulator builds + // will not get those deployed. Since there is no way to differentiate currently + // between pre-built binaries for emulator and HW anyway, this is not a major issue. + continue; + } foreach(QString source, project->values(item + ".sources")) { source = Option::fixPathToLocalOS(source); @@ -193,7 +199,7 @@ void initProjectDeploySymbian(QMakeProject* project, // Executables and libraries are deployed to \sys\bin QFileInfo releasePath(epocRoot() + "epoc32\\release\\" + platform + "\\" + build + "\\"); deploymentList.append(CopyItem(Option::fixPathToLocalOS(releasePath.absolutePath() + "\\" + info.fileName()), - Option::fixPathToLocalOS(deploymentDrive + QLatin1String("\\sys\\bin\\") + info.fileName()))); + Option::fixPathToLocalOS(deploymentDrive + QLatin1String(SYSBIN_DIR "\\") + info.fileName()))); } if (isPlugin(info, devicePath)) { createPluginStub(info, devicePath, deploymentList, generatedDirs, generatedFiles); @@ -203,7 +209,7 @@ void initProjectDeploySymbian(QMakeProject* project, // Generate deployment even if file doesn't exist, as this may be the case // when generating .pkg files. deploymentList.append(CopyItem(Option::fixPathToLocalOS(info.absoluteFilePath()), - Option::fixPathToLocalOS(devicePath + "\\" + info.fileName()))); + Option::fixPathToLocalOS(devicePath + "\\" + info.fileName()))); continue; } } @@ -212,9 +218,9 @@ void initProjectDeploySymbian(QMakeProject* project, int pathSize = info.absolutePath().size(); QDirIterator iterator(searchPath, QStringList() << nameFilter , QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks - , dirSearch ? QDirIterator::Subdirectories : QDirIterator::NoIteratorFlags ); + , dirSearch ? QDirIterator::Subdirectories : QDirIterator::NoIteratorFlags); - while(iterator.hasNext()) { + while (iterator.hasNext()) { iterator.next(); QFileInfo iteratorInfo(iterator.filePath()); QString absoluteItemPath = Option::fixPathToLocalOS(iteratorInfo.absolutePath()); @@ -223,16 +229,16 @@ void initProjectDeploySymbian(QMakeProject* project, if (!iteratorInfo.isDir()) { if (isPlugin(iterator.fileInfo(), devicePath)) { // This deploys pre-built plugins. Other pre-built binaries will deploy normally, - // as they have \sys\bin target path. + // as they have SYSBIN_DIR target path. if (deployBinaries) { deploymentList.append(CopyItem(Option::fixPathToLocalOS(absoluteItemPath + "\\" + iterator.fileName()), - Option::fixPathToLocalOS(deploymentDrive + QLatin1String("\\sys\\bin\\") + iterator.fileName()))); + Option::fixPathToLocalOS(deploymentDrive + QLatin1String(SYSBIN_DIR "\\") + iterator.fileName()))); } createPluginStub(info, devicePath + "\\" + absoluteItemPath.right(diffSize), deploymentList, generatedDirs, generatedFiles); continue; } else { deploymentList.append(CopyItem(Option::fixPathToLocalOS(absoluteItemPath + "\\" + iterator.fileName()), - Option::fixPathToLocalOS(devicePath + "\\" + absoluteItemPath.right(diffSize) + "\\" + iterator.fileName()))); + Option::fixPathToLocalOS(devicePath + "\\" + absoluteItemPath.right(diffSize) + "\\" + iterator.fileName()))); } } } diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.h b/qmake/generators/symbian/initprojectdeploy_symbian.h index 0aad431..a104985 100644 --- a/qmake/generators/symbian/initprojectdeploy_symbian.h +++ b/qmake/generators/symbian/initprojectdeploy_symbian.h @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the qmake application of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -66,4 +66,5 @@ extern void initProjectDeploySymbian(QMakeProject* project, const QString &build, QStringList& generatedDirs, QStringList& generatedFiles); -#endif // INITPROJECTDEPLOYSYMBIAN_H
\ No newline at end of file + +#endif // INITPROJECTDEPLOYSYMBIAN_H diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index 1f22c70..b3fa0f2 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the qmake application of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -62,24 +62,17 @@ #define BLD_INF_TAG_MMPFILES "prj_mmpfiles" #define BLD_INF_TAG_TESTMMPFILES "prj_testmmpfiles" #define BLD_INF_TAG_EXTENSIONS "prj_extensions" + #define RSS_RULES "RSS_RULES" #define RSS_RULES_BASE "RSS_RULES." #define RSS_TAG_NBROFICONS "number_of_icons" #define RSS_TAG_ICONFILE "icon_file" -#define DUMP_VAR(v) \ -{ \ - QString s(v); \ - QStringList list = project->values(s); \ - printf("----------------------------------\n", qPrintable(s)); \ - printf("Dumping %s (%d items) from %s, %d\n", \ - qPrintable(s), \ - list.count(), \ - __FILE__, \ - __LINE__); \ - foreach(QString l, list) \ - printf("\t%s\n", qPrintable(l)); \ -} +#define MMP_TARGET "TARGET" +#define MMP_TARGETTYPE "TARGETTYPE" +#define MMP_SECUREID "SECUREID" + +#define PRINT_FILE_CREATE_ERROR(filename) fprintf(stderr, "Error: Could not create '%s'\n", qPrintable(filename)); QString SymbianMakefileGenerator::fixPathForMmp(const QString& origPath, const QDir& parentDir) { @@ -129,7 +122,7 @@ QString SymbianMakefileGenerator::canonizePath(const QString& origPath) resultPath = QDir::fromNativeSeparators(epocRoot()) + resultPath.mid(1); QFileInfo fi(fileInfo(resultPath)); - if(fi.isDir()) { + if (fi.isDir()) { resultPath = fi.canonicalFilePath(); } else { resultPath = fi.canonicalPath(); @@ -163,7 +156,7 @@ void SymbianMakefileGenerator::writeHeader(QTextStream &t) QString shortProFilename = project->projectFile(); shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString("")); - shortProFilename.replace(QString(".pro"), QString("")); + shortProFilename.replace(Option::pro_ext, QString("")); QString bldinfDefine = shortProFilename; bldinfDefine.append("_"); @@ -189,7 +182,7 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) // Generate pkg files if there are any actual files to deploy bool generatePkg = false; - if (getTargetExtension() == "exe") { + if (targetType == TypeExe) { generatePkg = true; } else { foreach(QString item, project->values("DEPLOYMENT")) { @@ -203,7 +196,7 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) if (generatePkg) { QStringList platformList = project->values("SYMBIAN_PLATFORMS"); foreach(QString platform, platformList) { - if(platform.compare("WINSCW", Qt::CaseInsensitive)) { + if (platform.compare("WINSCW", Qt::CaseInsensitive)) { generatePkgFile(platform.toLower(), "udeb", iconFile); generatePkgFile(platform.toLower(), "urel", iconFile); } @@ -223,41 +216,39 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) } QFile wrapperMakefile(wrapperFileName); - if(wrapperMakefile.open(QIODevice::WriteOnly)) { + if (wrapperMakefile.open(QIODevice::WriteOnly)) { generatedFiles << wrapperFileName; } else { - fprintf(stderr, "Error: Could not open wrapper makefile '%s'\n", qPrintable(wrapperFileName)); + PRINT_FILE_CREATE_ERROR(wrapperFileName); return false; } - if (getTargetExtension() == "subdirs") { - // If we have something to deploy, generate extension makefile for just that, since - // normal extension makefile is not getting generated and we need emulator deployment to be done. - if (generatePkg) - writeMkFile(wrapperFileName, true); - writeWrapperMakefile(wrapperMakefile, isPrimaryMakefile); - return true; - } + if (targetType == TypeSubdirs) { + // If we have something to deploy, generate extension makefile for just that, since + // normal extension makefile is not getting generated and we need emulator deployment to be done. + if (generatePkg) + writeMkFile(wrapperFileName, true); + writeWrapperMakefile(wrapperMakefile, isPrimaryMakefile); + return true; + } writeMkFile(wrapperFileName, false); QString shortProFilename = project->projectFile(); shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString("")); - shortProFilename.replace(QString(".pro"), QString("")); + shortProFilename.replace(Option::pro_ext, QString("")); QString mmpFilename = shortProFilename; mmpFilename.append("_"); mmpFilename.append(uid3); - mmpFilename.append(".mmp"); + mmpFilename.append(Option::mmp_ext); writeMmpFile(mmpFilename, symbianLangCodes); - if (getTargetExtension() == "exe") { + if (targetType == TypeExe) { if (!project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { - QString appname = escapeFilePath(fileFixify(project->first("TARGET"))); - appname = removePathSeparators(appname); - writeRegRssFile(appname, userRssRules); - writeRssFile(appname, numberOfIcons, iconFile); - writeLocFile(appname, symbianLangCodes); + writeRegRssFile(fixedTarget, userRssRules); + writeRssFile(fixedTarget, numberOfIcons, iconFile); + writeLocFile(fixedTarget, symbianLangCodes); } } @@ -267,17 +258,19 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) return true; } -bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QString &config, const QString &iconFile) +void SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QString &config, const QString &iconFile) { - QString build = ( config == "udeb" ) ? "debug" : "release"; + QString build = (config == "udeb") ? "debug" : "release"; QString pkgFilename = QString("%1_%2-%3.%4") .arg(fileInfo(project->projectFile()).completeBaseName()) .arg(build) .arg(compiler) .arg("pkg"); QFile pkgFile(pkgFilename); - if (!pkgFile.open(QIODevice::WriteOnly | QIODevice::Text)) - return false; + if (!pkgFile.open(QIODevice::WriteOnly | QIODevice::Text)) { + PRINT_FILE_CREATE_ERROR(pkgFilename); + return; + } generatedFiles << pkgFile.fileName(); @@ -294,7 +287,7 @@ bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS QStringList pkgrulesValue = project->values(pkgrulesItem); // If there is no stringlist defined for a rule, use rule name directly // This is convenience for defining single line mmp statements - if (pkgrulesValue.isEmpty()){ + if (pkgrulesValue.isEmpty()) { rawPkgPreRules << pkgrulesItem; } else { foreach(QString pkgrule, pkgrulesValue) { @@ -306,41 +299,38 @@ bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS // Apply some defaults if specific data does not exist in PKG pre-rules - if(!containsStartWithItem('&', rawPkgPreRules)) { + if (!containsStartWithItem('&', rawPkgPreRules)) { // language, (*** hardcoded to english atm, should be parsed from TRANSLATIONS) t << "; Language" << endl; t << "&EN" << endl << endl; } else { // In case user defines langs, he must take care also about SIS header - if(!containsStartWithItem('#', rawPkgPreRules)) + if (!containsStartWithItem('#', rawPkgPreRules)) fprintf(stderr, "Warning: If language is defined with DEPLOYMENT pkg_prerules, also the SIS header must be defined\n"); } // name of application, UID and version - QString applicationName = project->first("TARGET"); - int last = applicationName.lastIndexOf(QLatin1Char('/')); - applicationName = applicationName.mid( last == -1 ? 0 : last+1 ); QString applicationVersion = project->first("VERSION").isEmpty() ? "1,0,0" : project->first("VERSION").replace('.', ','); - if(!containsStartWithItem('#', rawPkgPreRules)) { + if (!containsStartWithItem('#', rawPkgPreRules)) { t << "; SIS header: name, uid, version" << endl; - t << QString("#{\"%1\"},(%2),%3").arg(applicationName).arg(uid3).arg(applicationVersion) << endl << endl; + t << QString("#{\"%1\"},(%2),%3").arg(fixedTarget).arg(uid3).arg(applicationVersion) << endl << endl; } // Localized vendor name - if(!containsStartWithItem('%', rawPkgPreRules)) { + if (!containsStartWithItem('%', rawPkgPreRules)) { t << "; Localised Vendor name" << endl; t << "%{\"Vendor\"}" << endl << endl; } // Unique vendor name - if(!containsStartWithItem(':', rawPkgPreRules)) { + if (!containsStartWithItem(':', rawPkgPreRules)) { t << "; Unique Vendor name" << endl; t << ":\"Vendor\"" << endl << endl; } // PKG pre-rules - these are added before actual file installations i.e. SISX package body - if(rawPkgPreRules.size()) { + if (rawPkgPreRules.size()) { t << "; Manual PKG pre-rules from PRO files" << endl; foreach(QString item, rawPkgPreRules) { t << item << endl; @@ -360,10 +350,10 @@ bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS .arg(config); - if (getTargetExtension() == "exe") { + if (targetType == TypeExe) { // deploy .exe file t << "; Executable and default resource files" << endl; - QString exeFile = applicationName + ".exe"; + QString exeFile = fixedTarget + ".exe"; t << QString("\"%1/%2\" - \"%3\\%4\"") .arg(epocReleasePath) .arg(exeFile) @@ -374,24 +364,24 @@ bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS if (!project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { t << QString("\"%1epoc32/data/z/resource/apps/%2\" - \"%3\\%4\"") .arg(epocRoot()) - .arg(applicationName + ".rsc") + .arg(fixedTarget + ".rsc") .arg(installPathResource) - .arg(applicationName + ".rsc") << endl; + .arg(fixedTarget + ".rsc") << endl; t << QString("\"%1epoc32/data/z/private/10003a3f/import/apps/%2\" - \"%3\\%4\"") .arg(epocRoot()) - .arg(applicationName + "_reg.rsc") + .arg(fixedTarget + "_reg.rsc") .arg(installPathRegResource) - .arg(applicationName + "_reg.rsc") << endl; + .arg(fixedTarget + "_reg.rsc") << endl; QString myIconFile = iconFile; myIconFile = myIconFile.replace("\\\\", "\\"); if (!iconFile.isEmpty()) { t << QString("\"%1epoc32/data/z%2\" - \"!:%3\"") - .arg(epocRoot()) - .arg(QString(myIconFile).replace('\\','/')) - .arg(myIconFile) << endl << endl; + .arg(epocRoot()) + .arg(QString(myIconFile).replace('\\','/')) + .arg(myIconFile) << endl << endl; } } } @@ -401,10 +391,10 @@ bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS QString remoteTestPath; remoteTestPath = QString("!:\\private\\%1").arg(privateDirUid); - initProjectDeploySymbian( project, depList, remoteTestPath, true, compiler, config, generatedDirs, generatedFiles ); + initProjectDeploySymbian(project, depList, remoteTestPath, true, compiler, config, generatedDirs, generatedFiles); if (depList.size()) t << "; DEPLOYMENT" << endl; - for (int i=0; i<depList.size(); ++i) { + for (int i = 0; i < depList.size(); ++i) { t << QString("\"%1\" - \"%2\"") .arg(QString(depList.at(i).from).replace('\\','/')) .arg(depList.at(i).to) << endl; @@ -418,7 +408,7 @@ bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS QStringList pkgrulesValue = project->values(pkgrulesItem); // If there is no stringlist defined for a rule, use rule name directly // This is convenience for defining single line statements - if (pkgrulesValue.isEmpty()){ + if (pkgrulesValue.isEmpty()) { t << pkgrulesItem << endl; } else { foreach(QString pkgrule, pkgrulesValue) { @@ -428,29 +418,27 @@ bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS t << endl; } } - - return true; } bool SymbianMakefileGenerator::containsStartWithItem(const QChar &c, const QStringList& src) { - bool result = false; - foreach (QString str, src) { - if (str.startsWith(c)) { - result = true; - break; + bool result = false; + foreach(QString str, src) { + if (str.startsWith(c)) { + result = true; + break; } - } - return result; + } + return result; } -bool SymbianMakefileGenerator::writeCustomDefFile() +void SymbianMakefileGenerator::writeCustomDefFile() { - if(targetType.compare("plugin", Qt::CaseInsensitive) == 0 && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { + if (targetType == TypePlugin && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { // Create custom def file for plugin QFile ft(QLatin1String(PLUGIN_COMMON_DEF_FILE_ACTUAL)); - if(ft.open(QIODevice::WriteOnly)) { + if (ft.open(QIODevice::WriteOnly)) { generatedFiles << ft.fileName(); QTextStream t(&ft); @@ -473,26 +461,24 @@ bool SymbianMakefileGenerator::writeCustomDefFile() t << "\tqt_plugin_instance @ 2 NONAME" << endl; t << endl; } else { - return false; + PRINT_FILE_CREATE_ERROR(QString(PLUGIN_COMMON_DEF_FILE_ACTUAL)) } } - - return true; } void SymbianMakefileGenerator::init() { MakefileGenerator::init(); + fixedTarget = escapeFilePath(fileFixify(project->first("TARGET"))); + fixedTarget = removePathSeparators(fixedTarget); - if(0 != project->values("QMAKE_PLATFORM").size()) + if (0 != project->values("QMAKE_PLATFORM").size()) platform = varGlue("QMAKE_PLATFORM", "", " ", ""); - if(0 == project->values("QMAKESPEC").size()) + if (0 == project->values("QMAKESPEC").size()) project->values("QMAKESPEC").append(qgetenv("QMAKESPEC")); - if(!isConfigSetToSymbian()) - project->values("QMAKE_LIBS") += escapeFilePaths(project->values("LIBS")); - + project->values("QMAKE_LIBS") += escapeFilePaths(project->values("LIBS")); // bld.inf project->values("MAKEFILE") += BLD_INF_FILENAME; @@ -501,40 +487,40 @@ void SymbianMakefileGenerator::init() initMmpVariables(); // Check TARGET.UID2 and TARGET.UID3 presence - if(0 != project->values("TARGET.UID3").size()) { + if (0 != project->values("TARGET.UID3").size()) { uid3 = project->first("TARGET.UID3"); } else { uid3 = generateUID3(); } - if((project->values("TEMPLATE")).contains("app")) - targetType = "exe"; - else if((project->values("TEMPLATE")).contains("lib")) { + if ((project->values("TEMPLATE")).contains("app")) + targetType = TypeExe; + else if ((project->values("TEMPLATE")).contains("lib")) { // Check CONFIG to see if we are to build staticlib or dll - if(project->values("CONFIG").contains("staticlib") || project->values("CONFIG").contains("static")) - targetType = "staticlib"; + if (project->values("CONFIG").contains("staticlib") || project->values("CONFIG").contains("static")) + targetType = TypeLib; else if (project->values("CONFIG").contains("plugin")) - targetType = "plugin"; + targetType = TypePlugin; else - targetType = "dll"; + targetType = TypeDll; + } else { + targetType = TypeSubdirs; } - else - targetType = "subdirs"; - if(0 != project->values("TARGET.UID2").size()) { + if (0 != project->values("TARGET.UID2").size()) { uid2 = project->first("TARGET.UID2"); } else if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { uid2 = "0x20004C45"; } else { - if(getTargetExtension() == "exe") { - if(project->values("QT").contains("gui", Qt::CaseInsensitive)) { + if (targetType == TypeExe) { + if (project->values("QT").contains("gui", Qt::CaseInsensitive)) { // exe and gui -> uid2 needed uid2 = "0x100039CE"; } else { // exe but not gui: uid2 is ignored anyway -> set it to 0 uid2 = "0"; } - } else if(getTargetExtension() == "dll" || getTargetExtension() == "lib") { + } else if (targetType == TypeDll || targetType == TypeLib || targetType == TypePlugin) { uid2 = "0x1000008d"; } } @@ -548,25 +534,25 @@ void SymbianMakefileGenerator::init() uint uidNum = uid3.toUInt(&conversionOk, 0); if (!conversionOk) { - fprintf(stderr, "Error: Invalid UID \"%s\".", uid3.toUtf8().constData()); + fprintf(stderr, "Error: Invalid UID \"%s\".\n", uid3.toUtf8().constData()); } else { privateDirUid.setNum(uidNum, 16); while (privateDirUid.length() < 8) - privateDirUid.insert(0,QLatin1Char('0')); + privateDirUid.insert(0, QLatin1Char('0')); } } QString SymbianMakefileGenerator::getTargetExtension() { QString ret; - if(targetType.compare("exe", Qt::CaseInsensitive) == 0 || targetType.compare("app", Qt::CaseInsensitive) == 0) { + if (targetType == TypeExe) { ret.append("exe"); - } else if (targetType.compare("staticlib",Qt::CaseInsensitive) == 0) { + } else if (targetType == TypeLib) { ret.append("lib"); - } else if (targetType.compare("dll", Qt::CaseInsensitive) == 0 || targetType.compare("plugin", Qt::CaseInsensitive) == 0) { + } else if (targetType == TypeDll || targetType == TypePlugin) { ret.append("dll"); - } else if (targetType.compare("subdirs", Qt::CaseInsensitive) == 0) { - ret.append("subdirs"); + } else if (targetType == TypeSubdirs) { + // Not actually usable, so return empty } else { // If nothing else set, default to exe ret.append("exe"); @@ -575,11 +561,6 @@ QString SymbianMakefileGenerator::getTargetExtension() return ret; } -bool SymbianMakefileGenerator::isConfigSetToSymbian() -{ - return project->values("CONFIG").contains("symbian", Qt::CaseInsensitive); -} - QString SymbianMakefileGenerator::generateUID3() { QString target = project->first("TARGET"); @@ -588,7 +569,7 @@ QString SymbianMakefileGenerator::generateUID3() return generate_test_uid(target); } -bool SymbianMakefileGenerator::initMmpVariables() +void SymbianMakefileGenerator::initMmpVariables() { QStringList sysincspaths; QStringList srcincpaths; @@ -601,12 +582,12 @@ bool SymbianMakefileGenerator::initMmpVariables() QDir current = QDir::current(); QString canonizedCurrent = canonizePath("."); - for(int j = 0; j < srcpaths.size(); ++j) { + for (int j = 0; j < srcpaths.size(); ++j) { QFileInfo fi(fileInfo(srcpaths.at(j))); // Sometimes sources have other than *.c* files (e.g. *.moc); prune them. if (fi.suffix().startsWith("c")) { - if(fi.filePath().length() > fi.fileName().length() ) { - appendIfnotExist(srcincpaths, fi.path() ); + if (fi.filePath().length() > fi.fileName().length()) { + appendIfnotExist(srcincpaths, fi.path()); sources[canonizePath(fi.path())] += fi.fileName(); } else { sources[canonizedCurrent] += fi.fileName(); @@ -624,7 +605,7 @@ bool SymbianMakefileGenerator::initMmpVariables() incpaths << project->values("UI_DIR"); QString epocPath("epoc32"); - for(int j = 0; j < incpaths.size(); ++j) { + for (int j = 0; j < incpaths.size(); ++j) { QString includepath = canonizePath(incpaths.at(j)); appendIfnotExist(sysincspaths, includepath); // As a workaround for Symbian toolchain insistence to treat include @@ -640,18 +621,18 @@ bool SymbianMakefileGenerator::initMmpVariables() // Remove duplicate include path entries QStringList temporary; - for(int i = 0; i < sysincspaths.size(); ++i) { + for (int i = 0; i < sysincspaths.size(); ++i) { QString origPath = sysincspaths.at(i); QFileInfo origPathInfo(fileInfo(origPath)); bool bFound = false; - for(int j = 0; j < temporary.size(); ++j) { + for (int j = 0; j < temporary.size(); ++j) { QString tmpPath = temporary.at(j); QFileInfo tmpPathInfo(fileInfo(tmpPath)); - if(origPathInfo.absoluteFilePath() == tmpPathInfo.absoluteFilePath()) { + if (origPathInfo.absoluteFilePath() == tmpPathInfo.absoluteFilePath()) { bFound = true; - if(!tmpPathInfo.isRelative() && origPathInfo.isRelative()) { + if (!tmpPathInfo.isRelative() && origPathInfo.isRelative()) { // We keep the relative notation temporary.removeOne(tmpPath); temporary << origPath; @@ -659,7 +640,7 @@ bool SymbianMakefileGenerator::initMmpVariables() } } - if(!bFound) + if (!bFound) temporary << origPath; } @@ -668,17 +649,15 @@ bool SymbianMakefileGenerator::initMmpVariables() sysincspaths << temporary; systeminclude.insert("SYSTEMINCLUDE", sysincspaths); - - return true; } bool SymbianMakefileGenerator::removeDuplicatedStrings(QStringList& stringList) { QStringList tmpStringList; - for(int i = 0; i < stringList.size(); ++i) { + for (int i = 0; i < stringList.size(); ++i) { QString string = stringList.at(i); - if(tmpStringList.contains(string)) + if (tmpStringList.contains(string)) continue; else tmpStringList.append(string); @@ -689,23 +668,21 @@ bool SymbianMakefileGenerator::removeDuplicatedStrings(QStringList& stringList) return true; } -bool SymbianMakefileGenerator::writeMmpFileHeader(QTextStream &t) +void SymbianMakefileGenerator::writeMmpFileHeader(QTextStream &t) { t << "// ==============================================================================" << endl; t << "// Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; t << "// This file is generated by qmake and should not be modified by the" << endl; t << "// user." << endl; - t << "// Name : " << escapeFilePath(fileFixify(project->projectFile().remove(project->projectFile().length()-4,4))) << ".mmp" << endl; + t << "// Name : " << escapeFilePath(fileFixify(project->projectFile().remove(project->projectFile().length() - 4, 4))) << Option::mmp_ext << endl; t << "// ==============================================================================" << endl << endl; - - return true; } -bool SymbianMakefileGenerator::writeMmpFile(QString &filename, QStringList &symbianLangCodes) +void SymbianMakefileGenerator::writeMmpFile(QString &filename, QStringList &symbianLangCodes) { QFile ft(filename); - if(ft.open(QIODevice::WriteOnly)) { + if (ft.open(QIODevice::WriteOnly)) { generatedFiles << ft.fileName(); QTextStream t(&ft); @@ -722,7 +699,7 @@ bool SymbianMakefileGenerator::writeMmpFile(QString &filename, QStringList &symb QDir current = QDir::current(); - for(QMap<QString, QStringList>::iterator it = sources.begin(); it != sources.end(); ++it) { + for (QMap<QString, QStringList>::iterator it = sources.begin(); it != sources.end(); ++it) { QStringList values = it.value(); QString currentSourcePath = it.key(); @@ -749,23 +726,18 @@ bool SymbianMakefileGenerator::writeMmpFile(QString &filename, QStringList &symb writeMmpFileRulesPart(t); } else { - return false; + PRINT_FILE_CREATE_ERROR(filename) } - - return true; } -bool SymbianMakefileGenerator::writeMmpFileMacrosPart(QTextStream& t) +void SymbianMakefileGenerator::writeMmpFileMacrosPart(QTextStream& t) { t << endl; - if(isConfigSetToSymbian()) - return true; - QStringList &defines = project->values("DEFINES"); if (defines.size()) t << "// Qt Macros" << endl; - for(int i = 0; i < defines.size(); ++i) { + for (int i = 0; i < defines.size(); ++i) { QString def = defines.at(i); addMacro(t, def); } @@ -774,82 +746,77 @@ bool SymbianMakefileGenerator::writeMmpFileMacrosPart(QTextStream& t) QStringList &exp_defines = project->values("PRL_EXPORT_DEFINES"); if (exp_defines.size()) t << endl << "// Qt Export Defines" << endl; - for(int i = 0; i < exp_defines.size(); ++i) { + for (int i = 0; i < exp_defines.size(); ++i) { QString def = exp_defines.at(i); addMacro(t, def); } t << endl; - - return true; } -bool SymbianMakefileGenerator::addMacro(QTextStream& t, const QString& value) +void SymbianMakefileGenerator::addMacro(QTextStream& t, const QString& value) { - t << "MACRO" << "\t\t" << value << endl; - return true; + t << "MACRO" << "\t\t" << value << endl; } -bool SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) +void SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) { - if(getTargetExtension() == "exe") { - t << "TARGET" << "\t\t" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".exe")) << "\n"; + if (targetType == TypeExe) { + t << MMP_TARGET << "\t\t" << fixedTarget << ".exe" << endl; if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) - t << "TARGETTYPE" << "\t\t" << "STDEXE" << endl; + t << MMP_TARGETTYPE << "\t\t" << "STDEXE" << endl; else - t << "TARGETTYPE" << "\t\t" << "EXE" << endl; - } else if (getTargetExtension() == "dll"){ - t << "TARGET" << "\t\t" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".dll")) << "\n"; + t << MMP_TARGETTYPE << "\t\t" << "EXE" << endl; + } else if (targetType == TypeDll || targetType == TypePlugin) { + t << MMP_TARGET << "\t\t" << fixedTarget << ".dll" << endl; if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) - t << "TARGETTYPE" << "\t\t" << "STDDLL" << endl; + t << MMP_TARGETTYPE << "\t\t" << "STDDLL" << endl; else - t << "TARGETTYPE" << "\t\t" << "DLL" << endl; - } else if (getTargetExtension() == "lib"){ - t << "TARGET" << "\t\t" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".lib")) << "\n"; + t << MMP_TARGETTYPE << "\t\t" << "DLL" << endl; + } else if (targetType == TypeLib) { + t << MMP_TARGET << "\t\t" << fixedTarget << ".lib" << endl; if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) - t << "TARGETTYPE" << "\t\t" << "STDLIB" << endl; + t << MMP_TARGETTYPE << "\t\t" << "STDLIB" << endl; else - t << "TARGETTYPE" << "\t\t" << "LIB" << endl; + t << MMP_TARGETTYPE << "\t\t" << "LIB" << endl; } else { - printf("unexpected target and targettype %s\n", getTargetExtension().toAscii().data()); + fprintf(stderr, "Error: Unexpected targettype (%d) in SymbianMakefileGenerator::writeMmpFileTargetPart\n", targetType); } t << endl; t << "UID" << "\t\t" << uid2 << " " << uid3 << endl; - if(0 != project->values("TARGET.SID").size()) { - t << "SECUREID" << "\t\t" << project->values("TARGET.SID").join(" ") << endl; + if (0 != project->values("TARGET.SID").size()) { + t << MMP_SECUREID << "\t\t" << project->values("TARGET.SID").join(" ") << endl; } else { - if(0 == uid3.size()) - t << "SECUREID" << "\t\t" << "0" << endl; + if (0 == uid3.size()) + t << MMP_SECUREID << "\t\t" << "0" << endl; else - t << "SECUREID" << "\t\t" << uid3 << endl; + t << MMP_SECUREID << "\t\t" << uid3 << endl; } // default value used from mkspecs is 0 - if(0 != project->values("TARGET.VID").size()) { + if (0 != project->values("TARGET.VID").size()) { t << "VENDORID" << "\t\t" << project->values("TARGET.VID").join(" ") << endl; } t << endl; - if(0 != project->first("TARGET.EPOCSTACKSIZE").size()) + if (0 != project->first("TARGET.EPOCSTACKSIZE").size()) t << "EPOCSTACKSIZE" << "\t\t" << project->first("TARGET.EPOCSTACKSIZE") << endl; - if(0 != project->values("TARGET.EPOCHEAPSIZE").size()) + if (0 != project->values("TARGET.EPOCHEAPSIZE").size()) t << "EPOCHEAPSIZE" << "\t\t" << project->values("TARGET.EPOCHEAPSIZE").join(" ") << endl; - if(0 != project->values("TARGET.EPOCALLOWDLLDATA").size()) + if (0 != project->values("TARGET.EPOCALLOWDLLDATA").size()) t << "EPOCALLOWDLLDATA" << endl; - if(targetType.compare("plugin", Qt::CaseInsensitive) == 0 && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { + if (targetType == TypePlugin && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { // Use custom def file for Qt plugins t << "DEFFILE " PLUGIN_COMMON_DEF_FILE_FOR_MMP << endl; } t << endl; - - return true; } @@ -857,14 +824,12 @@ bool SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) Application registration resource files should be installed to the \private\10003a3f\import\apps directory. */ -bool SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes) +void SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes) { - if((getTargetExtension() == "exe") && - !project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { - QString target = escapeFilePath(fileFixify(project->first("TARGET"))); - target = removePathSeparators(target); + if ((targetType == TypeExe) && + !project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { - QString locTarget = target; + QString locTarget = fixedTarget; locTarget.append(".rss"); t << "SOURCEPATH\t\t\t. " << endl; @@ -875,28 +840,26 @@ bool SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, QStringL t << endl; t << "START RESOURCE\t\t" << locTarget << endl; t << "HEADER" << endl; - t << "TARGETPATH\t\t\t" RESOURCE_DIRECTORY_MMP<< endl; + t << "TARGETPATH\t\t\t" RESOURCE_DIRECTORY_MMP << endl; t << "END" << endl << endl; - QString regTarget = target; + QString regTarget = fixedTarget; regTarget.append("_reg.rss"); t << "SOURCEPATH\t\t\t." << endl; t << "START RESOURCE\t\t" << regTarget << endl; if (isForSymbianSbsv2()) - t << "DEPENDS " << target << ".rsg" << endl; + t << "DEPENDS " << fixedTarget << ".rsg" << endl; t << "TARGETPATH\t\t" REGISTRATION_RESOURCE_DIRECTORY_HW << endl; t << "END" << endl << endl; - } - return true; + } } -bool SymbianMakefileGenerator::writeMmpFileSystemIncludePart(QTextStream& t) +void SymbianMakefileGenerator::writeMmpFileSystemIncludePart(QTextStream& t) { - QDir current = QDir::current(); - for(QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { + for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { QStringList values = it.value(); for (int i = 0; i < values.size(); ++i) { QString handledPath = values.at(i); @@ -905,30 +868,25 @@ bool SymbianMakefileGenerator::writeMmpFileSystemIncludePart(QTextStream& t) } t << endl; - - return true; } -bool SymbianMakefileGenerator::writeMmpFileIncludePart(QTextStream& t) +void SymbianMakefileGenerator::writeMmpFileIncludePart(QTextStream& t) { - writeMmpFileSystemIncludePart(t); - - return true; } -bool SymbianMakefileGenerator::writeMmpFileLibraryPart(QTextStream& t) +void SymbianMakefileGenerator::writeMmpFileLibraryPart(QTextStream& t) { QStringList &libs = project->values("LIBS"); libs << project->values("QMAKE_LIBS"); removeDuplicatedStrings(libs); - for(int i = 0; i < libs.size(); ++i) { + for (int i = 0; i < libs.size(); ++i) { QString lib = libs.at(i); // The -L flag is uninteresting, since all symbian libraries exist in the same directory. - if(lib.startsWith("-l")) { - lib.remove(0,2); + if (lib.startsWith("-l")) { + lib.remove(0, 2); QString mmpStatement; if (lib.endsWith(".dll")) { lib.chop(4); @@ -955,61 +913,56 @@ bool SymbianMakefileGenerator::writeMmpFileLibraryPart(QTextStream& t) } t << endl; - - return true; } -bool SymbianMakefileGenerator::writeMmpFileCapabilityPart(QTextStream& t) +void SymbianMakefileGenerator::writeMmpFileCapabilityPart(QTextStream& t) { - if(0 != project->first("TARGET.CAPABILITY").size()) { + if (0 != project->first("TARGET.CAPABILITY").size()) { QStringList &capabilities = project->values("TARGET.CAPABILITY"); t << "CAPABILITY" << "\t\t"; - for(int i = 0; i < capabilities.size(); ++i) { + for (int i = 0; i < capabilities.size(); ++i) { QString cap = capabilities.at(i); t << cap << " "; } - } - else { + } else { t << "CAPABILITY" << "\t\t" << "None"; } t << endl << endl; - - return true; } -bool SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) +void SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) { QString cw, armcc; - if(0 != project->values("QMAKE_CXXFLAGS.CW").size()) { + if (0 != project->values("QMAKE_CXXFLAGS.CW").size()) { cw.append(project->values("QMAKE_CXXFLAGS.CW").join(" ")); cw.append(" "); } - if(0 != project->values("QMAKE_CXXFLAGS.ARMCC").size()) { + if (0 != project->values("QMAKE_CXXFLAGS.ARMCC").size()) { armcc.append(project->values("QMAKE_CXXFLAGS.ARMCC").join(" ")); armcc.append(" "); } - if(0 != project->values("QMAKE_CFLAGS.CW").size()) { + if (0 != project->values("QMAKE_CFLAGS.CW").size()) { cw.append(project->values("QMAKE_CFLAGS.CW").join(" ")); cw.append(" "); } - if(0 != project->values("QMAKE_CFLAGS.ARMCC").size()) { + if (0 != project->values("QMAKE_CFLAGS.ARMCC").size()) { armcc.append(project->values("QMAKE_CFLAGS.ARMCC").join(" ")); armcc.append(" "); } - if(0 != project->values("QMAKE_CXXFLAGS").size()) { + if (0 != project->values("QMAKE_CXXFLAGS").size()) { cw.append(project->values("QMAKE_CXXFLAGS").join(" ")); cw.append(" "); armcc.append(project->values("QMAKE_CXXFLAGS").join(" ")); armcc.append(" "); } - if(0 != project->values("QMAKE_CFLAGS").size()) { + if (0 != project->values("QMAKE_CFLAGS").size()) { cw.append(project->values("QMAKE_CFLAGS").join(" ")); cw.append(" "); armcc.append(project->values("QMAKE_CFLAGS").join(" ")); @@ -1024,13 +977,12 @@ bool SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) if (!cw.isEmpty()) t << "OPTION" << '\t' << " CW " << cw << endl; if (!armcc.isEmpty()) - t << "OPTION" << '\t' << " ARMCC "<< armcc << endl; + t << "OPTION" << '\t' << " ARMCC " << armcc << endl; t << endl; - return true; } -bool SymbianMakefileGenerator::writeMmpFileBinaryVersionPart(QTextStream& t) +void SymbianMakefileGenerator::writeMmpFileBinaryVersionPart(QTextStream& t) { QString applicationVersion = project->first("VERSION"); QStringList verNumList = applicationVersion.split('.'); @@ -1064,11 +1016,9 @@ bool SymbianMakefileGenerator::writeMmpFileBinaryVersionPart(QTextStream& t) } t << "VERSION " << mmpVersion << endl; - - return true; } -bool SymbianMakefileGenerator::writeMmpFileRulesPart(QTextStream& t) +void SymbianMakefileGenerator::writeMmpFileRulesPart(QTextStream& t) { foreach(QString item, project->values("MMP_RULES")) { t << endl; @@ -1082,16 +1032,15 @@ bool SymbianMakefileGenerator::writeMmpFileRulesPart(QTextStream& t) } } } - return true; } -bool SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploymentExtension) +void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploymentExtension) { // Read user defined bld inf rules QMap<QString, QStringList> userBldInfRules; - for(QMap<QString, QStringList>::iterator it = project->variables().begin(); it != project->variables().end(); ++it) { + for (QMap<QString, QStringList>::iterator it = project->variables().begin(); it != project->variables().end(); ++it) { if (it.key().startsWith(BLD_INF_RULES_BASE)) { - QString newKey = it.key().mid(sizeof(BLD_INF_RULES_BASE)-1); + QString newKey = it.key().mid(sizeof(BLD_INF_RULES_BASE) - 1); if (newKey.isEmpty()) { fprintf(stderr, "Warning: Empty BLD_INF_RULES key encountered\n"); continue; @@ -1116,10 +1065,10 @@ bool SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy // Add includes of subdirs bld.inf files QString mmpfilename = escapeFilePath(fileFixify(project->projectFile())); - mmpfilename = mmpfilename.replace(mmpfilename.lastIndexOf(".")+1, 3, "mmp"); + mmpfilename = mmpfilename.replace(mmpfilename.lastIndexOf("."), 4, Option::mmp_ext); QString currentPath = qmake_getpwd(); - if(!currentPath.endsWith(QString("/"))) + if (!currentPath.endsWith(QString("/"))) currentPath.append("/"); QStringList mmpProjects = project->values("MMPFILES_DIRECT_DEPENDS"); @@ -1131,26 +1080,26 @@ bool SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy // Go in reverse order as that is the way how we build the list QListIterator<QString> iT(mmpProjects); iT.toBack(); - while(iT.hasPrevious()) { + while (iT.hasPrevious()) { QString fullMmpName = iT.previous(); QString relativePath; QString bldinfFilename; QString fullProFilename = fullMmpName; - fullProFilename.replace(QString(".mmp"), QString(".pro")); + fullProFilename.replace(Option::mmp_ext, Option::pro_ext); QString uid = generate_uid(fullProFilename); QString cleanMmpName = fullProFilename; - cleanMmpName.replace(QString(".pro"), QString("")); + cleanMmpName.replace(Option::pro_ext, QString("")); cleanMmpName.replace(0, cleanMmpName.lastIndexOf("/") + 1, QString("")); - if(shadowProjects.contains(BLD_INF_FILENAME "." + cleanMmpName)) { // shadow project + if (shadowProjects.contains(BLD_INF_FILENAME "." + cleanMmpName)) { // shadow project QDir directory(currentPath); relativePath = directory.relativeFilePath(fullProFilename); bldinfFilename = BLD_INF_FILENAME "." + cleanMmpName; - if(relativePath.contains("/")) { + if (relativePath.contains("/")) { // Shadow .pro not in same directory as parent .pro - if(relativePath.startsWith("..")) { + if (relativePath.startsWith("..")) { // Shadow .pro out of parent .pro relativePath.replace(relativePath.lastIndexOf("/"), relativePath.length(), QString("")); bldinfFilename.prepend("/").prepend(relativePath); @@ -1181,7 +1130,7 @@ bool SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy // Add supported project platforms t << endl << BLD_INF_TAG_PLATFORMS << endl << endl; - if(0 != project->values("SYMBIAN_PLATFORMS").size()) + if (0 != project->values("SYMBIAN_PLATFORMS").size()) t << project->values("SYMBIAN_PLATFORMS").join(" ") << endl; QStringList userItems = userBldInfRules.value(BLD_INF_TAG_PLATFORMS); @@ -1200,16 +1149,14 @@ bool SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy t << endl << mmpTag << endl << endl; writeBldInfMkFilePart(t, addDeploymentExtension); - if (getTargetExtension() == "subdirs") { + if (targetType == TypeSubdirs) { mmpProjects.removeOne(mmpfilename); - } - - if(getTargetExtension() != "subdirs") { + } else { QString shortProFilename = project->projectFile(); shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString("")); - shortProFilename.replace(QString(".pro"), QString("")); + shortProFilename.replace(Option::pro_ext, QString("")); - QString mmpFilename = shortProFilename + QString("_") + uid3 + QString(".mmp"); + QString mmpFilename = shortProFilename + QString("_") + uid3 + Option::mmp_ext; t << mmpFilename << endl; } @@ -1231,22 +1178,20 @@ bool SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy // Add rest of the user defined content - for(QMap<QString, QStringList>::iterator it = userBldInfRules.begin(); it != userBldInfRules.end(); ++it) { + for (QMap<QString, QStringList>::iterator it = userBldInfRules.begin(); it != userBldInfRules.end(); ++it) { t << endl << endl << it.key() << endl << endl; userItems = it.value(); foreach(QString item, userItems) t << item << endl; } - - return true; } -bool SymbianMakefileGenerator::writeRegRssFile(QString &appName, QStringList &userItems) +void SymbianMakefileGenerator::writeRegRssFile(QString &appName, QStringList &userItems) { QString filename(appName); filename.append("_reg.rss"); QFile ft(filename); - if(ft.open(QIODevice::WriteOnly)) { + if (ft.open(QIODevice::WriteOnly)) { generatedFiles << ft.fileName(); QTextStream t(&ft); t << "// ============================================================================" << endl; @@ -1272,17 +1217,16 @@ bool SymbianMakefileGenerator::writeRegRssFile(QString &appName, QStringList &us t << "\t" << item << endl; t << "\t}" << endl; } else { - return false; + PRINT_FILE_CREATE_ERROR(filename) } - return true; } -bool SymbianMakefileGenerator::writeRssFile(QString &appName, QString &numberOfIcons, QString &iconFile) +void SymbianMakefileGenerator::writeRssFile(QString &appName, QString &numberOfIcons, QString &iconFile) { QString filename(appName); filename.append(".rss"); QFile ft(filename); - if(ft.open(QIODevice::WriteOnly)) { + if (ft.open(QIODevice::WriteOnly)) { generatedFiles << ft.fileName(); QTextStream t(&ft); t << "// ============================================================================" << endl; @@ -1303,12 +1247,11 @@ bool SymbianMakefileGenerator::writeRssFile(QString &appName, QString &numberOfI t << "\t\t{" << endl; t << "\t\tcaption = STRING_r_caption;" << endl; - if(numberOfIcons.isEmpty() || iconFile.isEmpty() ) { + if (numberOfIcons.isEmpty() || iconFile.isEmpty()) { // There can be maximum one item in this tag, validated when parsed t << "\t\tnumber_of_icons = 0;" << endl; t << "\t\ticon_file = \"\";" << endl; - } - else { + } else { // There can be maximum one item in this tag, validated when parsed t << "\t\tnumber_of_icons = " << numberOfIcons << ";" << endl; t << "\t\ticon_file = \"" << iconFile << "\";" << endl; @@ -1317,17 +1260,16 @@ bool SymbianMakefileGenerator::writeRssFile(QString &appName, QString &numberOfI t << "\t}" << endl; t << endl; } else { - return false; + PRINT_FILE_CREATE_ERROR(filename); } - return true; } -bool SymbianMakefileGenerator::writeLocFile(QString &appName, QStringList &symbianLangCodes) +void SymbianMakefileGenerator::writeLocFile(QString &appName, QStringList &symbianLangCodes) { QString filename(appName); filename.append(".loc"); QFile ft(filename); - if(ft.open(QIODevice::WriteOnly)) { + if (ft.open(QIODevice::WriteOnly)) { generatedFiles << ft.fileName(); QTextStream t(&ft); t << "// ============================================================================" << endl; @@ -1352,16 +1294,15 @@ bool SymbianMakefileGenerator::writeLocFile(QString &appName, QStringList &symbi t << "#define STRING_r_caption \"" << appName << "\"" << endl; t << "#endif" << endl; } else { - return false; + PRINT_FILE_CREATE_ERROR(filename); } - return true; } void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules) { - for(QMap<QString, QStringList>::iterator it = project->variables().begin(); it != project->variables().end(); ++it) { + for (QMap<QString, QStringList>::iterator it = project->variables().begin(); it != project->variables().end(); ++it) { if (it.key().startsWith(RSS_RULES_BASE)) { - QString newKey = it.key().mid(sizeof(RSS_RULES_BASE)-1); + QString newKey = it.key().mid(sizeof(RSS_RULES_BASE) - 1); if (newKey.isEmpty()) { fprintf(stderr, "Warning: Empty RSS_RULES_BASE key encountered\n"); continue; @@ -1385,7 +1326,7 @@ void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &ico numberOfIcons = newValues[0]; } else { fprintf(stderr, "Warning: There must be exactly one value in '%s%s'\n", - RSS_RULES_BASE, RSS_TAG_NBROFICONS); + RSS_RULES_BASE, RSS_TAG_NBROFICONS); continue; } // Verify thet there is exactly one value in RSS_TAG_ICONFILE @@ -1394,12 +1335,12 @@ void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &ico iconFile = newValues[0]; } else { fprintf(stderr, "Warning: There must be exactly one value in '%s%s'\n", - RSS_RULES_BASE, RSS_TAG_ICONFILE); + RSS_RULES_BASE, RSS_TAG_ICONFILE); continue; } } else { fprintf(stderr, "Warning: Unsupported key:'%s%s'\n", - RSS_RULES_BASE, newKey.toLatin1().constData()); + RSS_RULES_BASE, newKey.toLatin1().constData()); continue; } } @@ -1417,16 +1358,16 @@ void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &ico // Validate that either both RSS_TAG_NBROFICONS and RSS_TAG_ICONFILE keys exist // or neither of them exist - if ( !((numberOfIcons.isEmpty() && iconFile.isEmpty()) || - (!numberOfIcons.isEmpty() && !iconFile.isEmpty())) ) { + if (!((numberOfIcons.isEmpty() && iconFile.isEmpty()) || + (!numberOfIcons.isEmpty() && !iconFile.isEmpty()))) { numberOfIcons.clear(); iconFile.clear(); fprintf(stderr, "Warning: Both or neither of '%s%s' and '%s%s' keys must exist.\n", - RSS_RULES_BASE, RSS_TAG_NBROFICONS, RSS_RULES_BASE, RSS_TAG_ICONFILE ); + RSS_RULES_BASE, RSS_TAG_NBROFICONS, RSS_RULES_BASE, RSS_TAG_ICONFILE); } // Validate that RSS_TAG_NBROFICONS contains only numbers - if( !numberOfIcons.isEmpty() ) { + if (!numberOfIcons.isEmpty()) { bool ok; numberOfIcons = numberOfIcons.simplified(); int tmp = numberOfIcons.toInt(&ok); @@ -1434,7 +1375,7 @@ void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &ico numberOfIcons.clear(); iconFile.clear(); fprintf(stderr, "Warning: '%s%s' must be integer in decimal format.\n", - RSS_RULES_BASE, RSS_TAG_NBROFICONS ); + RSS_RULES_BASE, RSS_TAG_NBROFICONS); } } } @@ -1451,10 +1392,10 @@ QStringList SymbianMakefileGenerator::symbianLangCodesFromTsFiles() int extIndex = file.lastIndexOf("."); int langIndex = file.lastIndexOf("_", (extIndex - file.length())); langIndex += 1; - QString qtlang = file.mid(langIndex, extIndex - langIndex ); + QString qtlang = file.mid(langIndex, extIndex - langIndex); QString s60lang = qt2S60LangMapTable.value(qtlang, QString("SC")); - if( !symbianLangCodes.contains(s60lang) && s60lang != "SC" ) + if (!symbianLangCodes.contains(s60lang) && s60lang != "SC") symbianLangCodes += s60lang; } @@ -1466,8 +1407,8 @@ void SymbianMakefileGenerator::fillQt2S60LangMapTable() qt2S60LangMapTable.reserve(170); // 165 items at time of writing. qt2S60LangMapTable.insert("ab", "SC"); //Abkhazian // qt2S60LangMapTable.insert("om", "SC"); //Afan // - qt2S60LangMapTable.insert("aa", "SC"); //Afar // - qt2S60LangMapTable.insert("af", "34"); //Afrikaans //Afrikaans + qt2S60LangMapTable.insert("aa", "SC"); //Afar // + qt2S60LangMapTable.insert("af", "34"); //Afrikaans //Afrikaans qt2S60LangMapTable.insert("sq", "35"); //Albanian //Albanian qt2S60LangMapTable.insert("am", "36"); //Amharic //Amharic qt2S60LangMapTable.insert("ar", "37"); //Arabic //Arabic @@ -1621,18 +1562,18 @@ void SymbianMakefileGenerator::fillQt2S60LangMapTable() qt2S60LangMapTable.insert("cch", "SC"); //Atsam // qt2S60LangMapTable.insert("tig", "SC"); //Tigre // qt2S60LangMapTable.insert("kaj", "SC"); //Jju // - qt2S60LangMapTable.insert("fur", "SC"); //Friulian // - qt2S60LangMapTable.insert("ve", "SC"); //Venda // - qt2S60LangMapTable.insert("ee", "SC"); //Ewe // - qt2S60LangMapTable.insert("wa", "SC"); //Walamo // - qt2S60LangMapTable.insert("haw", "SC"); //Hawaiian // - qt2S60LangMapTable.insert("kcg", "SC"); //Tyap // - qt2S60LangMapTable.insert("ny", "SC"); //Chewa // + qt2S60LangMapTable.insert("fur", "SC"); //Friulian // + qt2S60LangMapTable.insert("ve", "SC"); //Venda // + qt2S60LangMapTable.insert("ee", "SC"); //Ewe // + qt2S60LangMapTable.insert("wa", "SC"); //Walamo // + qt2S60LangMapTable.insert("haw", "SC"); //Hawaiian // + qt2S60LangMapTable.insert("kcg", "SC"); //Tyap // + qt2S60LangMapTable.insert("ny", "SC"); //Chewa // } void SymbianMakefileGenerator::appendIfnotExist(QStringList &list, QString value) { - if(!list.contains(value)) + if (!list.contains(value)) list += value; } @@ -1645,8 +1586,8 @@ void SymbianMakefileGenerator::appendIfnotExist(QStringList &list, QStringList v QString SymbianMakefileGenerator::removePathSeparators(QString &file) { QString ret = file; - while(ret.indexOf(QDir::separator()) > 0) { - ret.remove(0, ret.indexOf(QDir::separator())+1); + while (ret.indexOf(QDir::separator()) > 0) { + ret.remove(0, ret.indexOf(QDir::separator()) + 1); } return ret; @@ -1656,19 +1597,19 @@ QString SymbianMakefileGenerator::removePathSeparators(QString &file) QString SymbianMakefileGenerator::removeTrailingPathSeparators(QString &file) { QString ret = file; - if(ret.endsWith(QDir::separator())) { - ret.remove(ret.length()-1,1); + if (ret.endsWith(QDir::separator())) { + ret.remove(ret.length() - 1, 1); } return ret; } void SymbianMakefileGenerator::generateCleanCommands(QTextStream& t, - const QStringList& toClean, - const QString& cmd, - const QString& cmdOptions, - const QString& itemPrefix, - const QString& itemSuffix) + const QStringList& toClean, + const QString& cmd, + const QString& cmdOptions, + const QString& itemPrefix, + const QString& itemSuffix) { for (int i = 0; i < toClean.size(); ++i) { QString item = toClean.at(i); @@ -1699,10 +1640,10 @@ void SymbianMakefileGenerator::generateDistcleanTargets(QTextStream& t) foreach(QString item, project->values("SUBDIRS")) { bool fromFile = false; QString fixedItem; - if(!project->isEmpty(item + ".file")) { + if (!project->isEmpty(item + ".file")) { fixedItem = project->first(item + ".file"); fromFile = true; - } else if(!project->isEmpty(item + ".subdir")) { + } else if (!project->isEmpty(item + ".subdir")) { fixedItem = project->first(item + ".subdir"); fromFile = false; } else { @@ -1716,7 +1657,7 @@ void SymbianMakefileGenerator::generateDistcleanTargets(QTextStream& t) QString itemName = fi.fileName(); int extIndex = itemName.lastIndexOf(Option::pro_ext); if (extIndex) - fixedItem = fi.absolutePath() + "/" + QString("Makefile.") + itemName.mid(0,extIndex); + fixedItem = fi.absolutePath() + "/" + QString("Makefile.") + itemName.mid(0, extIndex); t << "\t-$(MAKE) -f \"" << Option::fixPathToTargetOS(fixedItem) << "\" dodistclean" << endl; } diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h index 3bf9f1d..e4b23e2 100644 --- a/qmake/generators/symbian/symmake.h +++ b/qmake/generators/symbian/symmake.h @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the qmake application of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -54,12 +54,19 @@ QT_BEGIN_NAMESPACE class SymbianMakefileGenerator : public MakefileGenerator { protected: + enum TargetType { + TypeExe, + TypeDll, + TypeLib, + TypePlugin, + TypeSubdirs + }; QString platform; QString uid2; QString uid3; QString privateDirUid; - QString targetType; + TargetType targetType; QMap<QString, QStringList> sources; QMap<QString, QStringList> systeminclude; QMap<QString, QStringList> library; @@ -70,46 +77,50 @@ protected: QStringList generatedDirs; QHash<QString, QString> qt2S60LangMapTable; + QString fixedTarget; + void removeSpecialCharacters(QString& str); QString fixPathForMmp(const QString& origPath, const QDir& parentDir); QString canonizePath(const QString& origPath); virtual bool writeMakefile(QTextStream &t); - bool generatePkgFile(const QString &compiler, const QString &config, const QString &iconFile); + void generatePkgFile(const QString &compiler, const QString &config, const QString &iconFile); bool containsStartWithItem(const QChar &c, const QStringList& src); virtual void init(); QString getTargetExtension(); - bool isConfigSetToSymbian(); QString generateUID3(); - bool initMmpVariables(); + void initMmpVariables(); void writeHeader(QTextStream &t); - bool writeBldInfContent(QTextStream& t, bool addDeploymentExtension); + void writeBldInfContent(QTextStream& t, bool addDeploymentExtension); static bool removeDuplicatedStrings(QStringList& stringList); - bool writeMmpFileHeader(QTextStream &t); - bool writeMmpFile(QString &filename, QStringList &symbianLangCodes); - bool writeMmpFileMacrosPart(QTextStream& t); - bool addMacro(QTextStream& t, const QString& value); - bool writeMmpFileTargetPart(QTextStream& t); - bool writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes); - bool writeMmpFileSystemIncludePart(QTextStream& t); - bool writeMmpFileIncludePart(QTextStream& t); - bool writeMmpFileLibraryPart(QTextStream& t); - bool writeMmpFileCapabilityPart(QTextStream& t); - bool writeMmpFileCompilerOptionPart(QTextStream& t); - bool writeMmpFileBinaryVersionPart(QTextStream& t); - bool writeMmpFileRulesPart(QTextStream& t); - - bool writeRegRssFile(QString &appname, QStringList &useritems); - bool writeRssFile(QString &appName, QString &numberOfIcons, QString &iconfile); - bool writeLocFile(QString &appName, QStringList &symbianLangCodes); + void writeMmpFileHeader(QTextStream &t); + void writeMmpFile(QString &filename, QStringList &symbianLangCodes); + void writeMmpFileMacrosPart(QTextStream& t); + void addMacro(QTextStream& t, const QString& value); + void writeMmpFileTargetPart(QTextStream& t); + void writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes); + void writeMmpFileSystemIncludePart(QTextStream& t); + void writeMmpFileIncludePart(QTextStream& t); + void writeMmpFileLibraryPart(QTextStream& t); + void writeMmpFileCapabilityPart(QTextStream& t); + void writeMmpFileCompilerOptionPart(QTextStream& t); + void writeMmpFileBinaryVersionPart(QTextStream& t); + void writeMmpFileRulesPart(QTextStream& t); + + void writeCustomDefFile(); + + void writeRegRssFile(QString &appname, QStringList &useritems); + void writeRssFile(QString &appName, QString &numberOfIcons, QString &iconfile); + void writeLocFile(QString &appName, QStringList &symbianLangCodes); void readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules); + QStringList symbianLangCodesFromTsFiles(); void fillQt2S60LangMapTable(); @@ -127,12 +138,10 @@ protected: void generateDistcleanTargets(QTextStream& t); - bool writeCustomDefFile(); - // Subclass implements - virtual bool writeBldInfExtensionRulesPart(QTextStream& t) = 0; + virtual void writeBldInfExtensionRulesPart(QTextStream& t) = 0; virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension) = 0; - virtual bool writeMkFile(const QString& wrapperFileName, bool deploymentOnly) = 0; + virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly) = 0; virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile) = 0; public: diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp index 17c365d..d88b34b 100644 --- a/qmake/generators/symbian/symmake_abld.cpp +++ b/qmake/generators/symbian/symmake_abld.cpp @@ -1,9 +1,9 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the qmake application of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -62,14 +62,14 @@ SymbianAbldMakefileGenerator::SymbianAbldMakefileGenerator() : SymbianMakefileGenerator() { } SymbianAbldMakefileGenerator::~SymbianAbldMakefileGenerator() { } -bool SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly) +void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly) { QString gnuMakefileName = QLatin1String("Makefile_") + uid3; removeSpecialCharacters(gnuMakefileName); gnuMakefileName.append(".mk"); QFile ft(gnuMakefileName); - if(ft.open(QIODevice::WriteOnly)) { + if (ft.open(QIODevice::WriteOnly)) { generatedFiles << ft.fileName(); QTextStream t(&ft); @@ -103,7 +103,7 @@ bool SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, b if (deploymentOnly) { buildDeps.append(DO_NOTHING_TARGET); cleanDeps.append(DO_NOTHING_TARGET); - cleanDepsWinscw.append( WINSCW_DEPLOYMENT_CLEAN_TARGET); + cleanDepsWinscw.append(WINSCW_DEPLOYMENT_CLEAN_TARGET); finalDeps.append(DO_NOTHING_TARGET); finalDepsWinscw.append(WINSCW_DEPLOYMENT_TARGET); wrapperTargets << WINSCW_DEPLOYMENT_TARGET << WINSCW_DEPLOYMENT_CLEAN_TARGET; @@ -148,8 +148,6 @@ bool SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, b t << endl; } // if(ft.open(QIODevice::WriteOnly)) - - return true; } void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile) @@ -163,8 +161,6 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool QStringList releasePlatforms = allPlatforms; releasePlatforms.removeAll("winscw"); // No release for emulator - bool isSubdirs = getTargetExtension() == "subdirs"; - QString testClause; if (project->values("CONFIG").contains("symbian_test", Qt::CaseInsensitive)) testClause = QLatin1String(" test"); @@ -184,12 +180,13 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool t << "# ==============================================================================" << "\n" << endl; t << endl; QString ofile = Option::fixPathToTargetOS(Option::output.fileName()); - if(ofile.lastIndexOf(Option::dir_sep) != -1) - ofile = ofile.right(ofile.length() - ofile.lastIndexOf(Option::dir_sep) -1); + if (ofile.lastIndexOf(Option::dir_sep) != -1) + ofile = ofile.right(ofile.length() - ofile.lastIndexOf(Option::dir_sep) - 1); t << "MAKEFILE = " << ofile << endl; t << "QMAKE = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl; t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; + t << "MOVE = " << var("QMAKE_MOVE") << endl; t << "XCOPY = xcopy /d /f /h /r /y /i" << endl; t << "ABLD = ABLD.BAT" << endl; t << "DEBUG_PLATFORMS = " << debugPlatforms.join(" ") << endl; @@ -209,7 +206,7 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool t << "INCPATH" << '\t' << " = "; - for(QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { + for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { QStringList values = it.value(); for (int i = 0; i < values.size(); ++i) { t << " -I\"" << values.at(i) << "\""; @@ -285,7 +282,7 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool // Unfortunately, Symbian build chain doesn't support linking generated objects to target, // so supporting generating sources is the best we can do. This is enough for mocs. - if (!isSubdirs) { + if (targetType != TypeSubdirs) { writeExtraTargets(t); writeExtraCompilerTargets(t); @@ -293,7 +290,7 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool // generate command lines like this ... // -@ if NOT EXIST ".\somedir" mkdir ".\somedir" QStringList dirsToClean; - for(QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { + for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { QStringList values = it.value(); for (int i = 0; i < values.size(); ++i) { if (values.at(i).endsWith("/" QT_EXTRA_INCLUDE_DIR)) { @@ -325,7 +322,7 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool t << ALL_SOURCE_DEPS_TARGET ":"; QStringList allDeps; - for(QMap<QString, QStringList>::iterator it = sources.begin(); it != sources.end(); ++it) { + for (QMap<QString, QStringList>::iterator it = sources.begin(); it != sources.end(); ++it) { QString currentSourcePath = it.key(); QStringList values = it.value(); for (int i = 0; i < values.size(); ++i) { @@ -343,15 +340,14 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool // Post link operations t << FINALIZE_TARGET ":" << endl; - if(!project->isEmpty("QMAKE_POST_LINK")) { + if (!project->isEmpty("QMAKE_POST_LINK")) { t << '\t' << var("QMAKE_POST_LINK"); t << endl; } t << endl; - } - else { + } else { QList<MakefileGenerator::SubTarget*> subtargets = findSubDirsSubTargets(); - writeSubTargets(t, subtargets, SubTargetSkipDefaultVariables|SubTargetSkipDefaultTargets); + writeSubTargets(t, subtargets, SubTargetSkipDefaultVariables | SubTargetSkipDefaultTargets); qDeleteAll(subtargets); } @@ -365,17 +361,16 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool t << endl; // Create execution target - if (debugPlatforms.contains("winscw") && getTargetExtension() == "exe") { + if (debugPlatforms.contains("winscw") && targetType == TypeExe) { t << "run:" << endl; t << "\t-call " << epocRoot() << "epoc32\\release\\winscw\\udeb\\" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".exe")) << endl << endl; } } -bool SymbianAbldMakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t) +void SymbianAbldMakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t) { // We don't use extensions for anything in abld Q_UNUSED(t); - return true; } bool SymbianAbldMakefileGenerator::writeDeploymentTargets(QTextStream &t) @@ -384,23 +379,23 @@ bool SymbianAbldMakefileGenerator::writeDeploymentTargets(QTextStream &t) QString remoteTestPath = epocRoot() + QLatin1String("epoc32\\winscw\\c\\private\\") + privateDirUid; // default 4 OpenC; 4 all Symbian too DeploymentList depList; - initProjectDeploySymbian( project, depList, remoteTestPath, false, QLatin1String("winscw"), QLatin1String("udeb"), generatedDirs, generatedFiles ); + initProjectDeploySymbian(project, depList, remoteTestPath, false, QLatin1String("winscw"), QLatin1String("udeb"), generatedDirs, generatedFiles); if (depList.size()) t << "\t-echo Deploying changed files..." << endl; - for (int i=0; i<depList.size(); ++i) { + for (int i = 0; i < depList.size(); ++i) { // Xcopy prompts for selecting file or directory if target doesn't exist, // and doesn't provide switch to force file selection. It does provide dir forcing, though, // so strip the last part of the destination. - t << "\t-$(XCOPY) \"" << depList.at(i).from << "\" \"" << depList.at(i).to.left(depList.at(i).to.lastIndexOf("\\")+1) << "\"" << endl; + t << "\t-$(XCOPY) \"" << depList.at(i).from << "\" \"" << depList.at(i).to.left(depList.at(i).to.lastIndexOf("\\") + 1) << "\"" << endl; } t << endl; t << WINSCW_DEPLOYMENT_CLEAN_TARGET ":" << endl; QStringList cleanList; - for (int i=0; i<depList.size(); ++i) { + for (int i = 0; i < depList.size(); ++i) { cleanList.append(depList.at(i).to); } generateCleanCommands(t, cleanList, "$(DEL_FILE)", "", "", ""); @@ -417,7 +412,7 @@ void SymbianAbldMakefileGenerator::writeBldInfMkFilePart(QTextStream& t, bool ad { // Normally emulator deployment gets done via regular makefile, but since subdirs // do not get that, special deployment only makefile is generated for them if needed. - if(getTargetExtension() != "subdirs" || addDeploymentExtension) { + if (targetType != TypeSubdirs || addDeploymentExtension) { QString gnuMakefileName = QLatin1String("Makefile_") + uid3; removeSpecialCharacters(gnuMakefileName); gnuMakefileName.append(".mk"); diff --git a/qmake/generators/symbian/symmake_abld.h b/qmake/generators/symbian/symmake_abld.h index 7de6510..0b2989f 100644 --- a/qmake/generators/symbian/symmake_abld.h +++ b/qmake/generators/symbian/symmake_abld.h @@ -1,9 +1,9 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the qmake application of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -51,9 +51,9 @@ class SymbianAbldMakefileGenerator : public SymbianMakefileGenerator protected: // Inherited from parent - virtual bool writeBldInfExtensionRulesPart(QTextStream& t); + virtual void writeBldInfExtensionRulesPart(QTextStream& t); virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension); - virtual bool writeMkFile(const QString& wrapperFileName, bool deploymentOnly); + virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly); virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile); bool writeDeploymentTargets(QTextStream &t); diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index 34585e8..f3b90c6 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -1,9 +1,9 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the qmake application of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -79,20 +79,19 @@ void SymbianSbsv2MakefileGenerator::exportFlm() generatedFiles << destInfo.absoluteFilePath(); else fprintf(stderr, "Error: Could not copy '%s' -> '%s'\n", - qPrintable(item.absoluteFilePath()), - qPrintable(destInfo.absoluteFilePath())); + qPrintable(item.absoluteFilePath()), + qPrintable(destInfo.absoluteFilePath())); } } flmExportDone = true; } } -bool SymbianSbsv2MakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly) +void SymbianSbsv2MakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly) { // Can't use extension makefile with sbsv2 Q_UNUSED(wrapperFileName); Q_UNUSED(deploymentOnly); - return true; } void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile) @@ -106,8 +105,6 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo QStringList releasePlatforms = allPlatforms; releasePlatforms.removeAll("winscw"); // No release for emulator - bool isSubdirs = getTargetExtension() == "subdirs"; - QString testClause; if (project->values("CONFIG").contains("symbian_test", Qt::CaseInsensitive)) testClause = QLatin1String(".test"); @@ -127,12 +124,13 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo t << "# ==============================================================================" << "\n" << endl; t << endl; QString ofile = Option::fixPathToTargetOS(Option::output.fileName()); - if(ofile.lastIndexOf(Option::dir_sep) != -1) - ofile = ofile.right(ofile.length() - ofile.lastIndexOf(Option::dir_sep) -1); + if (ofile.lastIndexOf(Option::dir_sep) != -1) + ofile = ofile.right(ofile.length() - ofile.lastIndexOf(Option::dir_sep) - 1); t << "MAKEFILE = " << ofile << endl; t << "QMAKE = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl; t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; + t << "MOVE = " << var("QMAKE_MOVE") << endl; t << "DEBUG_PLATFORMS = " << debugPlatforms.join(" ") << endl; t << "RELEASE_PLATFORMS = " << releasePlatforms.join(" ") << endl; t << "MAKE = make" << endl; @@ -145,7 +143,7 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo t << "INCPATH" << '\t' << " = "; - for(QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { + for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { QStringList values = it.value(); for (int i = 0; i < values.size(); ++i) { t << " -I\"" << values.at(i) << "\" "; @@ -212,11 +210,10 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo // Add all extra targets including extra compiler targest 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 (!isSubdirs) { + if (targetType != TypeSubdirs) { t << extraTargetsCache; t << extraCompilersCache; - } - else { + } else { QList<MakefileGenerator::SubTarget*> subtargets = findSubDirsSubTargets(); writeSubTargets(t, subtargets, SubTargetSkipDefaultVariables|SubTargetSkipDefaultTargets); qDeleteAll(subtargets); @@ -229,13 +226,13 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo t << endl; // create execution target - if (debugPlatforms.contains("winscw") && getTargetExtension() == "exe") { + if (debugPlatforms.contains("winscw") && targetType == TypeExe) { t << "run:" << endl; t << "\t-call " << epocRoot() << "epoc32/release/winscw/udeb/" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".exe")) << endl << endl; } } -bool SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t) +void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t) { // Makes sure we have needed FLMs in place. exportFlm(); @@ -247,7 +244,7 @@ bool SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t defines << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") << varGlue("QMAKE_COMPILER_DEFINES", "-D", "-D", " ") << varGlue("DEFINES","-D"," -D",""); - for(QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { + for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { QStringList values = it.value(); for (int i = 0; i < values.size(); ++i) { incPath << QLatin1String(" -I\"") + values.at(i) + "\""; @@ -267,8 +264,8 @@ bool SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t foreach(QString item, project->values("PRE_TARGETDEPS")) { // Predeps get mangled in windows, so fix them to more sbsv2 friendly format #if defined(Q_OS_WIN) - if (item.mid(1,1) == ":") - item = item.mid(0,1).toUpper().append(item.mid(1)); // Fix drive to uppercase + if (item.mid(1, 1) == ":") + item = item.mid(0, 1).toUpper().append(item.mid(1)); // Fix drive to uppercase #endif item.replace("\\", "/"); allPreDeps << escapeDependencyPath(item); @@ -278,7 +275,7 @@ bool SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t allPreDeps.append(fileInfo(item).absoluteFilePath()); } - for(QMap<QString, QStringList>::iterator it = sources.begin(); it != sources.end(); ++it) { + for (QMap<QString, QStringList>::iterator it = sources.begin(); it != sources.end(); ++it) { QString currentSourcePath = it.key(); QStringList values = it.value(); for (int i = 0; i < values.size(); ++i) { @@ -299,7 +296,6 @@ bool SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t QString absoluteTarget = fileInfo(targetItem).absoluteFilePath(); if (allPreDeps.contains(absoluteTarget)) { QStringList deps = project->values(QLatin1String("QMAKE_ET_PARSED_DEPS.") + item + targetItem); - //QString depsItem = project->values(QLatin1String("QMAKE_ET_PARSED_DEPS.") + item + targetItem).join(" "); QString commandItem = project->values(QLatin1String("QMAKE_ET_PARSED_CMD.") + item + targetItem).join(" "); @@ -315,7 +311,6 @@ bool SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t t << "START EXTENSION qt/qmake_extra_pre_targetdep" << endl; t << "OPTION PREDEP_TARGET " << absoluteTarget << endl; t << "OPTION DEPS " << absoluteDeps << endl; - //t << "OPTION DEPS " << depsItem << endl; if (commandItem.indexOf("$(INCPATH)") != -1) commandItem.replace("$(INCPATH)", incPath.join(" ")); @@ -336,10 +331,10 @@ bool SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t // Write winscw deployment rules QString remoteTestPath = epocRoot() + QLatin1String("epoc32/winscw/c/private/") + privateDirUid; DeploymentList depList; - initProjectDeploySymbian( project, depList, remoteTestPath, false, QLatin1String("winscw"), QLatin1String("udeb"), generatedDirs, generatedFiles ); + initProjectDeploySymbian(project, depList, remoteTestPath, false, QLatin1String("winscw"), QLatin1String("udeb"), generatedDirs, generatedFiles); t << "#if defined(WINSCW)" << endl; - for (int i=0; i<depList.size(); ++i) { + for (int i = 0; i < depList.size(); ++i) { t << "START EXTENSION qt/qmake_emulator_deployment" << endl; QString fromItem = depList.at(i).from; QString toItem = depList.at(i).to; @@ -357,7 +352,7 @@ bool SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t t << endl; // Write post link rules - if(!project->isEmpty("QMAKE_POST_LINK")) { + if (!project->isEmpty("QMAKE_POST_LINK")) { t << "START EXTENSION qt/qmake_post_link" << endl; t << "OPTION POST_LINK_CMD " << var("QMAKE_POST_LINK") << endl; t << "OPTION LINK_TARGET " << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".").append(getTargetExtension())) << endl; @@ -387,7 +382,7 @@ bool SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t // Generate temp dirs QString tempDirs; - for(QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { + for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { QStringList values = it.value(); for (int i = 0; i < values.size(); ++i) { QString value = values.at(i); @@ -408,8 +403,6 @@ bool SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t t << endl; t << endl; - - return true; } void SymbianSbsv2MakefileGenerator::writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension) diff --git a/qmake/generators/symbian/symmake_sbsv2.h b/qmake/generators/symbian/symmake_sbsv2.h index caa491d..7806d53 100644 --- a/qmake/generators/symbian/symmake_sbsv2.h +++ b/qmake/generators/symbian/symmake_sbsv2.h @@ -1,9 +1,9 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the qmake application of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -51,9 +51,9 @@ class SymbianSbsv2MakefileGenerator : public SymbianMakefileGenerator protected: // Inherited from parent - virtual bool writeBldInfExtensionRulesPart(QTextStream& t); + virtual void writeBldInfExtensionRulesPart(QTextStream& t); virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension); - virtual bool writeMkFile(const QString& wrapperFileName, bool deploymentOnly); + virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly); virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile); public: diff --git a/qmake/generators/win32/msvc_dsp.cpp b/qmake/generators/win32/msvc_dsp.cpp index 44caa68..3668fe2 100644 --- a/qmake/generators/win32/msvc_dsp.cpp +++ b/qmake/generators/win32/msvc_dsp.cpp @@ -682,7 +682,7 @@ void DspMakefileGenerator::writeSubDirs(QTextStream &t) QString profile = tmp; if(!profile.endsWith(Option::dir_sep)) profile += Option::dir_sep; - profile += fi.baseName() + ".pro"; + profile += fi.baseName() + Option::pro_ext; subdirs.append(profile); } else { QMakeProject tmp_proj; diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 9d3fa67..372d902 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -49,9 +49,9 @@ QT_BEGIN_NAMESPACE // XML Tags --------------------------------------------------------- const char _Configuration[] = "Configuration"; const char _Configurations[] = "Configurations"; -const char _File[] = "File"; +const char q_File[] = "File"; const char _FileConfiguration[] = "FileConfiguration"; -const char _Files[] = "Files"; +const char q_Files[] = "Files"; const char _Filter[] = "Filter"; const char _Globals[] = "Globals"; const char _Platform[] = "Platform"; @@ -2402,11 +2402,11 @@ XmlOutput &operator<<(XmlOutput &xml, VCFilter &tool) } for (int i = 0; i < tool.Files.count(); ++i) { const VCFilterFile &info = tool.Files.at(i); - xml << tag(_File) + xml << tag(q_File) << attrS(_RelativePath, Option::fixPathToLocalOS(info.file)) << data(); // In case no custom builds, to avoid "/>" endings tool.outputFileConfig(xml, tool.Files.at(i).file); - xml << closetag(_File); + xml << closetag(q_File); } if (!tool.Name.isEmpty()) xml << closetag(_Filter); @@ -2442,7 +2442,7 @@ XmlOutput &operator<<(XmlOutput &xml, const VCProjectSingleConfig &tool) << tag(_Configurations) << tool.Configuration; xml << closetag(_Configurations) - << tag(_Files); + << tag(q_Files); // Add this configuration into a multi-config project, since that's where we have the flat/tree // XML output functionality VCProject tempProj; @@ -2458,7 +2458,7 @@ XmlOutput &operator<<(XmlOutput &xml, const VCProjectSingleConfig &tool) tempProj.outputFilter(xml, tempProj.ExtraCompilers.at(x)); } tempProj.outputFilter(xml, "RootFiles"); - xml << closetag(_Files) + xml << closetag(q_Files) << tag(_Globals) << data(); // No "/>" end tag return xml; @@ -2513,7 +2513,7 @@ void VCProject::outputFileConfigs(XmlOutput &xml, const VCFilterFile &info, const QString &filtername) { - xml << tag(_File) + xml << tag(q_File) << attrS(_RelativePath, Option::fixPathToLocalOS(info.file)); for (int i = 0; i < SingleProjects.count(); ++i) { VCFilter filter; @@ -2541,7 +2541,7 @@ void VCProject::outputFileConfigs(XmlOutput &xml, if (filter.Config) // only if the filter is not empty filter.outputFileConfig(xml, info.file); } - xml << closetag(_File); + xml << closetag(q_File); } // outputs a given filter for all existing configurations of a project @@ -2636,7 +2636,7 @@ XmlOutput &operator<<(XmlOutput &xml, VCProject &tool) for (int i = 0; i < tool.SingleProjects.count(); ++i) xml << tool.SingleProjects.at(i).Configuration; xml << closetag(_Configurations) - << tag(_Files); + << tag(q_Files); tool.outputFilter(xml, "Sources"); tool.outputFilter(xml, "Headers"); tool.outputFilter(xml, "GeneratedFiles"); @@ -2648,7 +2648,7 @@ XmlOutput &operator<<(XmlOutput &xml, VCProject &tool) tool.outputFilter(xml, tool.ExtraCompilers.at(x)); } tool.outputFilter(xml, "RootFiles"); - xml << closetag(_Files) + xml << closetag(q_Files) << tag(_Globals) << data(); // No "/>" end tag return xml; diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 303e3e1..538b0e7 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -120,14 +120,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) QString rSubkeyPath = keyPath(rSubkey); HKEY handle = 0; - LONG res; - QT_WA( { - res = RegOpenKeyExW(parentHandle, (WCHAR*)rSubkeyPath.utf16(), - 0, KEY_READ, &handle); - } , { - res = RegOpenKeyExA(parentHandle, rSubkeyPath.toLocal8Bit(), - 0, KEY_READ, &handle); - } ); + LONG res = RegOpenKeyEx(parentHandle, (wchar_t*)rSubkeyPath.utf16(), 0, KEY_READ, &handle); if (res != ERROR_SUCCESS) return QString(); @@ -135,11 +128,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) // get the size and type of the value DWORD dataType; DWORD dataSize; - QT_WA( { - res = RegQueryValueExW(handle, (WCHAR*)rSubkeyName.utf16(), 0, &dataType, 0, &dataSize); - }, { - res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, &dataType, 0, &dataSize); - } ); + res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, &dataType, 0, &dataSize); if (res != ERROR_SUCCESS) { RegCloseKey(handle); return QString(); @@ -147,13 +136,8 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) // get the value QByteArray data(dataSize, 0); - QT_WA( { - res = RegQueryValueExW(handle, (WCHAR*)rSubkeyName.utf16(), 0, 0, - reinterpret_cast<unsigned char*>(data.data()), &dataSize); - }, { - res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, 0, - reinterpret_cast<unsigned char*>(data.data()), &dataSize); - } ); + res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, 0, + reinterpret_cast<unsigned char*>(data.data()), &dataSize); if (res != ERROR_SUCCESS) { RegCloseKey(handle); return QString(); @@ -163,11 +147,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) switch (dataType) { case REG_EXPAND_SZ: case REG_SZ: { - QT_WA( { - result = QString::fromUtf16(((const ushort*)data.constData())); - }, { - result = QString::fromLatin1(data.constData()); - } ); + result = QString::fromWCharArray(((const wchar_t *)data.constData())); break; } @@ -175,12 +155,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) QStringList l; int i = 0; for (;;) { - QString s; - QT_WA( { - s = QString::fromUtf16((const ushort*)data.constData() + i); - }, { - s = QString::fromLatin1(data.constData() + i); - } ); + QString s = QString::fromWCharArray((const wchar_t *)data.constData() + i); i += s.length() + 1; if (s.isEmpty()) @@ -193,11 +168,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) case REG_NONE: case REG_BINARY: { - QT_WA( { - result = QString::fromUtf16((const ushort*)data.constData(), data.size()/2); - }, { - result = QString::fromLatin1(data.constData(), data.size()); - } ); + result = QString::fromWCharArray((const wchar_t *)data.constData(), data.size() / 2); break; } @@ -524,7 +495,7 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) QString profile = tmp; if(!profile.endsWith(Option::dir_sep)) profile += Option::dir_sep; - profile += fi.baseName() + ".pro"; + profile += fi.baseName() + Option::pro_ext; subdirs.append(profile); } else { QMakeProject tmp_proj; @@ -1268,9 +1239,8 @@ void VcprojGenerator::initDeploymentTool() foreach(QString item, project->values("DEPLOYMENT")) { // get item.path QString devicePath = project->first(item + ".path"); - // if the path does not exist, skip it if (devicePath.isEmpty()) - continue; + devicePath = targetPath; // check if item.path is relative (! either /,\ or %) if (!(devicePath.at(0) == QLatin1Char('/') || devicePath.at(0) == QLatin1Char('\\') diff --git a/qmake/option.cpp b/qmake/option.cpp index 0e4a608..6ec61ec 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -68,6 +68,7 @@ QString Option::obj_ext; QString Option::lex_ext; QString Option::yacc_ext; QString Option::pro_ext; +QString Option::mmp_ext; QString Option::dir_sep; QString Option::dirlist_sep; QString Option::h_moc_mod; @@ -99,8 +100,6 @@ QStringList Option::shellPath; Option::TARG_MODE Option::target_mode = Option::TARG_WIN_MODE; #elif defined(Q_OS_MAC) Option::TARG_MODE Option::target_mode = Option::TARG_MACX_MODE; -#elif defined(Q_OS_QNX6) -Option::TARG_MODE Option::target_mode = Option::TARG_QNX6_MODE; #else Option::TARG_MODE Option::target_mode = Option::TARG_UNIX_MODE; #endif @@ -381,6 +380,7 @@ Option::init(int argc, char **argv) Option::lex_ext = ".l"; Option::yacc_ext = ".y"; Option::pro_ext = ".pro"; + Option::mmp_ext = ".mmp"; #ifdef Q_OS_WIN Option::dirlist_sep = ";"; Option::shellPath = detectShellPath(); @@ -716,16 +716,9 @@ QString qmake_libraryInfoFile() { QString ret; #if defined( Q_OS_WIN ) - QFileInfo filePath; - QT_WA({ - unsigned short module_name[256]; - GetModuleFileNameW(0, reinterpret_cast<wchar_t *>(module_name), sizeof(module_name)); - filePath = QString::fromUtf16(module_name); - }, { - char module_name[256]; - GetModuleFileNameA(0, module_name, sizeof(module_name)); - filePath = QString::fromLocal8Bit(module_name); - }); + wchar_t module_name[MAX_PATH]; + GetModuleFileName(0, module_name, MAX_PATH); + QFileInfo filePath = QString::fromWCharArray(module_name); ret = filePath.filePath(); #else QString argv0 = QFile::decodeName(QByteArray(Option::application_argv0)); diff --git a/qmake/option.h b/qmake/option.h index 4205b03..b548aa5 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -92,6 +92,7 @@ struct Option static QString dirlist_sep; static QString sysenv_mod; static QString pro_ext; + static QString mmp_ext; static QString res_ext; static char field_sep; static const char *application_argv0; @@ -149,7 +150,7 @@ struct Option static int warn_level; static bool recursive; static QStringList before_user_vars, after_user_vars, user_configs, after_user_configs; - enum TARG_MODE { TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE, TARG_MAC9_MODE, TARG_QNX6_MODE }; + enum TARG_MODE { TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE, TARG_MAC9_MODE }; static TARG_MODE target_mode; static QString user_template, user_template_prefix; static QStringList shellPath; diff --git a/qmake/project.cpp b/qmake/project.cpp index 7c7044c..6bb8b2c 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -597,8 +597,7 @@ static void qmake_error_msg(const QString &msg) msg.toLatin1().constData()); } -enum isForSymbian_enum -{ +enum isForSymbian_enum { isForSymbian_NOT_SET = -1, isForSymbian_FALSE = 0, isForSymbian_ABLD = 1, @@ -705,10 +704,6 @@ QStringList qmake_feature_paths(QMakeProperty *prop=0) concat << base_concat + QDir::separator() + "mac"; concat << base_concat + QDir::separator() + "mac9"; break; - case Option::TARG_QNX6_MODE: //also a unix - concat << base_concat + QDir::separator() + "qnx6"; - concat << base_concat + QDir::separator() + "unix"; - break; } concat << base_concat; } @@ -1606,8 +1601,8 @@ QMakeProject::read(uchar cmd) if(cmd & ReadProFile) { // parse project file debug_msg(1, "Project file: reading %s", pfile.toLatin1().constData()); - if(pfile != "-" && !QFile::exists(pfile) && !pfile.endsWith(".pro")) - pfile += ".pro"; + if(pfile != "-" && !QFile::exists(pfile) && !pfile.endsWith(Option::pro_ext)) + pfile += Option::pro_ext; if(!read(pfile, vars)) return false; } @@ -1707,13 +1702,11 @@ QMakeProject::isActiveConfig(const QString &x, bool regex, QMap<QString, QString return true; //mkspecs - if((Option::target_mode == Option::TARG_MACX_MODE || Option::target_mode == Option::TARG_QNX6_MODE || + if((Option::target_mode == Option::TARG_MACX_MODE || Option::target_mode == Option::TARG_UNIX_MODE) && x == "unix") return !isForSymbian(); else if(Option::target_mode == Option::TARG_MACX_MODE && x == "macx") return !isForSymbian(); - else if(Option::target_mode == Option::TARG_QNX6_MODE && x == "qnx6") - return !isForSymbian(); else if(Option::target_mode == Option::TARG_MAC9_MODE && x == "mac9") return !isForSymbian(); else if((Option::target_mode == Option::TARG_MAC9_MODE || Option::target_mode == Option::TARG_MACX_MODE) && @@ -3261,9 +3254,9 @@ QStringList &QMakeProject::values(const QString &_var, QMap<QString, QStringList ret = "Windows"; } else if(type == "name") { DWORD name_length = 1024; - TCHAR name[1024]; - if(GetComputerName(name, &name_length)) - ret = QString::fromUtf16((ushort*)name, name_length); + wchar_t name[1024]; + if (GetComputerName(name, &name_length)) + ret = QString::fromWCharArray(name); } else if(type == "version" || type == "version_string") { QSysInfo::WinVersion ver = QSysInfo::WindowsVersion; if(type == "version") @@ -3339,10 +3332,10 @@ QStringList &QMakeProject::values(const QString &_var, QMap<QString, QStringList // UIDs starting with 0xE are test UIDs in symbian -QString generate_test_uid(const QString& target) +QString generate_test_uid(const QString& target) { QString tmp = generate_uid(target); - tmp.replace(0,1,"E"); + tmp.replace(0, 1, "E"); tmp.prepend("0x"); return tmp; @@ -3350,38 +3343,38 @@ QString generate_test_uid(const QString& target) // UIDs starting with 0xE are test UIDs in symbian -QString generate_uid(const QString& target) +QString generate_uid(const QString& target) { static QMap<QString, QString> targetToUid; QString tmp = targetToUid[target]; - if(!tmp.isEmpty()) { + if (!tmp.isEmpty()) { return tmp; } unsigned long hash = 5381; int c; - for(int i = 0; i < target.size(); ++i) { + for (int i = 0; i < target.size(); ++i) { c = target.at(i).toAscii(); - hash ^= c + ((c-i) << i%20) + ((c+i) << (i+5)%20) + ((c-2*i) << (i+10)%20) + ((c+2*i) << (i+15)%20); + hash ^= c + ((c - i) << i % 20) + ((c + i) << (i + 5) % 20) + ((c - 2 * i) << (i + 10) % 20) + ((c + 2 * i) << (i + 15) % 20); } tmp.setNum(hash, 16); - for(int i = tmp.size(); i < 8; ++i) + for (int i = tmp.size(); i < 8; ++i) tmp.prepend("0"); #if 0 static QMap<QString, QString> uidConflictCheckList; QString testStr = tmp; - testStr.replace(0,1,"E"); // Simulate actual UID generation + testStr.replace(0, 1, "E"); // Simulate actual UID generation if (uidConflictCheckList.contains(testStr)) { printf("\n\n!!!! generated duplicate uid for %s is %s <-> %s !!!!\n\n\n", - qPrintable(target), - qPrintable(testStr), - qPrintable(uidConflictCheckList.value(testStr))); - } + qPrintable(target), + qPrintable(testStr), + qPrintable(uidConflictCheckList.value(testStr))); + } uidConflictCheckList.insert(testStr, target); printf("generate_uid for %s is %s \n", qPrintable(target), qPrintable(tmp)); #endif @@ -3393,7 +3386,7 @@ QString generate_uid(const QString& target) static void fixEpocRootStr(QString& path) { - path.replace("\\","/"); + path.replace("\\", "/"); if (path.size() > 1 && path[1] == QChar(':')) { path = path.mid(2); @@ -3410,8 +3403,7 @@ static QString epocRootStr; QString epocRoot() { - if (!epocRootStr.isEmpty()) - { + if (!epocRootStr.isEmpty()) { return epocRootStr; } diff --git a/qmake/qmake.pri b/qmake/qmake.pri index f43d933..65bd7d4 100644 --- a/qmake/qmake.pri +++ b/qmake/qmake.pri @@ -68,6 +68,8 @@ bootstrap { #Qt code qmap.cpp \ qmetatype.cpp \ qregexp.cpp \ + qtextcodec.cpp \ + qutfcodec.cpp \ qstring.cpp \ qstringlist.cpp \ qtemporaryfile.cpp \ @@ -107,6 +109,8 @@ bootstrap { #Qt code qmap.h \ qmetatype.h \ qregexp.h \ + qtextcodec.h \ + qutfcodec.h \ qstring.h \ qstringlist.h \ qstringmatcher.h \ diff --git a/qmake/qmake.pro b/qmake/qmake.pro index 594e698..acf7718 100644 --- a/qmake/qmake.pro +++ b/qmake/qmake.pro @@ -15,6 +15,7 @@ MOC_DIR = . VPATH += $$QT_SOURCE_TREE/src/corelib/global \ $$QT_SOURCE_TREE/src/corelib/tools \ $$QT_SOURCE_TREE/src/corelib/kernel \ + $$QT_SOURCE_TREE/src/corelib/codecs \ $$QT_SOURCE_TREE/src/corelib/plugin \ $$QT_SOURCE_TREE/src/corelib/io \ $$QT_SOURCE_TREE/src/corelib/xml \ diff --git a/qmake/qpopen.cpp b/qmake/qpopen.cpp index 7acff92..f2d530d 100644 --- a/qmake/qpopen.cpp +++ b/qmake/qpopen.cpp @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the qmake application of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -59,7 +59,7 @@ bool QPopen::init(const char *command, const char* /* mode */) } // Ensure that the read handle to the child process's pipe for STDOUT is not inherited. - SetHandleInformation( childStdOutR, HANDLE_FLAG_INHERIT, 0); + SetHandleInformation(childStdOutR, HANDLE_FLAG_INHERIT, 0); // Create a pipe for the child process's STDIN. if (! CreatePipe(&childStdInR, &childStdInW, &attributes, 0)) { @@ -67,18 +67,18 @@ bool QPopen::init(const char *command, const char* /* mode */) } // Ensure that the write handle to the child process's pipe for STDIN is not inherited. - SetHandleInformation( childStdInW, HANDLE_FLAG_INHERIT, 0); + SetHandleInformation(childStdInW, HANDLE_FLAG_INHERIT, 0); TCHAR *szCmdLine = new TCHAR[strlen(command)+1]; strcpy(szCmdLine, command); // Set up members of the PROCESS_INFORMATION structure. - ZeroMemory( &processInfo, sizeof(PROCESS_INFORMATION) ); + ZeroMemory(&processInfo, sizeof(PROCESS_INFORMATION)); // Set up members of the STARTUPINFO structure. - ZeroMemory( &siStartInfo, sizeof(STARTUPINFO) ); + ZeroMemory(&siStartInfo, sizeof(STARTUPINFO)); siStartInfo.cb = sizeof(STARTUPINFO); siStartInfo.hStdError = childStdOutW; siStartInfo.hStdOutput = childStdOutW; @@ -88,15 +88,15 @@ bool QPopen::init(const char *command, const char* /* mode */) // Create the child process. bool success = CreateProcess(NULL, - szCmdLine, // command line - NULL, // process security attributes - NULL, // primary thread security attributes - TRUE, // handles are inherited - 0, // creation flags - NULL, // use parent's environment - NULL, // use parent's current directory - &siStartInfo, // STARTUPINFO pointer - &processInfo); // receives PROCESS_INFORMATION + szCmdLine, // command line + NULL, // process security attributes + NULL, // primary thread security attributes + TRUE, // handles are inherited + 0, // creation flags + NULL, // use parent's environment + NULL, // use parent's current directory + &siStartInfo, // STARTUPINFO pointer + &processInfo); // receives PROCESS_INFORMATION delete szCmdLine; @@ -118,7 +118,7 @@ int QPopen::fwrite(char* buffer, int maxBytes) DWORD bytesWritten; bool success = WriteFile(childStdInW, buffer, maxBytes, &bytesWritten, NULL); - if(success) { + if (success) { return bytesWritten; } @@ -129,11 +129,11 @@ int QPopen::fread(char* buffer, int maxBytes) { DWORD bytesRead; - if( !CloseHandle(childStdOutW) ) + if (!CloseHandle(childStdOutW)) return 0; bool success = ReadFile(childStdOutR, buffer, maxBytes, &bytesRead, NULL); - if(success) + if (success) return bytesRead; return 0; diff --git a/qmake/qpopen.h b/qmake/qpopen.h index e15830d..f979c97 100644 --- a/qmake/qpopen.h +++ b/qmake/qpopen.h @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the qmake application of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ |