From b7c1c874ee17469e63123c1828322687eaacf67a Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Thu, 7 Dec 2023 14:22:46 +0000 Subject: [PATCH] Remove tinyxml2 from public dependencies. That way, we don't have to export the tinyxml2 dependencies to downstream consumers. It is just a private dependency at that point. Signed-off-by: Chris Lalancette --- CMakeLists.txt | 9 ++------- urdf_parser/CMakeLists.txt | 4 +++- urdf_parser/include/urdf_parser/urdf_parser.h | 8 +++++++- urdf_parser/src/check_urdf.cpp | 2 ++ urdf_parser/src/model.cpp | 1 + 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c01d769f..20812842 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,7 @@ add_subdirectory(urdf_parser) set(PKG_NAME ${PROJECT_NAME}) set(PKG_LIBRARIES urdfdom_sensor urdfdom_model_state urdfdom_model urdfdom_world) -set(PKG_DEPENDS TinyXML2 urdfdom_headers console_bridge) +set(PKG_DEPENDS urdfdom_headers) set(PKG_EXPORTS urdfdom) set(cmake_conf_file "cmake/urdfdom-config") include(CMakePackageConfigHelpers) @@ -86,16 +86,11 @@ install(FILES DESTINATION ${CMAKE_CONFIG_INSTALL_DIR} ) -# Some operating systems (like Ubuntu 22.04) do not provide a default -# way to find TinyXML2. For that reason, this package provides it -install(FILES cmake/FindTinyXML2.cmake - DESTINATION ${CMAKE_CONFIG_INSTALL_DIR}) - install(FILES package.xml DESTINATION share/${PROJECT_NAME}) # Make the package config file set(PKG_DESC "Unified Robot Description Format") -set(PKG_DEPENDS "tinyxml2 urdfdom_headers console_bridge") # make the list separated by spaces instead of ; +set(PKG_DEPENDS "urdfdom_headers") # make the list separated by spaces instead of ; set(PKG_URDF_LIBS "-lurdfdom_sensor -lurdfdom_model_state -lurdfdom_model -lurdfdom_world") set(pkg_conf_file "cmake/pkgconfig/urdfdom.pc") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${pkg_conf_file}.in" "${CMAKE_BINARY_DIR}/${pkg_conf_file}" @ONLY) diff --git a/urdf_parser/CMakeLists.txt b/urdf_parser/CMakeLists.txt index dba9ddab..a375f1fd 100644 --- a/urdf_parser/CMakeLists.txt +++ b/urdf_parser/CMakeLists.txt @@ -10,8 +10,10 @@ macro(add_urdfdom_library) "$") target_link_libraries(${add_urdfdom_library_LIBNAME} PUBLIC ${add_urdfdom_library_LINK} - ${console_bridge_link_libs} ${urdfdom_headers_link_libs} + ) + target_link_libraries(${add_urdfdom_library_LIBNAME} PRIVATE + ${console_bridge_link_libs} tinyxml2::tinyxml2 ) if(NOT CMAKE_CXX_STANDARD) diff --git a/urdf_parser/include/urdf_parser/urdf_parser.h b/urdf_parser/include/urdf_parser/urdf_parser.h index b7419483..0ea27df1 100644 --- a/urdf_parser/include/urdf_parser/urdf_parser.h +++ b/urdf_parser/include/urdf_parser/urdf_parser.h @@ -41,7 +41,6 @@ #include #include -#include #include #include #include @@ -51,6 +50,13 @@ #include "exportdecl.h" +namespace tinyxml2{ + // Forward declaration for APIs that use TinyXML2 structures. + // That way, we don't have to export a TinyXML2 dependency. + class XMLDocument; + class XMLElement; +} + namespace urdf_export_helpers { URDFDOM_DLLAPI std::string values2str(unsigned int count, const double *values, double (*conv)(double) = NULL); diff --git a/urdf_parser/src/check_urdf.cpp b/urdf_parser/src/check_urdf.cpp index 42e0fdac..292e6d20 100644 --- a/urdf_parser/src/check_urdf.cpp +++ b/urdf_parser/src/check_urdf.cpp @@ -35,6 +35,8 @@ /* Author: Wim Meeussen */ #include "urdf_parser/urdf_parser.h" + +#include #include #include diff --git a/urdf_parser/src/model.cpp b/urdf_parser/src/model.cpp index e3592939..fb49ecca 100644 --- a/urdf_parser/src/model.cpp +++ b/urdf_parser/src/model.cpp @@ -40,6 +40,7 @@ #include #include "urdf_parser/urdf_parser.h" #include +#include namespace urdf{