mirror of
https://github.com/reactos/CMake.git
synced 2024-12-15 07:41:15 +00:00
Enable/disable generating graphs depending on the target type
In CMakeGraphVizOptions.cmake you can now set GRAPHVIZ_EXECUTABLES, GRAPHVIZ_STATIC_LIBS, GRAPHVIZ_SHARED_LIBS and GRAPHVIZ_MODULE_LIBS to TRUE or FALSE depending on whether you want graphs for the targets of the respective types. Alex
This commit is contained in:
parent
84ce612c65
commit
7ba2d36585
@ -50,6 +50,10 @@ cmGraphVizWriter::cmGraphVizWriter(const std::vector<cmLocalGenerator*>&
|
||||
,GraphName("GG")
|
||||
,GraphHeader("node [\n fontsize = \"12\"\n];")
|
||||
,GraphNodePrefix("node")
|
||||
,GenerateForExecutables(true)
|
||||
,GenerateForStaticLibs(true)
|
||||
,GenerateForSharedLibs(true)
|
||||
,GenerateForModuleLibs(true)
|
||||
,LocalGenerators(localGenerators)
|
||||
{
|
||||
int cnt = collectAllTargets();
|
||||
@ -100,6 +104,20 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
|
||||
__set_if_set(this->GraphHeader, "GRAPHVIZ_GRAPH_HEADER");
|
||||
__set_if_set(this->GraphNodePrefix, "GRAPHVIZ_NODE_PREFIX");
|
||||
|
||||
#define __set_bool_if_set(var, cmakeDefinition) \
|
||||
{ \
|
||||
const char* value = mf->GetDefinition(cmakeDefinition); \
|
||||
if ( value ) \
|
||||
{ \
|
||||
var = mf->IsOn(cmakeDefinition); \
|
||||
} \
|
||||
}
|
||||
|
||||
__set_bool_if_set(this->GenerateForExecutables, "GRAPHVIZ_EXECUTABLES");
|
||||
__set_bool_if_set(this->GenerateForStaticLibs, "GRAPHVIZ_STATIC_LIBS");
|
||||
__set_bool_if_set(this->GenerateForSharedLibs, "GRAPHVIZ_SHARED_LIBS");
|
||||
__set_bool_if_set(this->GenerateForModuleLibs , "GRAPHVIZ_MODULE_LIBS");
|
||||
|
||||
this->TargetsToIgnore.clear();
|
||||
const char* ignoreTargets = mf->GetDefinition("GRAPHVIZ_IGNORE_TARGETS");
|
||||
if ( ignoreTargets )
|
||||
@ -129,10 +147,7 @@ void cmGraphVizWriter::WritePerTargetFiles(const char* fileName)
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((ptrIt->second->GetType() != cmTarget::EXECUTABLE)
|
||||
&& (ptrIt->second->GetType() != cmTarget::STATIC_LIBRARY)
|
||||
&& (ptrIt->second->GetType() != cmTarget::SHARED_LIBRARY)
|
||||
&& (ptrIt->second->GetType() != cmTarget::MODULE_LIBRARY))
|
||||
if (this->GenerateForTargetType(ptrIt->second->GetType()) == false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -183,10 +198,7 @@ void cmGraphVizWriter::WriteGlobalFile(const char* fileName)
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((ptrIt->second->GetType() != cmTarget::EXECUTABLE)
|
||||
&& (ptrIt->second->GetType() != cmTarget::STATIC_LIBRARY)
|
||||
&& (ptrIt->second->GetType() != cmTarget::SHARED_LIBRARY)
|
||||
&& (ptrIt->second->GetType() != cmTarget::MODULE_LIBRARY))
|
||||
if (this->GenerateForTargetType(ptrIt->second->GetType()) == false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -368,3 +380,23 @@ bool cmGraphVizWriter::IgnoreThisTarget(const char* name) const
|
||||
{
|
||||
return (this->TargetsToIgnore.find(name) != this->TargetsToIgnore.end());
|
||||
}
|
||||
|
||||
|
||||
bool cmGraphVizWriter::GenerateForTargetType(cmTarget::TargetType targetType)
|
||||
const
|
||||
{
|
||||
switch (targetType)
|
||||
{
|
||||
case cmTarget::EXECUTABLE:
|
||||
return this->GenerateForExecutables;
|
||||
case cmTarget::STATIC_LIBRARY:
|
||||
return this->GenerateForStaticLibs;
|
||||
case cmTarget::SHARED_LIBRARY:
|
||||
return this->GenerateForSharedLibs;
|
||||
case cmTarget::MODULE_LIBRARY:
|
||||
return this->GenerateForModuleLibs;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "cmStandardIncludes.h"
|
||||
#include "cmLocalGenerator.h"
|
||||
#include "cmGeneratedFileStream.h"
|
||||
#include "cmTarget.h"
|
||||
|
||||
|
||||
/** This class implements writing files for graphviz (dot) for graphs
|
||||
@ -52,11 +53,18 @@ protected:
|
||||
|
||||
bool IgnoreThisTarget(const char* name) const;
|
||||
|
||||
bool GenerateForTargetType(cmTarget::TargetType targetType) const;
|
||||
|
||||
cmStdString GraphType;
|
||||
cmStdString GraphName;
|
||||
cmStdString GraphHeader;
|
||||
cmStdString GraphNodePrefix;
|
||||
|
||||
bool GenerateForExecutables;
|
||||
bool GenerateForStaticLibs;
|
||||
bool GenerateForSharedLibs;
|
||||
bool GenerateForModuleLibs;
|
||||
|
||||
const std::vector<cmLocalGenerator*>& LocalGenerators;
|
||||
|
||||
std::map<cmStdString, const cmTarget*> TargetPtrs;
|
||||
|
Loading…
Reference in New Issue
Block a user