From 7dd9c3e7f7a9ba43c35cb1e1e281b4fd411d0ae5 Mon Sep 17 00:00:00 2001 From: Joris Vaillant Date: Fri, 12 Jul 2024 12:31:58 +0200 Subject: [PATCH] coal: Don't include hpp/fcl/config.hpp if collision is not enable Split forward declaration in a standalone header to avoid code duplication in sdf/geometry.hxx. --- include/pinocchio/parsers/meshloader-fwd.hpp | 31 ++++++++++++++++++++ include/pinocchio/parsers/sdf/geometry.hxx | 10 +------ include/pinocchio/parsers/urdf.hpp | 24 ++------------- sources.cmake | 1 + 4 files changed, 35 insertions(+), 31 deletions(-) create mode 100644 include/pinocchio/parsers/meshloader-fwd.hpp diff --git a/include/pinocchio/parsers/meshloader-fwd.hpp b/include/pinocchio/parsers/meshloader-fwd.hpp new file mode 100644 index 0000000000..4abb31c973 --- /dev/null +++ b/include/pinocchio/parsers/meshloader-fwd.hpp @@ -0,0 +1,31 @@ +// +// Copyright (c) 2024 INRIA +// + +#ifndef __pinocchio_parsers_meshloader_fwd_hpp__ +#define __pinocchio_parsers_meshloader_fwd_hpp__ + +#include + +#ifdef PINOCCHIO_WITH_HPP_FCL + #include +#endif // PINOCCHIO_WITH_HPP_FCL + +#ifdef COAL_VERSION +namespace coal +{ + class MeshLoader; + typedef std::shared_ptr MeshLoaderPtr; +} // namespace coal +#else +namespace hpp +{ + namespace fcl + { + class MeshLoader; + typedef std::shared_ptr MeshLoaderPtr; + } // namespace fcl +} // namespace hpp +#endif // COAL_VERSION + +#endif // __pinocchio_parsers_meshloader_fwd_hpp__ diff --git a/include/pinocchio/parsers/sdf/geometry.hxx b/include/pinocchio/parsers/sdf/geometry.hxx index c937d425b4..3c5d05015d 100644 --- a/include/pinocchio/parsers/sdf/geometry.hxx +++ b/include/pinocchio/parsers/sdf/geometry.hxx @@ -8,19 +8,11 @@ #include "pinocchio/parsers/config.hpp" #include "pinocchio/parsers/sdf.hpp" #include "pinocchio/parsers/utils.hpp" +#include "pinocchio/parsers/meshloader-fwd.hpp" #include #include -namespace hpp -{ - namespace fcl - { - class MeshLoader; - typedef std::shared_ptr MeshLoaderPtr; - } // namespace fcl -} // namespace hpp - namespace pinocchio { namespace sdf diff --git a/include/pinocchio/parsers/urdf.hpp b/include/pinocchio/parsers/urdf.hpp index 88df76263c..51cbc76197 100644 --- a/include/pinocchio/parsers/urdf.hpp +++ b/include/pinocchio/parsers/urdf.hpp @@ -6,13 +6,11 @@ #ifndef __pinocchio_parsers_urdf_hpp__ #define __pinocchio_parsers_urdf_hpp__ -#include #include "pinocchio/multibody/model.hpp" #include "pinocchio/multibody/geometry.hpp" +#include "pinocchio/parsers/meshloader-fwd.hpp" -#ifdef PINOCCHIO_WITH_CXX11_SUPPORT - #include -#endif +#include /// \cond // forward declaration of the unique type from urdfdom which is expose. @@ -20,24 +18,6 @@ namespace urdf { class ModelInterface; } - -#ifdef COAL_VERSION -namespace coal -{ - class MeshLoader; - typedef std::shared_ptr MeshLoaderPtr; -} // namespace coal -/// \endcond -#else -namespace hpp -{ - namespace fcl - { - class MeshLoader; - typedef std::shared_ptr MeshLoaderPtr; - } // namespace fcl -} // namespace hpp -#endif /// \endcond namespace pinocchio diff --git a/sources.cmake b/sources.cmake index 9f973d17ee..991984996b 100644 --- a/sources.cmake +++ b/sources.cmake @@ -338,6 +338,7 @@ set(${PROJECT_NAME}_PARSERS_SOURCES ${PROJECT_SOURCE_DIR}/src/parsers/mjcf/mjcf-graph-geom.cpp) set(${PROJECT_NAME}_PARSERS_PUBLIC_HEADERS + ${PROJECT_SOURCE_DIR}/include/pinocchio/parsers/meshloader-fwd.hpp ${PROJECT_SOURCE_DIR}/include/pinocchio/parsers/srdf.hpp ${PROJECT_SOURCE_DIR}/include/pinocchio/parsers/srdf.hxx ${PROJECT_SOURCE_DIR}/include/pinocchio/parsers/utils.hpp