cmTarget: Move link interface libraries struct out.

This commit is contained in:
Stephen Kelly 2015-08-26 19:35:45 +02:00
parent 33df7f36d0
commit d67584ccc4
9 changed files with 65 additions and 67 deletions

View File

@ -361,7 +361,7 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe)
if(entry.Target)
{
// Follow the target dependencies.
if(cmTarget::LinkInterface const* iface =
if(cmLinkInterface const* iface =
entry.Target->GetLinkInterface(this->Config, this->Target->Target))
{
const bool isIface =
@ -396,7 +396,7 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe)
//----------------------------------------------------------------------------
void
cmComputeLinkDepends
::FollowSharedDeps(int depender_index, cmTarget::LinkInterface const* iface,
::FollowSharedDeps(int depender_index, cmLinkInterface const* iface,
bool follow_interface)
{
// 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.
if(entry.Target)
{
if(cmTarget::LinkInterface const* iface =
if(cmLinkInterface const* iface =
entry.Target->GetLinkInterface(this->Config, this->Target->Target))
{
// 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::LinkInterface const* iface =
if(cmLinkInterface const* iface =
target->GetLinkInterface(this->Config, this->Target->Target))
{
if(iface->Multiplicity > count)

View File

@ -102,7 +102,7 @@ private:
std::queue<SharedDepEntry> SharedDepQueue;
std::set<int> SharedDepFollowed;
void FollowSharedDeps(int depender_index,
cmTarget::LinkInterface const* iface,
cmLinkInterface const* iface,
bool follow_interface = false);
void QueueSharedDependencies(int depender_index,
std::vector<cmLinkItem> const& deps);

View File

@ -296,7 +296,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
std::set<std::string> &emitted)
{
cmGeneratorTarget const* depender = this->Targets[depender_index];
if(cmTarget::LinkInterface const* iface =
if(cmLinkInterface const* iface =
dependee->Target->GetLinkInterface(config,
depender->Target))
{

View File

@ -796,7 +796,7 @@ cmExportFileGenerator
std::vector<std::string>& missingTargets)
{
// Add the transitive link dependencies for this configuration.
cmTarget::LinkInterface const* iface = target->Target->GetLinkInterface(
cmLinkInterface const* iface = target->Target->GetLinkInterface(
config,
target->Target);
if (!iface)
@ -909,7 +909,7 @@ cmExportFileGenerator
}
// Add the transitive link dependencies for this configuration.
if(cmTarget::LinkInterface const* iface =
if(cmLinkInterface const* iface =
target->Target
->GetLinkInterface(config, target->Target))
{

View File

@ -1108,7 +1108,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
if(isInterfaceProperty)
{
if(cmTarget::LinkInterfaceLibraries const* iface =
if(cmLinkInterfaceLibraries const* iface =
target->GetLinkInterfaceLibraries(context->Config, headTarget, true))
{
linkedTargetsContent =

View File

@ -1173,7 +1173,7 @@ public:
return;
}
cmTarget::LinkInterface const* iface =
cmLinkInterface const* iface =
item.Target->GetLinkInterface(this->Config, this->HeadTarget);
if(!iface) { return; }
@ -1511,7 +1511,7 @@ void processILibs(const std::string& config,
if (item.Target && emitted.insert(item.Target).second)
{
tgts.push_back(item.Target);
if(cmTarget::LinkInterfaceLibraries const* iface =
if(cmLinkInterfaceLibraries const* iface =
item.Target->GetLinkInterfaceLibraries(config, headTarget, true))
{
for(std::vector<cmLinkItem>::const_iterator

View File

@ -56,4 +56,44 @@ struct cmLinkImplementationLibraries
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

View File

@ -91,31 +91,18 @@ public:
// The backtrace when the target was created.
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,
const std::string& config,
OptionalLinkInterface& iface,
cmOptionalLinkInterface& iface,
cmTarget const* head) const;
void ComputeLinkInterfaceLibraries(cmTarget const* thisTarget,
const std::string& config,
OptionalLinkInterface& iface,
cmOptionalLinkInterface &iface,
cmTarget const* head,
bool usage_requirements_only);
struct HeadToLinkInterfaceMap:
public std::map<cmTarget const*, OptionalLinkInterface> {};
public std::map<cmTarget const*, cmOptionalLinkInterface> {};
typedef std::map<std::string, HeadToLinkInterfaceMap>
LinkInterfaceMapType;
LinkInterfaceMapType LinkInterfaceMap;
@ -4133,8 +4120,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config,
}
//----------------------------------------------------------------------------
cmTarget::LinkInterface const* cmTarget::GetLinkInterface(
const std::string& config,
cmLinkInterface const* cmTarget::GetLinkInterface(const std::string& config,
cmTarget const* head) const
{
// Imported targets have their own link interface.
@ -4163,7 +4149,7 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(
return &hm.begin()->second;
}
cmTargetInternals::OptionalLinkInterface& iface = hm[head];
cmOptionalLinkInterface& iface = hm[head];
if(!iface.LibrariesDone)
{
iface.LibrariesDone = true;
@ -4183,7 +4169,7 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(
}
//----------------------------------------------------------------------------
cmTarget::LinkInterfaceLibraries const*
const cmLinkInterfaceLibraries *
cmTarget::GetLinkInterfaceLibraries(const std::string& config,
cmTarget const* head,
bool usage_requirements_only) const
@ -4216,7 +4202,7 @@ cmTarget::GetLinkInterfaceLibraries(const std::string& config,
return &hm.begin()->second;
}
cmTargetInternals::OptionalLinkInterface& iface = hm[head];
cmOptionalLinkInterface& iface = hm[head];
if(!iface.LibrariesDone)
{
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 const* headTarget,
bool usage_requirements_only) const
@ -4252,7 +4238,7 @@ cmTarget::GetImportLinkInterface(const std::string& config,
return &hm.begin()->second;
}
cmTargetInternals::OptionalLinkInterface& iface = hm[headTarget];
cmOptionalLinkInterface& iface = hm[headTarget];
if(!iface.AllDone)
{
iface.AllDone = true;
@ -4275,7 +4261,7 @@ void
cmTargetInternals::ComputeLinkInterfaceLibraries(
cmTarget const* thisTarget,
const std::string& config,
OptionalLinkInterface& iface,
cmOptionalLinkInterface& iface,
cmTarget const* headTarget,
bool usage_requirements_only)
{
@ -4423,7 +4409,7 @@ cmTargetInternals::ComputeLinkInterfaceLibraries(
//----------------------------------------------------------------------------
void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
const std::string& config,
OptionalLinkInterface& iface,
cmOptionalLinkInterface &iface,
cmTarget const* headTarget) const
{
if(iface.ExplicitLibraries)

View File

@ -233,39 +233,11 @@ public:
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
if the target cannot be linked. */
LinkInterface const* GetLinkInterface(const std::string& config,
cmLinkInterface const* GetLinkInterface(const std::string& config,
cmTarget const* headTarget) const;
LinkInterfaceLibraries const*
cmLinkInterfaceLibraries const*
GetLinkInterfaceLibraries(const std::string& config,
cmTarget const* headTarget,
bool usage_requirements_only) const;
@ -592,7 +564,7 @@ private:
ImportInfo& info) const;
LinkInterface const*
cmLinkInterface const*
GetImportLinkInterface(const std::string& config, cmTarget const* head,
bool usage_requirements_only) const;