[Cmake-commits] [cmake-commits] king committed cmComputeLinkDepends.cxx 1.32 1.33 cmExportFileGenerator.cxx 1.16 1.17 cmTarget.cxx 1.251 1.252 cmTarget.h 1.131 1.132
cmake-commits at cmake.org
cmake-commits at cmake.org
Tue Jul 7 09:45:32 EDT 2009
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv26075/Source
Modified Files:
cmComputeLinkDepends.cxx cmExportFileGenerator.cxx
cmTarget.cxx cmTarget.h
Log Message:
ENH: Simplify cmTarget link interface storage
This makes the LinkInterface struct a member of cmTarget, pimplizes the
config-to-interface map, and stores interface instances by value.
Index: cmTarget.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.h,v
retrieving revision 1.131
retrieving revision 1.132
diff -C 2 -d -r1.131 -r1.132
*** cmTarget.h 7 Jul 2009 11:44:12 -0000 1.131
--- cmTarget.h 7 Jul 2009 13:45:29 -0000 1.132
***************
*** 40,65 ****
};
- struct cmTargetLinkInterface
- {
- // Libraries listed in the interface.
- std::vector<std::string> Libraries;
-
- // Shared library dependencies needed for linking on some platforms.
- std::vector<std::string> SharedDeps;
-
- // Libraries listed for other configurations.
- // Needed only for OLD behavior of CMP0003.
- std::vector<std::string> WrongConfigLibraries;
- };
-
- struct cmTargetLinkInterfaceMap:
- public std::map<cmStdString, cmTargetLinkInterface*>
- {
- typedef std::map<cmStdString, cmTargetLinkInterface*> derived;
- cmTargetLinkInterfaceMap() {}
- cmTargetLinkInterfaceMap(cmTargetLinkInterfaceMap const& r);
- ~cmTargetLinkInterfaceMap();
- };
-
class cmTargetInternals;
class cmTargetInternalPointer
--- 40,43 ----
***************
*** 259,267 ****
bool IsImported() const {return this->IsImportedTarget;}
! /** Get the library interface dependencies. This is the set of
! libraries from which something that links to this target may
! also receive symbols. Returns 0 if the user has not specified
! such dependencies or for static libraries. */
! cmTargetLinkInterface const* GetLinkInterface(const char* config);
/** Strip off leading and trailing whitespace from an item named in
--- 237,259 ----
bool IsImported() const {return this->IsImportedTarget;}
! /** The link interface specifies the transitive librarty
! dependencies and other information needed by targets that link
! to this target. */
! struct LinkInterface
! {
! // Libraries listed in the interface.
! std::vector<std::string> Libraries;
!
! // Shared library dependencies needed for linking on some platforms.
! std::vector<std::string> SharedDeps;
!
! // Libraries listed for other configurations.
! // Needed only for OLD behavior of CMP0003.
! std::vector<std::string> WrongConfigLibraries;
! };
!
! /** Get the link interface for the given configuration. Returns 0
! if the target cannot be linked. */
! LinkInterface const* GetLinkInterface(const char* config);
/** Strip off leading and trailing whitespace from an item named in
***************
*** 534,538 ****
std::string SOName;
std::string ImportLibrary;
! cmTargetLinkInterface LinkInterface;
};
typedef std::map<cmStdString, ImportInfo> ImportInfoMapType;
--- 526,530 ----
std::string SOName;
std::string ImportLibrary;
! cmTarget::LinkInterface LinkInterface;
};
typedef std::map<cmStdString, ImportInfo> ImportInfoMapType;
***************
*** 543,550 ****
cmTargetLinkInformationMap LinkInformation;
! // Link interface.
! cmsys::auto_ptr<cmTargetLinkInterface>
! ComputeLinkInterface(const char* config);
! cmTargetLinkInterfaceMap LinkInterface;
// The cmMakefile instance that owns this target. This should
--- 535,539 ----
cmTargetLinkInformationMap LinkInformation;
! bool ComputeLinkInterface(const char* config, LinkInterface& iface);
// The cmMakefile instance that owns this target. This should
Index: cmComputeLinkDepends.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmComputeLinkDepends.cxx,v
retrieving revision 1.32
retrieving revision 1.33
diff -C 2 -d -r1.32 -r1.33
*** cmComputeLinkDepends.cxx 6 Jul 2009 20:25:19 -0000 1.32
--- cmComputeLinkDepends.cxx 7 Jul 2009 13:45:22 -0000 1.33
***************
*** 357,361 ****
{
// Follow the target dependencies.
! if(cmTargetLinkInterface const* iface =
entry.Target->GetLinkInterface(this->Config))
{
--- 357,361 ----
{
// Follow the target dependencies.
! if(cmTarget::LinkInterface const* iface =
entry.Target->GetLinkInterface(this->Config))
{
***************
*** 432,436 ****
if(entry.Target)
{
! if(cmTargetLinkInterface const* iface =
entry.Target->GetLinkInterface(this->Config))
{
--- 432,436 ----
if(entry.Target)
{
! if(cmTarget::LinkInterface const* iface =
entry.Target->GetLinkInterface(this->Config))
{
Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.251
retrieving revision 1.252
diff -C 2 -d -r1.251 -r1.252
*** cmTarget.cxx 7 Jul 2009 11:44:11 -0000 1.251
--- cmTarget.cxx 7 Jul 2009 13:45:26 -0000 1.252
***************
*** 50,53 ****
--- 50,62 ----
// The backtrace when the target was created.
cmListFileBacktrace Backtrace;
+
+ // Cache link interface computation from each configuration.
+ struct OptionalLinkInterface: public cmTarget::LinkInterface
+ {
+ OptionalLinkInterface(): Exists(false) {}
+ bool Exists;
+ };
+ typedef std::map<cmStdString, OptionalLinkInterface> LinkInterfaceMapType;
+ LinkInterfaceMapType LinkInterfaceMap;
};
***************
*** 3667,3671 ****
//----------------------------------------------------------------------------
! cmTargetLinkInterface const* cmTarget::GetLinkInterface(const char* config)
{
// Imported targets have their own link interface.
--- 3676,3680 ----
//----------------------------------------------------------------------------
! cmTarget::LinkInterface const* cmTarget::GetLinkInterface(const char* config)
{
// Imported targets have their own link interface.
***************
*** 3688,3712 ****
// Lookup any existing link interface for this configuration.
! std::map<cmStdString, cmTargetLinkInterface*>::iterator
! i = this->LinkInterface.find(config?config:"");
! if(i == this->LinkInterface.end())
{
// Compute the link interface for this configuration.
! cmsys::auto_ptr<cmTargetLinkInterface>
! iface(this->ComputeLinkInterface(config));
// Store the information for this configuration.
! std::map<cmStdString, cmTargetLinkInterface*>::value_type
! entry(config?config:"", 0);
! i = this->LinkInterface.insert(entry).first;
! i->second = iface.release();
}
! return i->second;
}
//----------------------------------------------------------------------------
! cmsys::auto_ptr<cmTargetLinkInterface>
! cmTarget::ComputeLinkInterface(const char* config)
{
// Construct the property name suffix for this configuration.
--- 3697,3719 ----
// Lookup any existing link interface for this configuration.
! cmTargetInternals::LinkInterfaceMapType::iterator
! i = this->Internal->LinkInterfaceMap.find(config?config:"");
! if(i == this->Internal->LinkInterfaceMap.end())
{
// Compute the link interface for this configuration.
! cmTargetInternals::OptionalLinkInterface iface;
! iface.Exists = this->ComputeLinkInterface(config, iface);
// Store the information for this configuration.
! cmTargetInternals::LinkInterfaceMapType::value_type
! entry(config?config:"", iface);
! i = this->Internal->LinkInterfaceMap.insert(entry).first;
}
! return i->second.Exists? &i->second : 0;
}
//----------------------------------------------------------------------------
! bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface)
{
// Construct the property name suffix for this configuration.
***************
*** 3743,3754 ****
if(!explicitLibraries && this->GetType() == cmTarget::EXECUTABLE)
{
! return cmsys::auto_ptr<cmTargetLinkInterface>();
! }
!
! // Allocate the interface.
! cmsys::auto_ptr<cmTargetLinkInterface> iface(new cmTargetLinkInterface);
! if(!iface.get())
! {
! return cmsys::auto_ptr<cmTargetLinkInterface>();
}
--- 3750,3754 ----
if(!explicitLibraries && this->GetType() == cmTarget::EXECUTABLE)
{
! return false;
}
***************
*** 3768,3774 ****
{
// The interface libraries have been explicitly set.
! cmSystemTools::ExpandListArgument(explicitLibraries, iface->Libraries);
for(std::vector<std::string>::const_iterator
! li = iface->Libraries.begin(); li != iface->Libraries.end(); ++li)
{
emitted.insert(*li);
--- 3768,3774 ----
{
// The interface libraries have been explicitly set.
! cmSystemTools::ExpandListArgument(explicitLibraries, iface.Libraries);
for(std::vector<std::string>::const_iterator
! li = iface.Libraries.begin(); li != iface.Libraries.end(); ++li)
{
emitted.insert(*li);
***************
*** 3800,3804 ****
if(doLibraries && !emittedWrongConfig.insert(item).second)
{
! iface->WrongConfigLibraries.push_back(item);
}
continue;
--- 3800,3804 ----
if(doLibraries && !emittedWrongConfig.insert(item).second)
{
! iface.WrongConfigLibraries.push_back(item);
}
continue;
***************
*** 3815,3819 ****
{
// This implementation dependency goes in the implicit interface.
! iface->Libraries.push_back(item);
}
else if(cmTarget* tgt = this->Makefile->FindTargetToUse(item.c_str()))
--- 3815,3819 ----
{
// This implementation dependency goes in the implicit interface.
! iface.Libraries.push_back(item);
}
else if(cmTarget* tgt = this->Makefile->FindTargetToUse(item.c_str()))
***************
*** 3822,3826 ****
if(tgt->GetType() == cmTarget::SHARED_LIBRARY)
{
! iface->SharedDeps.push_back(item);
}
}
--- 3822,3826 ----
if(tgt->GetType() == cmTarget::SHARED_LIBRARY)
{
! iface.SharedDeps.push_back(item);
}
}
***************
*** 3835,3840 ****
}
! // Return the completed interface.
! return iface;
}
--- 3835,3839 ----
}
! return true;
}
***************
*** 3948,3974 ****
//----------------------------------------------------------------------------
- cmTargetLinkInterfaceMap
- ::cmTargetLinkInterfaceMap(cmTargetLinkInterfaceMap const& r): derived()
- {
- // Ideally cmTarget instances should never be copied. However until
- // we can make a sweep to remove that, this copy constructor avoids
- // allowing the resources (LinkInterface) from getting copied. In
- // the worst case this will lead to extra cmTargetLinkInterface
- // instances. We also enforce in debug mode that the map be emptied
- // when copied.
- static_cast<void>(r);
- assert(r.empty());
- }
-
- //----------------------------------------------------------------------------
- cmTargetLinkInterfaceMap::~cmTargetLinkInterfaceMap()
- {
- for(derived::iterator i = this->begin(); i != this->end(); ++i)
- {
- delete i->second;
- }
- }
-
- //----------------------------------------------------------------------------
cmTargetInternalPointer::cmTargetInternalPointer()
{
--- 3947,3950 ----
Index: cmExportFileGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmExportFileGenerator.cxx,v
retrieving revision 1.16
retrieving revision 1.17
diff -C 2 -d -r1.16 -r1.17
*** cmExportFileGenerator.cxx 6 Jul 2009 20:25:19 -0000 1.16
--- cmExportFileGenerator.cxx 7 Jul 2009 13:45:23 -0000 1.17
***************
*** 151,155 ****
// Add the transitive link dependencies for this configuration.
! if(cmTargetLinkInterface const* iface = target->GetLinkInterface(config))
{
this->SetImportLinkProperty(suffix, target,
--- 151,155 ----
// Add the transitive link dependencies for this configuration.
! if(cmTarget::LinkInterface const* iface = target->GetLinkInterface(config))
{
this->SetImportLinkProperty(suffix, target,
More information about the Cmake-commits
mailing list