cmTarget: Cache GetLinkImplementationClosure results
Store them internally and return by reference to avoid duplicate computation.
This commit is contained in:
parent
cbf689c7dd
commit
56aed7005a
@ -170,12 +170,15 @@ public:
|
|||||||
CachedLinkInterfaceSourcesEntries;
|
CachedLinkInterfaceSourcesEntries;
|
||||||
mutable std::map<std::string, std::vector<TargetPropertyEntry*> >
|
mutable std::map<std::string, std::vector<TargetPropertyEntry*> >
|
||||||
CachedLinkInterfaceCompileFeaturesEntries;
|
CachedLinkInterfaceCompileFeaturesEntries;
|
||||||
|
mutable std::map<std::string, std::vector<cmTarget*> >
|
||||||
|
CachedLinkImplementationClosure;
|
||||||
|
|
||||||
mutable std::map<std::string, bool> CacheLinkInterfaceIncludeDirectoriesDone;
|
mutable std::map<std::string, bool> CacheLinkInterfaceIncludeDirectoriesDone;
|
||||||
mutable std::map<std::string, bool> CacheLinkInterfaceCompileDefinitionsDone;
|
mutable std::map<std::string, bool> CacheLinkInterfaceCompileDefinitionsDone;
|
||||||
mutable std::map<std::string, bool> CacheLinkInterfaceCompileOptionsDone;
|
mutable std::map<std::string, bool> CacheLinkInterfaceCompileOptionsDone;
|
||||||
mutable std::map<std::string, bool> CacheLinkInterfaceSourcesDone;
|
mutable std::map<std::string, bool> CacheLinkInterfaceSourcesDone;
|
||||||
mutable std::map<std::string, bool> CacheLinkInterfaceCompileFeaturesDone;
|
mutable std::map<std::string, bool> CacheLinkInterfaceCompileFeaturesDone;
|
||||||
|
mutable std::map<std::string, bool> CacheLinkImplementationClosureDone;
|
||||||
};
|
};
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@ -5206,8 +5209,8 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
|
|||||||
assert((impliedByUse ^ explicitlySet)
|
assert((impliedByUse ^ explicitlySet)
|
||||||
|| (!impliedByUse && !explicitlySet));
|
|| (!impliedByUse && !explicitlySet));
|
||||||
|
|
||||||
std::vector<cmTarget*> deps;
|
std::vector<cmTarget*> const& deps =
|
||||||
tgt->GetLinkImplementationClosure(config, deps);
|
tgt->GetLinkImplementationClosure(config);
|
||||||
|
|
||||||
if(deps.empty())
|
if(deps.empty())
|
||||||
{
|
{
|
||||||
@ -5422,8 +5425,8 @@ bool isLinkDependentProperty(cmTarget const* tgt, const std::string &p,
|
|||||||
const std::string& interfaceProperty,
|
const std::string& interfaceProperty,
|
||||||
const std::string& config)
|
const std::string& config)
|
||||||
{
|
{
|
||||||
std::vector<cmTarget*> deps;
|
std::vector<cmTarget*> const& deps =
|
||||||
tgt->GetLinkImplementationClosure(config, deps);
|
tgt->GetLinkImplementationClosure(config);
|
||||||
|
|
||||||
if(deps.empty())
|
if(deps.empty())
|
||||||
{
|
{
|
||||||
@ -6142,19 +6145,26 @@ void processILibs(const std::string& config,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmTarget::GetLinkImplementationClosure(const std::string& config,
|
std::vector<cmTarget*> const&
|
||||||
std::vector<cmTarget*> &tgts) const
|
cmTarget::GetLinkImplementationClosure(const std::string& config) const
|
||||||
{
|
{
|
||||||
std::set<cmTarget*> emitted;
|
std::vector<cmTarget*>& tgts =
|
||||||
|
this->Internal->CachedLinkImplementationClosure[config];
|
||||||
|
if(!this->Internal->CacheLinkImplementationClosureDone[config])
|
||||||
|
{
|
||||||
|
this->Internal->CacheLinkImplementationClosureDone[config] = true;
|
||||||
|
std::set<cmTarget*> emitted;
|
||||||
|
|
||||||
cmTarget::LinkImplementation const* impl
|
cmTarget::LinkImplementation const* impl
|
||||||
= this->GetLinkImplementationLibraries(config, this);
|
= this->GetLinkImplementationLibraries(config, this);
|
||||||
|
|
||||||
for(std::vector<std::string>::const_iterator it = impl->Libraries.begin();
|
for(std::vector<std::string>::const_iterator it = impl->Libraries.begin();
|
||||||
it != impl->Libraries.end(); ++it)
|
it != impl->Libraries.end(); ++it)
|
||||||
{
|
{
|
||||||
processILibs(config, this, *it, tgts, emitted);
|
processILibs(config, this, *it, tgts , emitted);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return tgts;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -276,8 +276,8 @@ public:
|
|||||||
void GetTransitivePropertyTargets(const std::string& config,
|
void GetTransitivePropertyTargets(const std::string& config,
|
||||||
cmTarget const* headTarget,
|
cmTarget const* headTarget,
|
||||||
std::vector<cmTarget*> &libs) const;
|
std::vector<cmTarget*> &libs) const;
|
||||||
void GetLinkImplementationClosure(const std::string& config,
|
std::vector<cmTarget*> const&
|
||||||
std::vector<cmTarget*> &libs) const;
|
GetLinkImplementationClosure(const std::string& config) const;
|
||||||
|
|
||||||
/** The link implementation specifies the direct library
|
/** The link implementation specifies the direct library
|
||||||
dependencies needed by the object files of the target. */
|
dependencies needed by the object files of the target. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user