Skip to content

Commit

Permalink
Remove tinyxml2 from public dependencies.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
clalancette committed Dec 7, 2023
1 parent 10093ba commit b7c1c87
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
9 changes: 2 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion urdf_parser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ macro(add_urdfdom_library)
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
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)
Expand Down
8 changes: 7 additions & 1 deletion urdf_parser/include/urdf_parser/urdf_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include <string>
#include <vector>

#include <tinyxml2.h>
#include <urdf_model/model.h>
#include <urdf_model/color.h>
#include <urdf_model/utils.h>
Expand All @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions urdf_parser/src/check_urdf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
/* Author: Wim Meeussen */

#include "urdf_parser/urdf_parser.h"

#include <cstring>
#include <iostream>
#include <fstream>

Expand Down
1 change: 1 addition & 0 deletions urdf_parser/src/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <string>
#include "urdf_parser/urdf_parser.h"
#include <console_bridge/console.h>
#include <tinyxml2.h>

namespace urdf{

Expand Down

0 comments on commit b7c1c87

Please sign in to comment.