Skip to content

Commit

Permalink
Fix build with graphviz 9 (#3345)
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters authored Sep 15, 2023
1 parent f398583 commit 87ac01b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmake/SearchForStuff.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,9 @@ if (NOT GRAPHVIZ_FOUND)
else ()
message (STATUS "Looking for libgraphviz-dev - found")
set (HAVE_GRAPHVIZ ON CACHE BOOL "HAVE GRAPHVIZ" FORCE)
if (${GRAPHVIZ_CGRAPH_PKG_VERSION} VERSION_LESS 9.0)
set(GRAPHVIZ_VERSION_LT_9 TRUE)
endif ()
endif ()

########################################
Expand Down
5 changes: 5 additions & 0 deletions gazebo/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ add_dependencies(gzclient gazebo_gui)
target_compile_definitions(gazebo_gui
PRIVATE BUILDING_DLL_GZ_GUI
)
if (GRAPHVIZ_VERSION_LT_9)
target_compile_definitions(gazebo_gui
PRIVATE GRAPHVIZ_VERSION_LT_9
)
endif()

target_link_libraries(gazebo_gui
libgazebo_client
Expand Down
3 changes: 3 additions & 0 deletions gazebo/gui/qgv/private/QGVCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ class QGVCore
rdr.len = strlen(cp);
rdr.cur = 0;

#ifdef GRAPHVIZ_VERSION_LT_9
// This variable only exists for versions before Graphviz 9.0
disc.mem = &AgMemDisc;
#endif
disc.id = &AgIdDisc;
disc.io = &memIoDisc;
g = agread(&rdr, &disc);
Expand Down

0 comments on commit 87ac01b

Please sign in to comment.