Skip to content

Commit

Permalink
Add GraphViz target
Browse files Browse the repository at this point in the history
  • Loading branch information
Hernán Morales Durand committed Mar 14, 2023
1 parent 9fefc3a commit c2d9efc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
15 changes: 14 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -557,5 +557,18 @@ add_subdirectory(ffiTestLibrary ${CMAKE_CURRENT_BINARY_DIR}/build/ffiTestLibrary
add_third_party_dependencies_per_platform()

# Packaging Setup

include(cmake/packaging.cmake)

# GraphViz Setup
include(cmake/CMakeGraphVizOptions.cmake)
option(BUILD_WITH_GRAPHVIZ "Generate dependency graphs" ON)
if (BUILD_WITH_GRAPHVIZ)
add_custom_target(graphviz ALL
COMMENT "Build GraphViz Dependency Graph"
COMMAND cp ${CMAKE_SOURCE_DIR}/cmake/CMakeGraphVizOptions.cmake .
COMMAND ${CMAKE_COMMAND} "--graphviz=${GRAPHVIZ_GRAPH_NAME}.dot" .
COMMAND dot -Tpng ${GRAPHVIZ_GRAPH_NAME}.dot -o ${GRAPHVIZ_GRAPH_NAME}.png
COMMAND cp ${GRAPHVIZ_GRAPH_NAME}.png ${CMAKE_SOURCE_DIR}/build
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
)
endif()
5 changes: 5 additions & 0 deletions cmake/CMakeGraphVizOptions.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
set(GRAPHVIZ_GRAPH_NAME "Pharo VM Dependencies")
set(GRAPHVIZ_CUSTOM_TARGETS TRUE)
set(GRAPHVIZ_GENERATE_DEPENDERS OFF)
set(GRAPHVIZ_GENERATE_PER_TARGET OFF)
set(GRAPHVIZ_MODULE_LIBS OFF)

0 comments on commit c2d9efc

Please sign in to comment.