Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / cmOrderDirectories.h
blobd6805155ff7613d26ee3b31dac61a845e36c8448
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmOrderDirectories.h,v $
5 Language: C++
6 Date: $Date: 2008-07-29 18:57:00 $
7 Version: $Revision: 1.3 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #ifndef cmOrderDirectories_h
18 #define cmOrderDirectories_h
20 #include "cmStandardIncludes.h"
22 #include <cmsys/RegularExpression.hxx>
24 class cmGlobalGenerator;
25 class cmOrderDirectoriesConstraint;
26 class cmOrderDirectoriesConstraintLibrary;
27 class cmTarget;
29 /** \class cmOrderDirectories
30 * \brief Compute a safe runtime path order for a set of shared libraries.
32 class cmOrderDirectories
34 public:
35 cmOrderDirectories(cmGlobalGenerator* gg, cmTarget* target,
36 const char* purpose);
37 ~cmOrderDirectories();
38 void AddRuntimeLibrary(std::string const& fullPath, const char* soname = 0);
39 void AddLinkLibrary(std::string const& fullPath);
40 void AddUserDirectories(std::vector<std::string> const& extra);
41 void SetImplicitDirectories(std::set<cmStdString> const& implicitDirs);
42 void SetLinkExtensionInfo(std::vector<std::string> const& linkExtensions,
43 std::string const& removeExtRegex);
45 std::vector<std::string> const& GetOrderedDirectories();
46 private:
47 cmGlobalGenerator* GlobalGenerator;
48 cmTarget* Target;
49 std::string Purpose;
51 bool Computed;
53 std::vector<std::string> OrderedDirectories;
55 bool OrderedDirectoriesComputed;
56 std::vector<cmOrderDirectoriesConstraint*> ConstraintEntries;
57 std::vector<cmOrderDirectoriesConstraint*> ImplicitDirEntries;
58 std::vector<std::string> UserDirectories;
59 cmsys::RegularExpression RemoveLibraryExtension;
60 std::vector<std::string> LinkExtensions;
61 std::set<cmStdString> ImplicitDirectories;
62 std::set<cmStdString> EmmittedConstraintSOName;
63 std::set<cmStdString> EmmittedConstraintLibrary;
64 std::vector<std::string> OriginalDirectories;
65 std::map<cmStdString, int> DirectoryIndex;
66 std::vector<int> DirectoryVisited;
67 void CollectOriginalDirectories();
68 int AddOriginalDirectory(std::string const& dir);
69 void FindConflicts();
70 void FindImplicitConflicts();
71 void OrderDirectories();
72 void VisitDirectory(unsigned int i);
73 void DiagnoseCycle();
74 bool CycleDiagnosed;
75 int WalkId;
77 // Adjacency-list representation of runtime path ordering graph.
78 // This maps from directory to those that must come *before* it.
79 // Each entry that must come before is a pair. The first element is
80 // the index of the directory that must come first. The second
81 // element is the index of the runtime library that added the
82 // constraint.
83 typedef std::pair<int, int> ConflictPair;
84 struct ConflictList: public std::vector<ConflictPair> {};
85 std::vector<ConflictList> ConflictGraph;
87 friend class cmOrderDirectoriesConstraint;
88 friend class cmOrderDirectoriesConstraintLibrary;
91 #endif