diff options
author | Brad King <brad.king@kitware.com> | 2008-02-21 16:41:11 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2008-02-21 16:41:11 (GMT) |
commit | fd37a6ec3d31e65eed2dfa88246e86b8d0ab66ab (patch) | |
tree | e40d02f354785ea8c43e90f266cded73bba5f340 /Source/cmOrderDirectories.h | |
parent | 9f2f456e7db1f84cc6d10a64a8e515ad69afbe65 (diff) | |
download | CMake-fd37a6ec3d31e65eed2dfa88246e86b8d0ab66ab.zip CMake-fd37a6ec3d31e65eed2dfa88246e86b8d0ab66ab.tar.gz CMake-fd37a6ec3d31e65eed2dfa88246e86b8d0ab66ab.tar.bz2 |
ENH: Better linker search path computation.
- Use linker search path -L.. -lfoo for lib w/out soname
when platform sets CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME
- Rename cmOrderRuntimeDirectories to cmOrderDirectories
and generalize it for both soname constraints and link
library constraints
- Use cmOrderDirectories to order -L directories based
on all needed constraints
- Avoid processing implicit link directories
- For CMAKE_OLD_LINK_PATHS add constraints from libs
producing them to produce old ordering
Diffstat (limited to 'Source/cmOrderDirectories.h')
-rw-r--r-- | Source/cmOrderDirectories.h | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/Source/cmOrderDirectories.h b/Source/cmOrderDirectories.h new file mode 100644 index 0000000..00a5955 --- /dev/null +++ b/Source/cmOrderDirectories.h @@ -0,0 +1,88 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#ifndef cmOrderDirectories_h +#define cmOrderDirectories_h + +#include "cmStandardIncludes.h" + +#include <cmsys/RegularExpression.hxx> + +class cmGlobalGenerator; +class cmOrderDirectoriesConstraint; +class cmOrderDirectoriesConstraintLibrary; + +/** \class cmOrderDirectories + * \brief Compute a safe runtime path order for a set of shared libraries. + */ +class cmOrderDirectories +{ +public: + cmOrderDirectories(cmGlobalGenerator* gg, const char* name, + const char* purpose); + ~cmOrderDirectories(); + void AddRuntimeLibrary(std::string const& fullPath, const char* soname = 0); + void AddLinkLibrary(std::string const& fullPath); + void AddUserDirectories(std::vector<std::string> const& extra); + void SetImplicitDirectories(std::set<cmStdString> const& implicitDirs); + void SetLinkExtensionInfo(std::vector<std::string> const& linkExtensions, + std::string const& removeExtRegex); + + std::vector<std::string> const& GetOrderedDirectories(); +private: + cmGlobalGenerator* GlobalGenerator; + std::string Name; + std::string Purpose; + + bool Computed; + + std::vector<std::string> OrderedDirectories; + + bool OrderedDirectoriesComputed; + std::vector<cmOrderDirectoriesConstraint*> ConstraintEntries; + std::vector<std::string> UserDirectories; + cmsys::RegularExpression RemoveLibraryExtension; + std::vector<std::string> LinkExtensions; + std::set<cmStdString> ImplicitDirectories; + std::set<cmStdString> EmmittedConstraintSOName; + std::set<cmStdString> EmmittedConstraintLibrary; + std::vector<std::string> OriginalDirectories; + std::map<cmStdString, int> DirectoryIndex; + std::vector<int> DirectoryVisited; + void CollectOriginalDirectories(); + int AddOriginalDirectory(std::string const& dir); + void FindConflicts(); + void OrderDirectories(); + void VisitDirectory(unsigned int i); + void DiagnoseCycle(); + bool CycleDiagnosed; + int WalkId; + + // Adjacency-list representation of runtime path ordering graph. + // This maps from directory to those that must come *before* it. + // Each entry that must come before is a pair. The first element is + // the index of the directory that must come first. The second + // element is the index of the runtime library that added the + // constraint. + typedef std::pair<int, int> ConflictPair; + struct ConflictList: public std::vector<ConflictPair> {}; + std::vector<ConflictList> ConflictGraph; + + friend class cmOrderDirectoriesConstraint; + friend class cmOrderDirectoriesConstraintLibrary; +}; + +#endif |