From 99c6f58120a5dfd1f9fc36419cd9f9aa0246efde Mon Sep 17 00:00:00 2001 From: Jacob Perron Date: Fri, 15 Jan 2021 09:12:00 -0800 Subject: [PATCH] Put the 'v' back in graphviz (#152) * Renamed the .cpp file. * Add executable correctly spelling graphviz * Add deprecation warning if the old executable name is used. Signed-off-by: Jacob Perron --- urdf_parser/CMakeLists.txt | 8 ++++++-- .../src/{urdf_to_graphiz.cpp => urdf_to_graphviz.cpp} | 10 ++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) rename urdf_parser/src/{urdf_to_graphiz.cpp => urdf_to_graphviz.cpp} (91%) diff --git a/urdf_parser/CMakeLists.txt b/urdf_parser/CMakeLists.txt index 3952064f..65669c6a 100644 --- a/urdf_parser/CMakeLists.txt +++ b/urdf_parser/CMakeLists.txt @@ -21,9 +21,13 @@ set_target_properties(urdfdom_model_state PROPERTIES SOVERSION ${URDF_MAJOR_MINO add_executable(check_urdf src/check_urdf.cpp) target_link_libraries(check_urdf urdfdom_model urdfdom_world) -add_executable(urdf_to_graphiz src/urdf_to_graphiz.cpp) +# Deprecated executable +add_executable(urdf_to_graphiz src/urdf_to_graphviz.cpp) target_link_libraries(urdf_to_graphiz urdfdom_model) +add_executable(urdf_to_graphviz src/urdf_to_graphviz.cpp) +target_link_libraries(urdf_to_graphviz urdfdom_model) + # urdf_mem_test is a binary for testing, not a unit test add_executable(urdf_mem_test test/memtest.cpp) target_link_libraries(urdf_mem_test urdfdom_model) @@ -35,7 +39,7 @@ endif() INSTALL(TARGETS urdfdom_model DESTINATION ${CMAKE_INSTALL_LIBDIR}) INSTALL(TARGETS urdfdom_world DESTINATION ${CMAKE_INSTALL_LIBDIR}) -INSTALL(TARGETS check_urdf urdf_to_graphiz urdf_mem_test +INSTALL(TARGETS check_urdf urdf_to_graphiz urdf_to_graphviz urdf_mem_test DESTINATION ${CMAKE_INSTALL_BINDIR}) INSTALL(TARGETS urdfdom_sensor DESTINATION ${CMAKE_INSTALL_LIBDIR}) INSTALL(TARGETS urdfdom_model_state DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/urdf_parser/src/urdf_to_graphiz.cpp b/urdf_parser/src/urdf_to_graphviz.cpp similarity index 91% rename from urdf_parser/src/urdf_to_graphiz.cpp rename to urdf_parser/src/urdf_to_graphviz.cpp index 5cd3c7f6..4628530c 100644 --- a/urdf_parser/src/urdf_to_graphiz.cpp +++ b/urdf_parser/src/urdf_to_graphviz.cpp @@ -85,15 +85,21 @@ void printTree(LinkConstSharedPtr link, string file) int main(int argc, char** argv) { + std::string executable_name(argv[0]); + std::string deprecated_name("urdf_to_graphiz"); + if (deprecated_name == executable_name.substr(executable_name.size() - deprecated_name.size())) { + std::cerr << "WARNING: The executable named '" << deprecated_name + << "' is deprecated. Use 'urdf_to_graphviz' instead." << std::endl; + } if (argc < 2 || argc > 3) { - std::cerr << "Usage: urdf_to_graphiz input.xml [OUTPUT]" + std::cerr << "Usage: urdf_to_graphviz input.xml [OUTPUT]" << " Will create either $ROBOT_NAME.gv & $ROBOT_NAME.pdf in CWD" << " or OUTPUT.gv & OUTPUT.pdf." << std::endl; return -1; } if (argc != 3) { std::cerr << "WARNING: OUTPUT not given. This type of usage is deprecated!" - << "Usage: urdf_to_graphiz input.xml [OUTPUT]" + << "Usage: urdf_to_graphviz input.xml [OUTPUT]" << " Will create either $ROBOT_NAME.gv & $ROBOT_NAME.pdf in CWD" << " or OUTPUT.gv & OUTPUT.pdf." << std::endl; }