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")
|
,GraphName("GG")
|
||||||
,GraphHeader("node [\n fontsize = \"12\"\n];")
|
,GraphHeader("node [\n fontsize = \"12\"\n];")
|
||||||
,GraphNodePrefix("node")
|
,GraphNodePrefix("node")
|
||||||
|
,GenerateForExecutables(true)
|
||||||
|
,GenerateForStaticLibs(true)
|
||||||
|
,GenerateForSharedLibs(true)
|
||||||
|
,GenerateForModuleLibs(true)
|
||||||
,LocalGenerators(localGenerators)
|
,LocalGenerators(localGenerators)
|
||||||
{
|
{
|
||||||
int cnt = collectAllTargets();
|
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->GraphHeader, "GRAPHVIZ_GRAPH_HEADER");
|
||||||
__set_if_set(this->GraphNodePrefix, "GRAPHVIZ_NODE_PREFIX");
|
__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();
|
this->TargetsToIgnore.clear();
|
||||||
const char* ignoreTargets = mf->GetDefinition("GRAPHVIZ_IGNORE_TARGETS");
|
const char* ignoreTargets = mf->GetDefinition("GRAPHVIZ_IGNORE_TARGETS");
|
||||||
if ( ignoreTargets )
|
if ( ignoreTargets )
|
||||||
|
@ -129,10 +147,7 @@ void cmGraphVizWriter::WritePerTargetFiles(const char* fileName)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ptrIt->second->GetType() != cmTarget::EXECUTABLE)
|
if (this->GenerateForTargetType(ptrIt->second->GetType()) == false)
|
||||||
&& (ptrIt->second->GetType() != cmTarget::STATIC_LIBRARY)
|
|
||||||
&& (ptrIt->second->GetType() != cmTarget::SHARED_LIBRARY)
|
|
||||||
&& (ptrIt->second->GetType() != cmTarget::MODULE_LIBRARY))
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -183,10 +198,7 @@ void cmGraphVizWriter::WriteGlobalFile(const char* fileName)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ptrIt->second->GetType() != cmTarget::EXECUTABLE)
|
if (this->GenerateForTargetType(ptrIt->second->GetType()) == false)
|
||||||
&& (ptrIt->second->GetType() != cmTarget::STATIC_LIBRARY)
|
|
||||||
&& (ptrIt->second->GetType() != cmTarget::SHARED_LIBRARY)
|
|
||||||
&& (ptrIt->second->GetType() != cmTarget::MODULE_LIBRARY))
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -368,3 +380,23 @@ bool cmGraphVizWriter::IgnoreThisTarget(const char* name) const
|
||||||
{
|
{
|
||||||
return (this->TargetsToIgnore.find(name) != this->TargetsToIgnore.end());
|
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 "cmStandardIncludes.h"
|
||||||
#include "cmLocalGenerator.h"
|
#include "cmLocalGenerator.h"
|
||||||
#include "cmGeneratedFileStream.h"
|
#include "cmGeneratedFileStream.h"
|
||||||
|
#include "cmTarget.h"
|
||||||
|
|
||||||
|
|
||||||
/** This class implements writing files for graphviz (dot) for graphs
|
/** This class implements writing files for graphviz (dot) for graphs
|
||||||
|
@ -52,11 +53,18 @@ protected:
|
||||||
|
|
||||||
bool IgnoreThisTarget(const char* name) const;
|
bool IgnoreThisTarget(const char* name) const;
|
||||||
|
|
||||||
|
bool GenerateForTargetType(cmTarget::TargetType targetType) const;
|
||||||
|
|
||||||
cmStdString GraphType;
|
cmStdString GraphType;
|
||||||
cmStdString GraphName;
|
cmStdString GraphName;
|
||||||
cmStdString GraphHeader;
|
cmStdString GraphHeader;
|
||||||
cmStdString GraphNodePrefix;
|
cmStdString GraphNodePrefix;
|
||||||
|
|
||||||
|
bool GenerateForExecutables;
|
||||||
|
bool GenerateForStaticLibs;
|
||||||
|
bool GenerateForSharedLibs;
|
||||||
|
bool GenerateForModuleLibs;
|
||||||
|
|
||||||
const std::vector<cmLocalGenerator*>& LocalGenerators;
|
const std::vector<cmLocalGenerator*>& LocalGenerators;
|
||||||
|
|
||||||
std::map<cmStdString, const cmTarget*> TargetPtrs;
|
std::map<cmStdString, const cmTarget*> TargetPtrs;
|
||||||
|
|
Loading…
Reference in New Issue