BUG: fix some bad changes in progress calc
[cmake.git] / Source / cmComputeTargetDepends.h
blob24bce0928949e44a7d89a07f2570463ecd3727db
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmComputeTargetDepends.h,v $
5 Language: C++
6 Date: $Date: 2008-02-07 21:14:05 $
7 Version: $Revision: 1.2 $
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 cmComputeTargetDepends_h
18 #define cmComputeTargetDepends_h
20 #include "cmStandardIncludes.h"
22 #include "cmGraphAdjacencyList.h"
24 #include <stack>
26 class cmComputeComponentGraph;
27 class cmGlobalGenerator;
28 class cmTarget;
30 /** \class cmComputeTargetDepends
31 * \brief Compute global interdependencies among targets.
33 * Static libraries may form cycles in the target dependency graph.
34 * This class evaluates target dependencies globally and adjusts them
35 * to remove cycles while preserving a safe build order.
37 class cmComputeTargetDepends
39 public:
40 cmComputeTargetDepends(cmGlobalGenerator* gg);
41 ~cmComputeTargetDepends();
43 bool Compute();
45 std::vector<cmTarget*> const& GetTargets() const { return this->Targets; }
46 void GetTargetDirectDepends(cmTarget* t, std::set<cmTarget*>& deps);
47 private:
48 void CollectTargets();
49 void CollectDepends();
50 void CollectTargetDepends(int depender_index);
51 void AddTargetDepend(int depender_index, const char* dependee_name);
52 void ComputeFinalDepends(cmComputeComponentGraph const& ccg);
54 cmGlobalGenerator* GlobalGenerator;
55 bool DebugMode;
57 // Collect all targets.
58 std::vector<cmTarget*> Targets;
59 std::map<cmTarget*, int> TargetIndex;
61 // Represent the target dependency graph. The entry at each
62 // top-level index corresponds to a depender whose dependencies are
63 // listed.
64 typedef cmGraphNodeList NodeList;
65 typedef cmGraphAdjacencyList Graph;
66 Graph InitialGraph;
67 Graph FinalGraph;
68 void DisplayGraph(Graph const& graph, const char* name);
70 // Deal with connected components.
71 void DisplayComponents(cmComputeComponentGraph const& ccg);
72 bool CheckComponents(cmComputeComponentGraph const& ccg);
73 void ComplainAboutBadComponent(cmComputeComponentGraph const& ccg, int c);
76 #endif