Browse Source

Projucer: Tidy implementation of writeTargetLines

develop
reuk 2 years ago
parent
commit
4478ca797e
No known key found for this signature in database GPG Key ID: FCB43929F012EE5C
1 changed files with 39 additions and 35 deletions
  1. +39
    -35
      extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h

+ 39
- 35
extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h View File

@@ -831,47 +831,51 @@ private:
out << " $(LDFLAGS)" << newLine; out << " $(LDFLAGS)" << newLine;
} }
void writeTargetLines (OutputStream& out, const StringArray& packages) const
void writeLinesForAggregateTarget (OutputStream& out) const
{ {
auto n = targets.size();
for (int i = 0; i < n; ++i)
const auto isPartOfAggregate = [&] (const MakefileTarget* x)
{ {
if (auto* target = targets.getUnchecked (i))
{
if (target->type == build_tools::ProjectType::Target::AggregateTarget)
{
StringArray dependencies;
MemoryOutputStream subTargetLines;
return x != nullptr
&& x->type != build_tools::ProjectType::Target::AggregateTarget
&& x->type != build_tools::ProjectType::Target::SharedCodeTarget;
};
for (int j = 0; j < n; ++j)
{
if (i == j) continue;
if (auto* dependency = targets.getUnchecked (j))
{
if (dependency->type != build_tools::ProjectType::Target::SharedCodeTarget)
{
auto phonyName = dependency->getPhonyName();
subTargetLines << phonyName << " : " << dependency->getBuildProduct() << newLine;
dependencies.add (phonyName);
}
}
}
std::vector<MakefileTarget*> dependencies;
std::copy_if (targets.begin(), targets.end(), std::back_inserter (dependencies), isPartOfAggregate);
out << "all : " << dependencies.joinIntoString (" ") << newLine << newLine;
out << subTargetLines.toString() << newLine << newLine;
}
else
{
if (! getProject().isAudioPluginProject())
out << "all : " << target->getBuildProduct() << newLine << newLine;
out << "all :";
target->writeTargetLine (out, packages);
}
}
for (const auto& d : dependencies)
out << ' ' << d->getPhonyName();
out << newLine << newLine;
for (const auto& d : dependencies)
out << d->getPhonyName() << " : " << d->getBuildProduct() << newLine;
out << newLine << newLine;
}
void writeLinesForTarget (OutputStream& out, const StringArray& packages, MakefileTarget& target) const
{
if (target.type == build_tools::ProjectType::Target::AggregateTarget)
{
writeLinesForAggregateTarget (out);
} }
else
{
if (! getProject().isAudioPluginProject())
out << "all : " << target.getBuildProduct() << newLine << newLine;
target.writeTargetLine (out, packages);
}
}
void writeTargetLines (OutputStream& out, const StringArray& packages) const
{
for (const auto& target : targets)
if (target != nullptr)
writeLinesForTarget (out, packages, *target);
} }
void writeConfig (OutputStream& out, const MakeBuildConfiguration& config) const void writeConfig (OutputStream& out, const MakeBuildConfiguration& config) const


Loading…
Cancel
Save