diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-10-09 17:56:51 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-10-09 17:56:52 +0200 |
commit | 881ceeff428c377d02ae3881beccdbb028385075 (patch) | |
tree | 65bd4335d7f67b81b04e33f2cbb17a41cf966dd8 /qmake | |
parent | b3d2c867ed14cd6337d5e32b8750f198b5b7d331 (diff) | |
parent | 106487387d493dab934e19b33bfed55b8df62d67 (diff) |
Merge remote-tracking branch 'origin/5.4' into dev
Change-Id: I05fcd8dc66d9ad0dc76bb7f5bae05c9876bfba14
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/doc/src/qmake-manual.qdoc | 2 | ||||
-rw-r--r-- | qmake/generators/unix/unixmake.cpp | 2 | ||||
-rw-r--r-- | qmake/generators/unix/unixmake2.cpp | 256 | ||||
-rw-r--r-- | qmake/generators/win32/cesdkhandler.cpp | 2 | ||||
-rw-r--r-- | qmake/generators/win32/msbuild_objectmodel.cpp | 98 | ||||
-rw-r--r-- | qmake/generators/win32/msbuild_objectmodel.h | 20 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_objectmodel.cpp | 59 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_objectmodel.h | 9 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_vcproj.cpp | 8 |
9 files changed, 231 insertions, 225 deletions
diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index dedb491959..cdac770c9d 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -4328,7 +4328,7 @@ This tutorial teaches you the basics of qmake. The other topics in this manual contain more detailed information about using qmake. - \section1 Starting off Simple + \section1 Starting Off Simple Let's assume that you have just finished a basic implementation of your application, and you have created the following files: diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index 4c262125a2..e54ddf8ad7 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -306,8 +306,6 @@ UnixMakefileGenerator::init() } if(!bundle.isEmpty()) { project->values("QMAKE_BUNDLE") = ProStringList(bundle); - project->values("ALL_DEPS") += project->first("QMAKE_PKGINFO"); - project->values("ALL_DEPS") += project->first("QMAKE_BUNDLE_RESOURCE_FILE"); } else { project->values("QMAKE_BUNDLE").clear(); project->values("QMAKE_BUNDLE_LOCATION").clear(); diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 989ec626d3..d9b0e10057 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -430,6 +430,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) } } } + QString allDeps; if (!project->values("QMAKE_APP_FLAG").isEmpty() || project->first("TEMPLATE") == "aux") { QString destdir = project->first("DESTDIR").toQString(); if(!project->isEmpty("QMAKE_BUNDLE")) { @@ -490,8 +491,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) deps.prepend(incr_target_dir + " "); incr_deps = "$(OBJECTS)"; } - t << "all: " << escapeDependencyPath(deps) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS")),""," "," ") << "$(TARGET)" - << endl << endl; //real target t << var("TARGET") << ": " << var("PRE_TARGETDEPS") << " " << incr_deps << " " << target_deps @@ -505,9 +504,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\n\t" << var("QMAKE_POST_LINK"); t << endl << endl; } else { - t << "all: " << escapeDependencyPath(deps) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS")),""," "," ") << "$(TARGET)" - << endl << endl; - t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(OBJECTS) " << target_deps << " " << var("POST_TARGETDEPS") << "\n\t"; if (project->first("TEMPLATE") != "aux") { @@ -521,6 +517,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) } t << endl << endl; } + allDeps = " $(TARGET)"; } else if(!project->isActiveConfig("staticlib")) { QString destdir = unescapeFilePath(project->first("DESTDIR").toQString()), incr_deps; if(!project->isEmpty("QMAKE_BUNDLE")) { @@ -580,19 +577,15 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) incr_deps = "$(OBJECTS)"; } - t << "all: " << escapeDependencyPath(deps) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS")),""," "," ") - << " " << destdir << "$(TARGET)\n\n"; - //real target t << destdir << "$(TARGET): " << var("PRE_TARGETDEPS") << " " << incr_deps << " $(SUBLIBS) " << target_deps << " " << var("POST_TARGETDEPS"); } else { - t << "all: " << escapeDependencyPath(deps) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS")),""," "," ") << " " << - destdir << "$(TARGET)\n\n"; t << destdir << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(OBJECTS) $(SUBLIBS) $(OBJCOMP) " << target_deps << " " << var("POST_TARGETDEPS"); } + allDeps = ' ' + destdir + "$(TARGET)"; if(!destdir.isEmpty()) t << "\n\t" << mkdir_p_asstring(destdir, false); if(!project->isEmpty("QMAKE_PRE_LINK")) @@ -695,9 +688,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) } } else { QString destdir = project->first("DESTDIR").toQString(); - t << "all: " << escapeDependencyPath(deps) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS")),""," "," ") << destdir << "$(TARGET) " - << varGlue("QMAKE_AR_SUBLIBS", destdir, " " + destdir, "") << "\n\n" - << "staticlib: " << destdir << "$(TARGET)\n\n"; + allDeps = ' ' + destdir + "$(TARGET)" + + varGlue("QMAKE_AR_SUBLIBS", ' ' + destdir, ' ' + destdir, ""); + t << "staticlib: " << destdir << "$(TARGET)\n\n"; if(project->isEmpty("QMAKE_AR_SUBLIBS")) { t << destdir << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(OBJECTS) $(OBJCOMP) " << var("POST_TARGETDEPS") << "\n\t"; @@ -763,85 +756,111 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << "@$(QMAKE) -prl " << buildArgs() << " " << project->projectFile() << endl; } - if(!project->first("QMAKE_PKGINFO").isEmpty()) { - ProString pkginfo = escapeFilePath(project->first("QMAKE_PKGINFO")); - QString destdir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents"; - t << pkginfo << ": \n\t"; - if(!destdir.isEmpty()) + if (!project->isEmpty("QMAKE_BUNDLE")) { + QHash<QString, QString> symlinks; + ProStringList &alldeps = project->values("ALL_DEPS"); + QString bundle_dir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/"; + if (!project->first("QMAKE_PKGINFO").isEmpty()) { + ProString pkginfo = escapeFilePath(project->first("QMAKE_PKGINFO")); + bundledFiles << pkginfo; + alldeps << pkginfo; + QString destdir = bundle_dir + "Contents"; + t << pkginfo << ": \n\t"; + if (!destdir.isEmpty()) + t << mkdir_p_asstring(destdir) << "\n\t"; + t << "@$(DEL_FILE) " << pkginfo << "\n\t" + << "@echo \"APPL" + << (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") + ? QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) + << "\" >" << pkginfo << endl; + } + if (!project->first("QMAKE_BUNDLE_RESOURCE_FILE").isEmpty()) { + ProString resources = escapeFilePath(project->first("QMAKE_BUNDLE_RESOURCE_FILE")); + bundledFiles << resources; + alldeps << resources; + QString destdir = bundle_dir + "Contents/Resources"; + t << resources << ": \n\t"; t << mkdir_p_asstring(destdir) << "\n\t"; - t << "@$(DEL_FILE) " << pkginfo << "\n\t" - << "@echo \"APPL" - << (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) - << "\" >" << pkginfo << endl; - } - if(!project->first("QMAKE_BUNDLE_RESOURCE_FILE").isEmpty()) { - ProString resources = escapeFilePath(project->first("QMAKE_BUNDLE_RESOURCE_FILE")); - bundledFiles << resources; - QString destdir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents/Resources"; - t << resources << ": \n\t"; - t << mkdir_p_asstring(destdir) << "\n\t"; - t << "@touch " << resources << "\n\t\n"; - } - if(!project->isEmpty("QMAKE_BUNDLE")) { + t << "@touch " << resources << "\n\t\n"; + } //copy the plist - QString info_plist = escapeFilePath(fileFixify(project->first("QMAKE_INFO_PLIST").toQString())), - info_plist_out = escapeFilePath(project->first("QMAKE_INFO_PLIST_OUT").toQString()); - if (info_plist.isEmpty()) - info_plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE"); - bundledFiles << info_plist_out; - QString destdir = info_plist_out.section(Option::dir_sep, 0, -2); - t << info_plist_out << ": \n\t"; - if(!destdir.isEmpty()) - t << mkdir_p_asstring(destdir, false) << "\n\t"; - ProStringList commonSedArgs; - if (!project->values("VERSION").isEmpty()) - commonSedArgs << "-e \"s,@SHORT_VERSION@," << project->first("VER_MAJ") << "." << project->first("VER_MIN") << ",g\" "; - commonSedArgs << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? - QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "; - if(project->first("TEMPLATE") == "app") { - QString icon = fileFixify(var("ICON")); - QString bundlePrefix = project->first("QMAKE_TARGET_BUNDLE_PREFIX").toQString(); - if (bundlePrefix.isEmpty()) - bundlePrefix = "com.yourcompany"; - if (bundlePrefix.endsWith(".")) - bundlePrefix.chop(1); - QString bundleIdentifier = bundlePrefix + "." + var("QMAKE_BUNDLE"); - if (bundleIdentifier.endsWith(".app")) - bundleIdentifier.chop(4); - t << "@$(DEL_FILE) " << info_plist_out << "\n\t" - << "@sed "; - foreach (const ProString &arg, commonSedArgs) - t << arg; - t << "-e \"s,@ICON@," << icon.section(Option::dir_sep, -1) << ",g\" " - << "-e \"s,@BUNDLEIDENTIFIER@," << bundleIdentifier << ",g\" " - << "-e \"s,@EXECUTABLE@," << var("QMAKE_ORIG_TARGET") << ",g\" " - << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? - QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" " - << "" << info_plist << " >" << info_plist_out << endl; - //copy the icon - if(!project->isEmpty("ICON")) { - QString dir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents/Resources/"; - const QString icon_path = escapeFilePath(dir + icon.section(Option::dir_sep, -1)); - bundledFiles << icon_path; - t << icon_path << ": " << icon << "\n\t" - << mkdir_p_asstring(dir) << "\n\t" - << "@$(DEL_FILE) " << icon_path << "\n\t" - << "@$(COPY_FILE) " << escapeFilePath(icon) << " " << icon_path << endl; + while (!project->isActiveConfig("no_plist")) { // 'while' just to be able to 'break' + QString info_plist = escapeFilePath(fileFixify(project->first("QMAKE_INFO_PLIST").toQString())); + if (info_plist.isEmpty()) + info_plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE"); + if (!exists(Option::fixPathToLocalOS(info_plist))) { + warn_msg(WarnLogic, "Could not resolve Info.plist: '%s'. Check if QMAKE_INFO_PLIST points to a valid file.", + info_plist.toLatin1().constData()); + break; } - } else { - t << "@$(DEL_FILE) " << info_plist_out << "\n\t" - << "@sed "; - foreach (const ProString &arg, commonSedArgs) - t << arg; - t << "-e \"s,@LIBRARY@," << var("QMAKE_ORIG_TARGET") << ",g\" " - << "-e \"s,@TYPEINFO@," - << (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? - QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" " - << "" << info_plist << " >" << info_plist_out << endl; - } + bool isApp = (project->first("TEMPLATE") == "app"); + QString info_plist_out = escapeFilePath( + bundle_dir + (isApp ? "Contents/Info.plist" + : "Versions/" + project->first("QMAKE_FRAMEWORK_VERSION") + + "/Resources/Info.plist")); + bundledFiles << info_plist_out; + alldeps << info_plist_out; + QString destdir = info_plist_out.section(Option::dir_sep, 0, -2); + t << info_plist_out << ": \n\t"; + if (!destdir.isEmpty()) + t << mkdir_p_asstring(destdir, false) << "\n\t"; + ProStringList commonSedArgs; + if (!project->values("VERSION").isEmpty()) { + commonSedArgs << "-e \"s,@SHORT_VERSION@," << project->first("VER_MAJ") << "." + << project->first("VER_MIN") << ",g\" "; + commonSedArgs << "-e \"s,@FULL_VERSION@," << project->first("VER_MAJ") << "." + << project->first("VER_MIN") << "." + << project->first("VER_PAT") << ",g\" "; + } + commonSedArgs << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? + QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "; + if (isApp) { + QString icon = fileFixify(var("ICON")); + QString bundlePrefix = project->first("QMAKE_TARGET_BUNDLE_PREFIX").toQString(); + if (bundlePrefix.isEmpty()) + bundlePrefix = "com.yourcompany"; + if (bundlePrefix.endsWith(".")) + bundlePrefix.chop(1); + QString bundleIdentifier = bundlePrefix + "." + var("QMAKE_BUNDLE"); + if (bundleIdentifier.endsWith(".app")) + bundleIdentifier.chop(4); + t << "@$(DEL_FILE) " << info_plist_out << "\n\t" + << "@sed "; + foreach (const ProString &arg, commonSedArgs) + t << arg; + t << "-e \"s,@ICON@," << icon.section(Option::dir_sep, -1) << ",g\" " + << "-e \"s,@BUNDLEIDENTIFIER@," << bundleIdentifier << ",g\" " + << "-e \"s,@EXECUTABLE@," << var("QMAKE_ORIG_TARGET") << ",g\" " + << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? + QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" " + << "" << info_plist << " >" << info_plist_out << endl; + //copy the icon + if (!project->isEmpty("ICON")) { + QString dir = bundle_dir + "Contents/Resources/"; + const QString icon_path = escapeFilePath(dir + icon.section(Option::dir_sep, -1)); + bundledFiles << icon_path; + alldeps << icon_path; + t << icon_path << ": " << icon << "\n\t" + << mkdir_p_asstring(dir) << "\n\t" + << "@$(DEL_FILE) " << icon_path << "\n\t" + << "@$(COPY_FILE) " << escapeFilePath(icon) << " " << icon_path << endl; + } + } else { + symlinks[bundle_dir + "Resources"] = "Versions/Current/Resources"; + t << "@$(DEL_FILE) " << info_plist_out << "\n\t" + << "@sed "; + foreach (const ProString &arg, commonSedArgs) + t << arg; + t << "-e \"s,@LIBRARY@," << var("QMAKE_ORIG_TARGET") << ",g\" " + << "-e \"s,@TYPEINFO@," + << (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? + QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" " + << "" << info_plist << " >" << info_plist_out << endl; + } + break; + } // project->isActiveConfig("no_plist") //copy other data if(!project->isEmpty("QMAKE_BUNDLE_DATA")) { - QString bundle_dir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/"; const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA"); for(int i = 0; i < bundle_data.count(); i++) { const ProStringList &files = project->values(ProKey(bundle_data[i] + ".files")); @@ -851,11 +870,12 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) if (!project->isEmpty(vkey)) { QString version = project->first(vkey) + "/" + project->first("QMAKE_FRAMEWORK_VERSION") + "/"; - QString link = Option::fixPathToLocalOS(path + project->first(pkey)); - bundledFiles << link; - t << link << ": \n\t" - << mkdir_p_asstring(path) << "\n\t" - << "@$(SYMLINK) " << version << project->first(pkey) << " " << path << endl; + ProString name = project->first(pkey); + int pos = name.indexOf('/'); + if (pos > 0) + name = name.mid(0, pos); + symlinks[Option::fixPathToLocalOS(path + name)] = + project->first(vkey) + "/Current/" + name; path += version; } path += project->first(pkey).toQString(); @@ -868,6 +888,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) src = escapeFilePath(src); const QString dst = escapeFilePath(path + Option::dir_sep + fileInfo(fn).fileName()); bundledFiles << dst; + alldeps << dst; t << dst << ": " << src << "\n\t" << mkdir_p_asstring(path) << "\n\t"; QFileInfo fi(fileInfo(fn)); @@ -880,8 +901,21 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) } } } + QHash<QString, QString>::ConstIterator symIt = symlinks.constBegin(), + symEnd = symlinks.constEnd(); + for (; symIt != symEnd; ++symIt) { + bundledFiles << symIt.key(); + alldeps << symIt.key(); + t << symIt.key() << ":\n\t" + << mkdir_p_asstring(bundle_dir) << "\n\t" + << "@$(SYMLINK) " << symIt.value() << " " << bundle_dir << endl; + } } + t << endl << "all: " << escapeDependencyPath(deps) + << valGlue(escapeDependencyPaths(project->values("ALL_DEPS")), " \\\n\t\t", " \\\n\t\t", "") + << allDeps << endl << endl; + t << "dist: distdir FORCE\n\t"; t << "(cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar)" " && $(MOVE) `dirname $(DISTDIR)`" << Option::dir_sep << "$(DISTNAME).tar.gz ." @@ -1315,44 +1349,6 @@ void UnixMakefileGenerator::init2() project->values("QMAKE_CFLAGS") += MD_flag; project->values("QMAKE_CXXFLAGS") += MD_flag; } - - if(!project->isEmpty("QMAKE_BUNDLE")) { - QString plist = fileFixify(project->first("QMAKE_INFO_PLIST").toQString(), qmake_getpwd()); - if(plist.isEmpty()) - plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE"); - if(exists(Option::fixPathToLocalOS(plist))) { - project->values("QMAKE_INFO_PLIST_OUT").append(project->first("DESTDIR") + - project->first("QMAKE_BUNDLE") + - "/Contents/Info.plist"); - project->values("ALL_DEPS") += project->first("QMAKE_INFO_PLIST_OUT"); - if(!project->isEmpty("ICON") && project->first("TEMPLATE") == "app") - project->values("ALL_DEPS") += project->first("DESTDIR") + - project->first("QMAKE_BUNDLE") + - "/Contents/Resources/" + project->first("ICON").toQString().section('/', -1); - if(!project->isEmpty("QMAKE_BUNDLE_DATA")) { - QString bundle_dir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/"; - ProStringList &alldeps = project->values("ALL_DEPS"); - const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA"); - for(int i = 0; i < bundle_data.count(); i++) { - const ProStringList &files = project->values(ProKey(bundle_data[i] + ".files")); - QString path = bundle_dir; - const ProKey vkey(bundle_data[i] + ".version"); - const ProKey pkey(bundle_data[i] + ".path"); - if (!project->isEmpty(vkey)) { - alldeps += Option::fixPathToLocalOS(path + Option::dir_sep + project->first(pkey)); - path += project->first(vkey) + "/" + - project->first("QMAKE_FRAMEWORK_VERSION") + "/"; - } - path += project->first(pkey); - path = Option::fixPathToLocalOS(path); - for(int file = 0; file < files.count(); file++) - alldeps += path + Option::dir_sep + fileInfo(files[file].toQString()).fileName(); - } - } - } else { - warn_msg(WarnLogic, "Could not resolve Info.plist: '%s'. Check if QMAKE_INFO_PLIST points to a valid file.", plist.toLatin1().constData()); - } - } } QString diff --git a/qmake/generators/win32/cesdkhandler.cpp b/qmake/generators/win32/cesdkhandler.cpp index 97ee4eca09..f2e6758704 100644 --- a/qmake/generators/win32/cesdkhandler.cpp +++ b/qmake/generators/win32/cesdkhandler.cpp @@ -97,7 +97,7 @@ bool CeSdkHandler::parse() return false; } - return m_list.size() > 0 ? true : false; + return m_list.size() > 0; } QString CeSdkHandler::fixPaths(QString path) const diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index 6311128d70..6751dc0f6b 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -341,7 +341,8 @@ static QStringList unquote(const QStringList &values) } // Tree file generation --------------------------------------------- -void XTreeNode::generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCProject &tool, const QString &filter) { +void XTreeNode::generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, + VCProject &tool, const QString &filter, const QString &filterId) { if (children.size()) { // Filter @@ -362,38 +363,39 @@ void XTreeNode::generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString if ((*it)->children.size()) { if ( !tempFilterName.isEmpty() ) - (*it)->generateXML(xml, xmlFilter, it.key(), tool, tempFilterName); + (*it)->generateXML(xml, xmlFilter, it.key(), tool, tempFilterName, filterId); else - (*it)->generateXML(xml, xmlFilter, it.key(), tool, filter); + (*it)->generateXML(xml, xmlFilter, it.key(), tool, filter, filterId); } // Second round, do leafs for (it = children.constBegin(); it != end; ++it) if (!(*it)->children.size()) { if ( !tempFilterName.isEmpty() ) - (*it)->generateXML(xml, xmlFilter, it.key(), tool, tempFilterName); + (*it)->generateXML(xml, xmlFilter, it.key(), tool, tempFilterName, filterId); else - (*it)->generateXML(xml, xmlFilter, it.key(), tool, filter); + (*it)->generateXML(xml, xmlFilter, it.key(), tool, filter, filterId); } } else { // Leaf xml << tag(_ItemGroup); xmlFilter << tag(_ItemGroup); - VCXProjectWriter::outputFileConfigs(tool, xml, xmlFilter, info, filter); + VCXProjectWriter::outputFileConfigs(tool, xml, xmlFilter, info, filter, filterId); xmlFilter << closetag(); xml << closetag(); } } // Flat file generation --------------------------------------------- -void XFlatNode::generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &/*tagName*/, VCProject &tool, const QString &filter) { +void XFlatNode::generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &/*tagName*/, + VCProject &tool, const QString &filter, const QString &filterId) { if (children.size()) { ChildrenMapFlat::ConstIterator it = children.constBegin(); ChildrenMapFlat::ConstIterator end = children.constEnd(); xml << tag(_ItemGroup); xmlFilter << tag(_ItemGroup); for (; it != end; ++it) { - VCXProjectWriter::outputFileConfigs(tool, xml, xmlFilter, (*it), filter); + VCXProjectWriter::outputFileConfigs(tool, xml, xmlFilter, (*it), filter, filterId); } xml << closetag(); xmlFilter << closetag(); @@ -1836,22 +1838,47 @@ void VCXProjectWriter::outputFilter(VCProject &project, XmlOutput &xml, XmlOutpu if (!root->hasElements()) return; - root->generateXML(xml, xmlFilter, "", project, filtername); // output root tree + root->generateXML(xml, xmlFilter, "", project, filtername, filtername); // output root tree } // Output all configurations (by filtername) for a file (by info) // A filters config output is in VCFilter.outputFileConfig() -void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter, const VCFilterFile &info, const QString &filtername) +void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter, + const VCFilterFile &info, const QString &filtername, + const QString &filterId) { // We need to check if the file has any custom build step. // If there is one then it has to be included with "CustomBuild Include" - bool fileAdded = false; + bool hasCustomBuildStep = false; + QVarLengthArray<OutputFilterData> data(project.SingleProjects.count()); + for (int i = 0; i < project.SingleProjects.count(); ++i) { + data[i].filter = project.SingleProjects.at(i).filterByName(filterId); + if (!data[i].filter.Config) // only if the filter is not empty + continue; + VCFilter &filter = data[i].filter; + + // Clearing each filter tool + filter.useCustomBuildTool = false; + filter.useCompilerTool = false; + filter.CustomBuildTool = VCCustomBuildTool(); + filter.CustomBuildTool.config = filter.Config; + filter.CompilerTool = VCCLCompilerTool(); + filter.CompilerTool.config = filter.Config; + VCFilterFile fileInFilter = filter.findFile(info.file, &data[i].inBuild); + data[i].inBuild &= !fileInFilter.excludeFromBuild; + if (data[i].inBuild && filter.addExtraCompiler(fileInFilter)) + hasCustomBuildStep = true; + } + + bool fileAdded = false; for (int i = 0; i < project.SingleProjects.count(); ++i) { - const VCFilter &filter = project.SingleProjects.at(i).filterByName(filtername); - if (filter.Config) // only if the filter is not empty - if (outputFileConfig(filter, xml, xmlFilter, info.file, fileAdded)) // only add it once. - fileAdded = true; + const VCFilter &filter = project.SingleProjects.at(i).filterByName(filterId); + if (!filter.Config) // only if the filter is not empty + continue; + if (outputFileConfig(&data[i], xml, xmlFilter, info.file, fileAdded, + hasCustomBuildStep)) + fileAdded = true; } if ( !fileAdded ) @@ -1861,42 +1888,25 @@ void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, Xml xmlFilter << closetag(); } -bool VCXProjectWriter::outputFileConfig(VCFilter filter, XmlOutput &xml, XmlOutput &xmlFilter, - const QString &filename, bool fileAdded) +bool VCXProjectWriter::outputFileConfig(OutputFilterData *d, XmlOutput &xml, XmlOutput &xmlFilter, + const QString &filename, bool fileAdded, + bool hasCustomBuildStep) { - // Clearing each filter tool - filter.useCustomBuildTool = false; - filter.useCompilerTool = false; - filter.CustomBuildTool = VCCustomBuildTool(); - filter.CustomBuildTool.config = filter.Config; - filter.CompilerTool = VCCLCompilerTool(); - filter.CompilerTool.config = filter.Config; - - bool inBuild = false; - VCFilterFile info; - for (int i = 0; i < filter.Files.count(); ++i) { - if (filter.Files.at(i).file == filename) { - info = filter.Files.at(i); - inBuild = true; - } - } - inBuild &= !info.excludeFromBuild; - - if (inBuild) { - filter.addExtraCompiler(info); + VCFilter &filter = d->filter; + if (d->inBuild) { if (filter.Project->usePCH) - filter.modifyPCHstage(info.file); + filter.modifyPCHstage(filename); } else { // Excluded files uses an empty compiler stage - if(info.excludeFromBuild) + if (d->info.excludeFromBuild) filter.useCompilerTool = true; } // Actual XML output ---------------------------------- - if (filter.useCustomBuildTool || filter.useCompilerTool - || !inBuild || filter.Name.startsWith("Deployment Files")) { + if (hasCustomBuildStep || filter.useCompilerTool + || !d->inBuild || filter.Name.startsWith("Deployment Files")) { - if (filter.useCustomBuildTool) + if (hasCustomBuildStep) { if (!fileAdded) { fileAdded = true; @@ -1925,13 +1935,13 @@ bool VCXProjectWriter::outputFileConfig(VCFilter filter, XmlOutput &xml, XmlOutp } const QString condition = generateCondition(*filter.Config); - if(!inBuild) { + if (!d->inBuild) { xml << tag("ExcludedFromBuild") << attrTag("Condition", condition) << valueTag("true"); } - if (filter.Name.startsWith("Deployment Files") && inBuild) { + if (filter.Name.startsWith("Deployment Files") && d->inBuild) { xml << tag("DeploymentContent") << attrTag("Condition", condition) << valueTag("true"); diff --git a/qmake/generators/win32/msbuild_objectmodel.h b/qmake/generators/win32/msbuild_objectmodel.h index c44897c96a..a562cc364b 100644 --- a/qmake/generators/win32/msbuild_objectmodel.h +++ b/qmake/generators/win32/msbuild_objectmodel.h @@ -56,7 +56,8 @@ public: } virtual void addElement(const QString &filepath, const VCFilterFile &allInfo) = 0; virtual void removeElements()= 0; - virtual void generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCProject &tool, const QString &filter) = 0; + virtual void generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, + VCProject &tool, const QString &filter, const QString &filterId) = 0; virtual bool hasElements() = 0; }; @@ -106,7 +107,8 @@ public: children.clear(); } - void generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCProject &tool, const QString &filter); + void generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCProject &tool, + const QString &filter, const QString &filterId); bool hasElements() { return children.size() != 0; } @@ -146,7 +148,8 @@ public: children.clear(); } - void generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCProject &proj, const QString &filter); + void generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCProject &proj, + const QString &filter, const QString &filterId); bool hasElements() { return children.size() != 0; } @@ -171,10 +174,17 @@ public: void write(XmlOutput &, VCFilter &); private: + struct OutputFilterData + { + VCFilter filter; + VCFilterFile info; + bool inBuild; + }; + static void addFilters(VCProject &project, XmlOutput &xmlFilter, const QString &filterName); static void outputFilter(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter, const QString &filtername); - static void outputFileConfigs(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter, const VCFilterFile &info, const QString &filtername); - static bool outputFileConfig(VCFilter filter, XmlOutput &xml, XmlOutput &xmlFilter, const QString &filename, bool fileAdded); + static void outputFileConfigs(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter, const VCFilterFile &info, const QString &filtername, const QString &filterId); + static bool outputFileConfig(OutputFilterData *d, XmlOutput &xml, XmlOutput &xmlFilter, const QString &filename, bool fileAdded, bool hasCustomBuildStep); static void outputFileConfig(XmlOutput &xml, XmlOutput &xmlFilter, const QString &fileName, const QString &filterName); static QString generateCondition(const VCConfiguration &config); diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 75134d9182..f8e67718f7 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -2241,6 +2241,19 @@ void VCFilter::modifyPCHstage(QString str) CompilerTool.ForcedIncludeFiles = QStringList("$(NOINHERIT)"); } +VCFilterFile VCFilter::findFile(const QString &filePath, bool *found) const +{ + for (int i = 0; i < Files.count(); ++i) { + const VCFilterFile &f = Files.at(i); + if (f.file == filePath) { + *found = true; + return f; + } + } + *found = false; + return VCFilterFile(); +} + bool VCFilter::addExtraCompiler(const VCFilterFile &info) { const QStringList &extraCompilers = Project->extraCompilerSources.value(info.file); @@ -2508,14 +2521,14 @@ void VCProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) // XML output functionality VCProject tempProj; tempProj.SingleProjects += tool; - outputFilter(tempProj, xml, "Sources"); - outputFilter(tempProj, xml, "Headers"); - outputFilter(tempProj, xml, "GeneratedFiles"); - outputFilter(tempProj, xml, "LexYaccFiles"); - outputFilter(tempProj, xml, "TranslationFiles"); - outputFilter(tempProj, xml, "FormFiles"); - outputFilter(tempProj, xml, "ResourceFiles"); - outputFilter(tempProj, xml, "DeploymentFiles"); + outputFilter(tempProj, xml, "Source Files"); + outputFilter(tempProj, xml, "Header Files"); + outputFilter(tempProj, xml, "Generated Files"); + outputFilter(tempProj, xml, "LexYacc Files"); + outputFilter(tempProj, xml, "Translation Files"); + outputFilter(tempProj, xml, "Form Files"); + outputFilter(tempProj, xml, "Resource Files"); + outputFilter(tempProj, xml, "Deployment Files"); QSet<QString> extraCompilersInProject; for (int i = 0; i < tool.ExtraCompilersFiles.count(); ++i) { @@ -2529,7 +2542,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) { outputFilter(tempProj, xml, tempProj.ExtraCompilers.at(x)); } - outputFilter(tempProj, xml, "RootFiles"); + outputFilter(tempProj, xml, "Root Files"); xml << closetag(q_Files) << tag(_Globals) << data(); // No "/>" end tag @@ -2561,18 +2574,18 @@ void VCProjectWriter::write(XmlOutput &xml, VCProject &tool) write(xml, tool.SingleProjects.at(i).Configuration); xml << closetag(_Configurations) << tag(q_Files); - outputFilter(tool, xml, "Sources"); - outputFilter(tool, xml, "Headers"); - outputFilter(tool, xml, "GeneratedFiles"); - outputFilter(tool, xml, "LexYaccFiles"); - outputFilter(tool, xml, "TranslationFiles"); - outputFilter(tool, xml, "FormFiles"); - outputFilter(tool, xml, "ResourceFiles"); - outputFilter(tool, xml, "DeploymentFiles"); + outputFilter(tool, xml, "Source Files"); + outputFilter(tool, xml, "Header Files"); + outputFilter(tool, xml, "Generated Files"); + outputFilter(tool, xml, "LexYacc Files"); + outputFilter(tool, xml, "Translation Files"); + outputFilter(tool, xml, "Form Files"); + outputFilter(tool, xml, "Resource Files"); + outputFilter(tool, xml, "Deployment Files"); for (int x = 0; x < tool.ExtraCompilers.count(); ++x) { outputFilter(tool, xml, tool.ExtraCompilers.at(x)); } - outputFilter(tool, xml, "RootFiles"); + outputFilter(tool, xml, "Root Files"); xml << closetag(q_Files) << tag(_Globals) << data(); // No "/>" end tag @@ -2974,14 +2987,8 @@ void VCProjectWriter::outputFileConfig(VCFilter &filter, XmlOutput &xml, const Q filter.CompilerTool.WarningLevel = warningLevelUnknown; filter.CompilerTool.config = filter.Config; - bool inBuild = false; - VCFilterFile info; - for (int i = 0; i < filter.Files.count(); ++i) { - if (filter.Files.at(i).file == filename) { - info = filter.Files.at(i); - inBuild = true; - } - } + bool inBuild; + VCFilterFile info = filter.findFile(filename, &inBuild); inBuild &= !info.excludeFromBuild; if (inBuild) { diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index ed07b1cca4..850f5f0f57 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h @@ -72,12 +72,6 @@ enum DotNET { forcing the tool to utilize default values. False/True values will be in the output... */ -enum customBuildCheck { - none, - mocSrc, - mocHdr, - lexyacc -}; enum triState { unset = -1, _False = 0, @@ -958,6 +952,7 @@ public: void addFiles(const ProStringList& fileList); bool addExtraCompiler(const VCFilterFile &info); void modifyPCHstage(QString str); + VCFilterFile findFile(const QString &filePath, bool *found) const; // Variables QString Name; @@ -968,8 +963,6 @@ public: VCConfiguration* Config; QList<VCFilterFile> Files; - customBuildCheck CustomBuild; - bool useCustomBuildTool; VCCustomBuildTool CustomBuildTool; diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 739b5cbb3c..24421c6c28 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1346,7 +1346,6 @@ void VcprojGenerator::initDeploymentTool() if (conf.WinRT) { vcProject.DeploymentFiles.Project = this; vcProject.DeploymentFiles.Config = &(vcProject.Configuration); - vcProject.DeploymentFiles.CustomBuild = none; } } } @@ -1385,7 +1384,6 @@ void VcprojGenerator::initRootFiles() vcProject.RootFiles.Project = this; vcProject.RootFiles.Config = &(vcProject.Configuration); - vcProject.RootFiles.CustomBuild = none; } void VcprojGenerator::initSourceFiles() @@ -1398,7 +1396,6 @@ void VcprojGenerator::initSourceFiles() vcProject.SourceFiles.Project = this; vcProject.SourceFiles.Config = &(vcProject.Configuration); - vcProject.SourceFiles.CustomBuild = none; } void VcprojGenerator::initHeaderFiles() @@ -1450,7 +1447,6 @@ void VcprojGenerator::initLexYaccFiles() vcProject.LexYaccFiles.Project = this; vcProject.LexYaccFiles.Config = &(vcProject.Configuration); - vcProject.LexYaccFiles.CustomBuild = lexyacc; } void VcprojGenerator::initTranslationFiles() @@ -1464,7 +1460,6 @@ void VcprojGenerator::initTranslationFiles() vcProject.TranslationFiles.Project = this; vcProject.TranslationFiles.Config = &(vcProject.Configuration); - vcProject.TranslationFiles.CustomBuild = none; } void VcprojGenerator::initFormFiles() @@ -1476,7 +1471,6 @@ void VcprojGenerator::initFormFiles() vcProject.FormFiles.addFiles(project->values("FORMS")); vcProject.FormFiles.Project = this; vcProject.FormFiles.Config = &(vcProject.Configuration); - vcProject.FormFiles.CustomBuild = none; } void VcprojGenerator::initResourceFiles() @@ -1526,7 +1520,6 @@ void VcprojGenerator::initResourceFiles() vcProject.ResourceFiles.Project = this; vcProject.ResourceFiles.Config = &(vcProject.Configuration); - vcProject.ResourceFiles.CustomBuild = none; } void VcprojGenerator::initExtraCompilerOutputs() @@ -1603,7 +1596,6 @@ void VcprojGenerator::initExtraCompilerOutputs() } extraCompile.Project = this; extraCompile.Config = &(vcProject.Configuration); - extraCompile.CustomBuild = none; vcProject.ExtraCompilersFiles.append(extraCompile); } |