mirror of
https://github.com/reactos/CMake.git
synced 2024-12-03 17:11:04 +00:00
4987e17f46
- Move Tarjan algorithm from cmComputeTargetDepends into its own class cmComputeComponentGraph - Use cmComputeComponentGraph to identify the component DAG of link dependencies in cmComputeLinkDepends - Emit non-trivial component members more than once but always in a contiguous group on the link line
77 lines
2.4 KiB
C++
77 lines
2.4 KiB
C++
/*=========================================================================
|
|
|
|
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 cmComputeTargetDepends_h
|
|
#define cmComputeTargetDepends_h
|
|
|
|
#include "cmStandardIncludes.h"
|
|
|
|
#include "cmGraphAdjacencyList.h"
|
|
|
|
#include <stack>
|
|
|
|
class cmComputeComponentGraph;
|
|
class cmGlobalGenerator;
|
|
class cmTarget;
|
|
|
|
/** \class cmComputeTargetDepends
|
|
* \brief Compute global interdependencies among targets.
|
|
*
|
|
* Static libraries may form cycles in the target dependency graph.
|
|
* This class evaluates target dependencies globally and adjusts them
|
|
* to remove cycles while preserving a safe build order.
|
|
*/
|
|
class cmComputeTargetDepends
|
|
{
|
|
public:
|
|
cmComputeTargetDepends(cmGlobalGenerator* gg);
|
|
~cmComputeTargetDepends();
|
|
|
|
bool Compute();
|
|
|
|
std::vector<cmTarget*> const& GetTargets() const { return this->Targets; }
|
|
void GetTargetDirectDepends(cmTarget* t, std::set<cmTarget*>& deps);
|
|
private:
|
|
void CollectTargets();
|
|
void CollectDepends();
|
|
void CollectTargetDepends(int depender_index);
|
|
void AddTargetDepend(int depender_index, const char* dependee_name);
|
|
void ComputeFinalDepends(cmComputeComponentGraph const& ccg);
|
|
|
|
cmGlobalGenerator* GlobalGenerator;
|
|
bool DebugMode;
|
|
|
|
// Collect all targets.
|
|
std::vector<cmTarget*> Targets;
|
|
std::map<cmTarget*, int> TargetIndex;
|
|
|
|
// Represent the target dependency graph. The entry at each
|
|
// top-level index corresponds to a depender whose dependencies are
|
|
// listed.
|
|
typedef cmGraphNodeList NodeList;
|
|
typedef cmGraphAdjacencyList Graph;
|
|
Graph InitialGraph;
|
|
Graph FinalGraph;
|
|
void DisplayGraph(Graph const& graph, const char* name);
|
|
|
|
// Deal with connected components.
|
|
void DisplayComponents(cmComputeComponentGraph const& ccg);
|
|
bool CheckComponents(cmComputeComponentGraph const& ccg);
|
|
void ComplainAboutBadComponent(cmComputeComponentGraph const& ccg, int c);
|
|
};
|
|
|
|
#endif
|