cmTarget: Move link interface libraries struct out.
This commit is contained in:
parent
33df7f36d0
commit
d67584ccc4
|
@ -361,7 +361,7 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe)
|
||||||
if(entry.Target)
|
if(entry.Target)
|
||||||
{
|
{
|
||||||
// Follow the target dependencies.
|
// Follow the target dependencies.
|
||||||
if(cmTarget::LinkInterface const* iface =
|
if(cmLinkInterface const* iface =
|
||||||
entry.Target->GetLinkInterface(this->Config, this->Target->Target))
|
entry.Target->GetLinkInterface(this->Config, this->Target->Target))
|
||||||
{
|
{
|
||||||
const bool isIface =
|
const bool isIface =
|
||||||
|
@ -396,7 +396,7 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe)
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void
|
void
|
||||||
cmComputeLinkDepends
|
cmComputeLinkDepends
|
||||||
::FollowSharedDeps(int depender_index, cmTarget::LinkInterface const* iface,
|
::FollowSharedDeps(int depender_index, cmLinkInterface const* iface,
|
||||||
bool follow_interface)
|
bool follow_interface)
|
||||||
{
|
{
|
||||||
// Follow dependencies if we have not followed them already.
|
// Follow dependencies if we have not followed them already.
|
||||||
|
@ -459,7 +459,7 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep)
|
||||||
// Target items may have their own dependencies.
|
// Target items may have their own dependencies.
|
||||||
if(entry.Target)
|
if(entry.Target)
|
||||||
{
|
{
|
||||||
if(cmTarget::LinkInterface const* iface =
|
if(cmLinkInterface const* iface =
|
||||||
entry.Target->GetLinkInterface(this->Config, this->Target->Target))
|
entry.Target->GetLinkInterface(this->Config, this->Target->Target))
|
||||||
{
|
{
|
||||||
// Follow public and private dependencies transitively.
|
// Follow public and private dependencies transitively.
|
||||||
|
@ -930,7 +930,7 @@ int cmComputeLinkDepends::ComputeComponentCount(NodeList const& nl)
|
||||||
{
|
{
|
||||||
if(cmTarget const* target = this->EntryList[*ni].Target)
|
if(cmTarget const* target = this->EntryList[*ni].Target)
|
||||||
{
|
{
|
||||||
if(cmTarget::LinkInterface const* iface =
|
if(cmLinkInterface const* iface =
|
||||||
target->GetLinkInterface(this->Config, this->Target->Target))
|
target->GetLinkInterface(this->Config, this->Target->Target))
|
||||||
{
|
{
|
||||||
if(iface->Multiplicity > count)
|
if(iface->Multiplicity > count)
|
||||||
|
|
|
@ -102,7 +102,7 @@ private:
|
||||||
std::queue<SharedDepEntry> SharedDepQueue;
|
std::queue<SharedDepEntry> SharedDepQueue;
|
||||||
std::set<int> SharedDepFollowed;
|
std::set<int> SharedDepFollowed;
|
||||||
void FollowSharedDeps(int depender_index,
|
void FollowSharedDeps(int depender_index,
|
||||||
cmTarget::LinkInterface const* iface,
|
cmLinkInterface const* iface,
|
||||||
bool follow_interface = false);
|
bool follow_interface = false);
|
||||||
void QueueSharedDependencies(int depender_index,
|
void QueueSharedDependencies(int depender_index,
|
||||||
std::vector<cmLinkItem> const& deps);
|
std::vector<cmLinkItem> const& deps);
|
||||||
|
|
|
@ -296,7 +296,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
|
||||||
std::set<std::string> &emitted)
|
std::set<std::string> &emitted)
|
||||||
{
|
{
|
||||||
cmGeneratorTarget const* depender = this->Targets[depender_index];
|
cmGeneratorTarget const* depender = this->Targets[depender_index];
|
||||||
if(cmTarget::LinkInterface const* iface =
|
if(cmLinkInterface const* iface =
|
||||||
dependee->Target->GetLinkInterface(config,
|
dependee->Target->GetLinkInterface(config,
|
||||||
depender->Target))
|
depender->Target))
|
||||||
{
|
{
|
||||||
|
|
|
@ -796,7 +796,7 @@ cmExportFileGenerator
|
||||||
std::vector<std::string>& missingTargets)
|
std::vector<std::string>& missingTargets)
|
||||||
{
|
{
|
||||||
// Add the transitive link dependencies for this configuration.
|
// Add the transitive link dependencies for this configuration.
|
||||||
cmTarget::LinkInterface const* iface = target->Target->GetLinkInterface(
|
cmLinkInterface const* iface = target->Target->GetLinkInterface(
|
||||||
config,
|
config,
|
||||||
target->Target);
|
target->Target);
|
||||||
if (!iface)
|
if (!iface)
|
||||||
|
@ -909,7 +909,7 @@ cmExportFileGenerator
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the transitive link dependencies for this configuration.
|
// Add the transitive link dependencies for this configuration.
|
||||||
if(cmTarget::LinkInterface const* iface =
|
if(cmLinkInterface const* iface =
|
||||||
target->Target
|
target->Target
|
||||||
->GetLinkInterface(config, target->Target))
|
->GetLinkInterface(config, target->Target))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1108,7 +1108,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
|
||||||
|
|
||||||
if(isInterfaceProperty)
|
if(isInterfaceProperty)
|
||||||
{
|
{
|
||||||
if(cmTarget::LinkInterfaceLibraries const* iface =
|
if(cmLinkInterfaceLibraries const* iface =
|
||||||
target->GetLinkInterfaceLibraries(context->Config, headTarget, true))
|
target->GetLinkInterfaceLibraries(context->Config, headTarget, true))
|
||||||
{
|
{
|
||||||
linkedTargetsContent =
|
linkedTargetsContent =
|
||||||
|
|
|
@ -1173,7 +1173,7 @@ public:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmTarget::LinkInterface const* iface =
|
cmLinkInterface const* iface =
|
||||||
item.Target->GetLinkInterface(this->Config, this->HeadTarget);
|
item.Target->GetLinkInterface(this->Config, this->HeadTarget);
|
||||||
if(!iface) { return; }
|
if(!iface) { return; }
|
||||||
|
|
||||||
|
@ -1511,7 +1511,7 @@ void processILibs(const std::string& config,
|
||||||
if (item.Target && emitted.insert(item.Target).second)
|
if (item.Target && emitted.insert(item.Target).second)
|
||||||
{
|
{
|
||||||
tgts.push_back(item.Target);
|
tgts.push_back(item.Target);
|
||||||
if(cmTarget::LinkInterfaceLibraries const* iface =
|
if(cmLinkInterfaceLibraries const* iface =
|
||||||
item.Target->GetLinkInterfaceLibraries(config, headTarget, true))
|
item.Target->GetLinkInterfaceLibraries(config, headTarget, true))
|
||||||
{
|
{
|
||||||
for(std::vector<cmLinkItem>::const_iterator
|
for(std::vector<cmLinkItem>::const_iterator
|
||||||
|
|
|
@ -56,4 +56,44 @@ struct cmLinkImplementationLibraries
|
||||||
std::vector<cmLinkItem> WrongConfigLibraries;
|
std::vector<cmLinkItem> WrongConfigLibraries;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct cmLinkInterfaceLibraries
|
||||||
|
{
|
||||||
|
// Libraries listed in the interface.
|
||||||
|
std::vector<cmLinkItem> Libraries;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cmLinkInterface: public cmLinkInterfaceLibraries
|
||||||
|
{
|
||||||
|
// Languages whose runtime libraries must be linked.
|
||||||
|
std::vector<std::string> Languages;
|
||||||
|
|
||||||
|
// Shared library dependencies needed for linking on some platforms.
|
||||||
|
std::vector<cmLinkItem> SharedDeps;
|
||||||
|
|
||||||
|
// Number of repetitions of a strongly connected component of two
|
||||||
|
// or more static libraries.
|
||||||
|
int Multiplicity;
|
||||||
|
|
||||||
|
// Libraries listed for other configurations.
|
||||||
|
// Needed only for OLD behavior of CMP0003.
|
||||||
|
std::vector<cmLinkItem> WrongConfigLibraries;
|
||||||
|
|
||||||
|
bool ImplementationIsInterface;
|
||||||
|
|
||||||
|
cmLinkInterface(): Multiplicity(0), ImplementationIsInterface(false) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cmOptionalLinkInterface: public cmLinkInterface
|
||||||
|
{
|
||||||
|
cmOptionalLinkInterface():
|
||||||
|
LibrariesDone(false), AllDone(false),
|
||||||
|
Exists(false), HadHeadSensitiveCondition(false),
|
||||||
|
ExplicitLibraries(0) {}
|
||||||
|
bool LibrariesDone;
|
||||||
|
bool AllDone;
|
||||||
|
bool Exists;
|
||||||
|
bool HadHeadSensitiveCondition;
|
||||||
|
const char* ExplicitLibraries;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -91,31 +91,18 @@ public:
|
||||||
// The backtrace when the target was created.
|
// The backtrace when the target was created.
|
||||||
cmListFileBacktrace Backtrace;
|
cmListFileBacktrace Backtrace;
|
||||||
|
|
||||||
// Cache link interface computation from each configuration.
|
|
||||||
struct OptionalLinkInterface: public cmTarget::LinkInterface
|
|
||||||
{
|
|
||||||
OptionalLinkInterface():
|
|
||||||
LibrariesDone(false), AllDone(false),
|
|
||||||
Exists(false), HadHeadSensitiveCondition(false),
|
|
||||||
ExplicitLibraries(0) {}
|
|
||||||
bool LibrariesDone;
|
|
||||||
bool AllDone;
|
|
||||||
bool Exists;
|
|
||||||
bool HadHeadSensitiveCondition;
|
|
||||||
const char* ExplicitLibraries;
|
|
||||||
};
|
|
||||||
void ComputeLinkInterface(cmTarget const* thisTarget,
|
void ComputeLinkInterface(cmTarget const* thisTarget,
|
||||||
const std::string& config,
|
const std::string& config,
|
||||||
OptionalLinkInterface& iface,
|
cmOptionalLinkInterface& iface,
|
||||||
cmTarget const* head) const;
|
cmTarget const* head) const;
|
||||||
void ComputeLinkInterfaceLibraries(cmTarget const* thisTarget,
|
void ComputeLinkInterfaceLibraries(cmTarget const* thisTarget,
|
||||||
const std::string& config,
|
const std::string& config,
|
||||||
OptionalLinkInterface& iface,
|
cmOptionalLinkInterface &iface,
|
||||||
cmTarget const* head,
|
cmTarget const* head,
|
||||||
bool usage_requirements_only);
|
bool usage_requirements_only);
|
||||||
|
|
||||||
struct HeadToLinkInterfaceMap:
|
struct HeadToLinkInterfaceMap:
|
||||||
public std::map<cmTarget const*, OptionalLinkInterface> {};
|
public std::map<cmTarget const*, cmOptionalLinkInterface> {};
|
||||||
typedef std::map<std::string, HeadToLinkInterfaceMap>
|
typedef std::map<std::string, HeadToLinkInterfaceMap>
|
||||||
LinkInterfaceMapType;
|
LinkInterfaceMapType;
|
||||||
LinkInterfaceMapType LinkInterfaceMap;
|
LinkInterfaceMapType LinkInterfaceMap;
|
||||||
|
@ -4133,8 +4120,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config,
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmTarget::LinkInterface const* cmTarget::GetLinkInterface(
|
cmLinkInterface const* cmTarget::GetLinkInterface(const std::string& config,
|
||||||
const std::string& config,
|
|
||||||
cmTarget const* head) const
|
cmTarget const* head) const
|
||||||
{
|
{
|
||||||
// Imported targets have their own link interface.
|
// Imported targets have their own link interface.
|
||||||
|
@ -4163,7 +4149,7 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(
|
||||||
return &hm.begin()->second;
|
return &hm.begin()->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmTargetInternals::OptionalLinkInterface& iface = hm[head];
|
cmOptionalLinkInterface& iface = hm[head];
|
||||||
if(!iface.LibrariesDone)
|
if(!iface.LibrariesDone)
|
||||||
{
|
{
|
||||||
iface.LibrariesDone = true;
|
iface.LibrariesDone = true;
|
||||||
|
@ -4183,7 +4169,7 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmTarget::LinkInterfaceLibraries const*
|
const cmLinkInterfaceLibraries *
|
||||||
cmTarget::GetLinkInterfaceLibraries(const std::string& config,
|
cmTarget::GetLinkInterfaceLibraries(const std::string& config,
|
||||||
cmTarget const* head,
|
cmTarget const* head,
|
||||||
bool usage_requirements_only) const
|
bool usage_requirements_only) const
|
||||||
|
@ -4216,7 +4202,7 @@ cmTarget::GetLinkInterfaceLibraries(const std::string& config,
|
||||||
return &hm.begin()->second;
|
return &hm.begin()->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmTargetInternals::OptionalLinkInterface& iface = hm[head];
|
cmOptionalLinkInterface& iface = hm[head];
|
||||||
if(!iface.LibrariesDone)
|
if(!iface.LibrariesDone)
|
||||||
{
|
{
|
||||||
iface.LibrariesDone = true;
|
iface.LibrariesDone = true;
|
||||||
|
@ -4228,7 +4214,7 @@ cmTarget::GetLinkInterfaceLibraries(const std::string& config,
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmTarget::LinkInterface const*
|
const cmLinkInterface *
|
||||||
cmTarget::GetImportLinkInterface(const std::string& config,
|
cmTarget::GetImportLinkInterface(const std::string& config,
|
||||||
cmTarget const* headTarget,
|
cmTarget const* headTarget,
|
||||||
bool usage_requirements_only) const
|
bool usage_requirements_only) const
|
||||||
|
@ -4252,7 +4238,7 @@ cmTarget::GetImportLinkInterface(const std::string& config,
|
||||||
return &hm.begin()->second;
|
return &hm.begin()->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmTargetInternals::OptionalLinkInterface& iface = hm[headTarget];
|
cmOptionalLinkInterface& iface = hm[headTarget];
|
||||||
if(!iface.AllDone)
|
if(!iface.AllDone)
|
||||||
{
|
{
|
||||||
iface.AllDone = true;
|
iface.AllDone = true;
|
||||||
|
@ -4275,7 +4261,7 @@ void
|
||||||
cmTargetInternals::ComputeLinkInterfaceLibraries(
|
cmTargetInternals::ComputeLinkInterfaceLibraries(
|
||||||
cmTarget const* thisTarget,
|
cmTarget const* thisTarget,
|
||||||
const std::string& config,
|
const std::string& config,
|
||||||
OptionalLinkInterface& iface,
|
cmOptionalLinkInterface& iface,
|
||||||
cmTarget const* headTarget,
|
cmTarget const* headTarget,
|
||||||
bool usage_requirements_only)
|
bool usage_requirements_only)
|
||||||
{
|
{
|
||||||
|
@ -4423,7 +4409,7 @@ cmTargetInternals::ComputeLinkInterfaceLibraries(
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
|
void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
|
||||||
const std::string& config,
|
const std::string& config,
|
||||||
OptionalLinkInterface& iface,
|
cmOptionalLinkInterface &iface,
|
||||||
cmTarget const* headTarget) const
|
cmTarget const* headTarget) const
|
||||||
{
|
{
|
||||||
if(iface.ExplicitLibraries)
|
if(iface.ExplicitLibraries)
|
||||||
|
|
|
@ -233,39 +233,11 @@ public:
|
||||||
|
|
||||||
void GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const;
|
void GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const;
|
||||||
|
|
||||||
/** The link interface specifies transitive library dependencies and
|
|
||||||
other information needed by targets that link to this target. */
|
|
||||||
struct LinkInterfaceLibraries
|
|
||||||
{
|
|
||||||
// Libraries listed in the interface.
|
|
||||||
std::vector<cmLinkItem> Libraries;
|
|
||||||
};
|
|
||||||
struct LinkInterface: public LinkInterfaceLibraries
|
|
||||||
{
|
|
||||||
// Languages whose runtime libraries must be linked.
|
|
||||||
std::vector<std::string> Languages;
|
|
||||||
|
|
||||||
// Shared library dependencies needed for linking on some platforms.
|
|
||||||
std::vector<cmLinkItem> SharedDeps;
|
|
||||||
|
|
||||||
// Number of repetitions of a strongly connected component of two
|
|
||||||
// or more static libraries.
|
|
||||||
int Multiplicity;
|
|
||||||
|
|
||||||
// Libraries listed for other configurations.
|
|
||||||
// Needed only for OLD behavior of CMP0003.
|
|
||||||
std::vector<cmLinkItem> WrongConfigLibraries;
|
|
||||||
|
|
||||||
bool ImplementationIsInterface;
|
|
||||||
|
|
||||||
LinkInterface(): Multiplicity(0), ImplementationIsInterface(false) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Get the link interface for the given configuration. Returns 0
|
/** Get the link interface for the given configuration. Returns 0
|
||||||
if the target cannot be linked. */
|
if the target cannot be linked. */
|
||||||
LinkInterface const* GetLinkInterface(const std::string& config,
|
cmLinkInterface const* GetLinkInterface(const std::string& config,
|
||||||
cmTarget const* headTarget) const;
|
cmTarget const* headTarget) const;
|
||||||
LinkInterfaceLibraries const*
|
cmLinkInterfaceLibraries const*
|
||||||
GetLinkInterfaceLibraries(const std::string& config,
|
GetLinkInterfaceLibraries(const std::string& config,
|
||||||
cmTarget const* headTarget,
|
cmTarget const* headTarget,
|
||||||
bool usage_requirements_only) const;
|
bool usage_requirements_only) const;
|
||||||
|
@ -592,7 +564,7 @@ private:
|
||||||
ImportInfo& info) const;
|
ImportInfo& info) const;
|
||||||
|
|
||||||
|
|
||||||
LinkInterface const*
|
cmLinkInterface const*
|
||||||
GetImportLinkInterface(const std::string& config, cmTarget const* head,
|
GetImportLinkInterface(const std::string& config, cmTarget const* head,
|
||||||
bool usage_requirements_only) const;
|
bool usage_requirements_only) const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue