Xcode: Merge various sources and extra-compilers into more managable groups

Instead of letting each qmake variable have its own auto-generated name
we try to group common variables into similar groups as used by the Xcode
templates provided by Apple.

We also prevent the same files from ending up multiple times in a group.

Change-Id: I73b13d6071bb7b3cd1501c422a99c60743221485
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
This commit is contained in:
Tor Arne Vestbø 2012-11-12 15:48:36 +01:00
parent 0575baac5e
commit a36eaae893

View File

@ -451,18 +451,17 @@ public:
ProjectBuilderSources::ProjectBuilderSources(const QString &k, bool b, ProjectBuilderSources::ProjectBuilderSources(const QString &k, bool b,
const QString &g, const QString &c, bool o) : buildable(b), object_output(o), key(k), group(g), compiler(c) const QString &g, const QString &c, bool o) : buildable(b), object_output(o), key(k), group(g), compiler(c)
{ {
if(group.isNull()) { // Override group name for a few common keys
if(k == "SOURCES") if (k == "SOURCES" || k == "OBJECTIVE_SOURCES" || k == "HEADERS")
group = "Sources"; group = "Sources";
else if(k == "HEADERS")
group = "Headers";
else if (k == "QMAKE_INTERNAL_INCLUDED_FILES") else if (k == "QMAKE_INTERNAL_INCLUDED_FILES")
group = "Sources [qmake]"; group = "Supporting Files";
else if (k == "GENERATED_SOURCES" || k == "GENERATED_FILES") else if (k == "GENERATED_SOURCES" || k == "GENERATED_FILES")
group = "Temporary Sources"; group = "Generated Sources";
else else if (k == "RESOURCES")
fprintf(stderr, "No group available for %s!\n", k.toLatin1().constData()); group = "Resources";
} else if (group.isNull())
group = QString("Sources [") + c + "]";
} }
QStringList QStringList
@ -545,10 +544,6 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
for (ProStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) { for (ProStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) {
if (project->isEmpty(ProKey(*it + ".output"))) if (project->isEmpty(ProKey(*it + ".output")))
continue; continue;
ProString name = *it;
const ProKey nkey(*it + ".name");
if (!project->isEmpty(nkey))
name = project->first(nkey);
const ProStringList &inputs = project->values(ProKey(*it + ".input")); const ProStringList &inputs = project->values(ProKey(*it + ".input"));
for(int input = 0; input < inputs.size(); ++input) { for(int input = 0; input < inputs.size(); ++input) {
if (project->isEmpty(inputs.at(input).toKey())) if (project->isEmpty(inputs.at(input).toKey()))
@ -572,7 +567,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
} }
} }
sources.append(ProjectBuilderSources(inputs.at(input).toQString(), true, sources.append(ProjectBuilderSources(inputs.at(input).toQString(), true,
QString("Sources [") + name + "]", (*it).toQString(), isObj)); QString(), (*it).toQString(), isObj));
} }
} }
} }
@ -618,12 +613,17 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
} }
last_grp = new_grp; last_grp = new_grp;
} }
if (groups[last_grp].contains(src_key))
continue;
groups[last_grp] += src_key; groups[last_grp] += src_key;
in_root = false; in_root = false;
} }
} }
if(in_root) if (in_root) {
if (src_list.contains(src_key))
continue;
src_list.append(src_key); src_list.append(src_key);
}
//source reference //source reference
t << "\t\t" << src_key << " = {" << "\n" t << "\t\t" << src_key << " = {" << "\n"
<< "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";" << "\n"