Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visibility control headers #286

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions moveit_core/collision_detection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ if(BUILD_TESTING)
target_link_libraries(test_all_valid ${MOVEIT_LIB_NAME} moveit_robot_model)
endif()

# Causes the visibility macros to use dllexport rather than dllimport,
# which is appropriate when building the dll but not consuming it.
target_compile_definitions(${MOVEIT_LIB_NAME} PRIVATE "COLLISION_DETECTION_BUILDING_LIBRARY")

install(TARGETS ${MOVEIT_LIB_NAME}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

#include <moveit/collision_detection/collision_detector_allocator.h>
#include <moveit/collision_detection/allvalid/collision_env_allvalid.h>
#include <moveit/collision_detection/visibility_control.hpp>

namespace collision_detection
{
Expand All @@ -46,6 +47,6 @@ class CollisionDetectorAllocatorAllValid
: public CollisionDetectorAllocatorTemplate<CollisionEnvAllValid, CollisionDetectorAllocatorAllValid>
{
public:
static const std::string NAME; // defined in collision_env_allvalid.cpp
COLLISION_DETECTION_PUBLIC static const std::string NAME; // defined in collision_env_allvalid.cpp
};
} // namespace collision_detection
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Copyright (c) 2019, Open Source Robotics Foundation, Inc.
// All rights reserved.
//
// Software License Agreement (BSD License 2.0)
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Open Source Robotics Foundation, Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COLLISION_DETECTION__VISIBILITY_CONTROL_HPP_
#define COLLISION_DETECTION__VISIBILITY_CONTROL_HPP_

// This logic was borrowed (then namespaced) from the examples on the gcc wiki:
// https://gcc.gnu.org/wiki/Visibility
// clang-format off
#if defined _WIN32 || defined __CYGWIN__
#ifdef __GNUC__
#define COLLISION_DETECTION_EXPORT __attribute__ ((dllexport))
#define COLLISION_DETECTION_IMPORT __attribute__ ((dllimport))
#else
#define COLLISION_DETECTION_EXPORT __declspec(dllexport)
#define COLLISION_DETECTION_IMPORT __declspec(dllimport)
#endif
#ifdef COLLISION_DETECTION_BUILDING_LIBRARY
#define COLLISION_DETECTION_PUBLIC COLLISION_DETECTION_EXPORT
#else
#define COLLISION_DETECTION_PUBLIC COLLISION_DETECTION_IMPORT
#endif
#define COLLISION_DETECTION_PUBLIC_TYPE COLLISION_DETECTION_PUBLIC
#define COLLISION_DETECTION_LOCAL
#else
#define COLLISION_DETECTION_EXPORT __attribute__ ((visibility("default")))
#define COLLISION_DETECTION_IMPORT
#if __GNUC__ >= 4
#define COLLISION_DETECTION_PUBLIC __attribute__ ((visibility("default")))
#define COLLISION_DETECTION_LOCAL __attribute__ ((visibility("hidden")))
#else
#define COLLISION_DETECTION_PUBLIC
#define COLLISION_DETECTION_LOCAL
#endif
#define COLLISION_DETECTION_PUBLIC_TYPE
#endif
// clang-format on
#endif // COLLISION_DETECTION__VISIBILITY_CONTROL_HPP_
4 changes: 4 additions & 0 deletions moveit_core/collision_detection_fcl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ target_link_libraries(${MOVEIT_LIB_NAME}
moveit_collision_detection
)

# Causes the visibility macros to use dllexport rather than dllimport,
# which is appropriate when building the dll but not consuming it.
target_compile_definitions(${MOVEIT_LIB_NAME} PRIVATE "COLLISION_DETECTION_FCL_BUILDING_LIBRARY")

add_library(collision_detector_fcl_plugin SHARED src/collision_detector_fcl_plugin_loader.cpp)
set_target_properties(collision_detector_fcl_plugin PROPERTIES VERSION "${${PROJECT_NAME}_VERSION}")
ament_target_dependencies(collision_detector_fcl_plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

#include <moveit/collision_detection/collision_detector_allocator.h>
#include <moveit/collision_detection_fcl/collision_env_fcl.h>
#include <moveit/collision_detection_fcl/visibility_control.hpp>

namespace collision_detection
{
Expand All @@ -46,6 +47,6 @@ class CollisionDetectorAllocatorFCL
: public CollisionDetectorAllocatorTemplate<CollisionEnvFCL, CollisionDetectorAllocatorFCL>
{
public:
static const std::string NAME; // defined in collision_env_fcl.cpp
COLLISION_DETECTION_FCL_PUBLIC static const std::string NAME; // defined in collision_env_fcl.cpp
};
} // namespace collision_detection
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@

#include <moveit/collision_detection/collision_plugin.h>
#include <moveit/collision_detection_fcl/collision_detector_allocator_fcl.h>
#include <moveit/collision_detection_fcl/visibility_control.hpp>

namespace collision_detection
{
class CollisionDetectorFCLPluginLoader : public CollisionPlugin
class COLLISION_DETECTION_FCL_PLUGIN_PUBLIC CollisionDetectorFCLPluginLoader : public CollisionPlugin
{
public:
bool initialize(const planning_scene::PlanningScenePtr& scene, bool exclusive) const override;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
// Copyright (c) 2019, Open Source Robotics Foundation, Inc.
// All rights reserved.
//
// Software License Agreement (BSD License 2.0)
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Open Source Robotics Foundation, Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COLLISION_DETECTION_FCL__VISIBILITY_CONTROL_HPP_
#define COLLISION_DETECTION_FCL__VISIBILITY_CONTROL_HPP_

// This logic was borrowed (then namespaced) from the examples on the gcc wiki:
// https://gcc.gnu.org/wiki/Visibility

// clang-format off
#if defined _WIN32 || defined __CYGWIN__
#ifdef __GNUC__
#define COLLISION_DETECTION_FCL_EXPORT __attribute__ ((dllexport))
#define COLLISION_DETECTION_FCL_IMPORT __attribute__ ((dllimport))
#else
#define COLLISION_DETECTION_FCL_EXPORT __declspec(dllexport)
#define COLLISION_DETECTION_FCL_IMPORT __declspec(dllimport)
#endif
#ifdef COLLISION_DETECTION_FCL_BUILDING_LIBRARY
#define COLLISION_DETECTION_FCL_PUBLIC COLLISION_DETECTION_FCL_EXPORT
#else
#define COLLISION_DETECTION_FCL_PUBLIC COLLISION_DETECTION_FCL_IMPORT
#endif
#define COLLISION_DETECTION_FCL_PUBLIC_TYPE COLLISION_DETECTION_FCL_PUBLIC
#define COLLISION_DETECTION_FCL_LOCAL
#else
#define COLLISION_DETECTION_FCL_EXPORT __attribute__ ((visibility("default")))
#define COLLISION_DETECTION_FCL_IMPORT
#if __GNUC__ >= 4
#define COLLISION_DETECTION_FCL_PUBLIC __attribute__ ((visibility("default")))
#define COLLISION_DETECTION_FCL_LOCAL __attribute__ ((visibility("hidden")))
#else
#define COLLISION_DETECTION_FCL_PUBLIC
#define COLLISION_DETECTION_FCL_LOCAL
#endif
#define COLLISION_DETECTION_FCL_PUBLIC_TYPE
#endif

#if defined _WIN32 || defined __CYGWIN__
#ifdef __GNUC__
#define COLLISION_DETECTION_FCL_PLUGIN_EXPORT __attribute__ ((dllexport))
#define COLLISION_DETECTION_FCL_PLUGIN_IMPORT __attribute__ ((dllimport))
#else
#define COLLISION_DETECTION_FCL_PLUGIN_EXPORT __declspec(dllexport)
#define COLLISION_DETECTION_FCL_PLUGIN_IMPORT __declspec(dllimport)
#endif
#ifdef COLLISION_DETECTION_FCL_PLUGIN_BUILDING_LIBRARY
#define COLLISION_DETECTION_FCL_PLUGIN_PUBLIC COLLISION_DETECTION_FCL_PLUGIN_EXPORT
#else
#define COLLISION_DETECTION_FCL_PLUGIN_PUBLIC COLLISION_DETECTION_FCL_PLUGIN_IMPORT
#endif
#define COLLISION_DETECTION_FCL_PLUGIN_PUBLIC_TYPE COLLISION_DETECTION_FCL_PLUGIN_PUBLIC
#define COLLISION_DETECTION_FCL_PLUGIN_LOCAL
#else
#define COLLISION_DETECTION_FCL_PLUGIN_EXPORT __attribute__ ((visibility("default")))
#define COLLISION_DETECTION_FCL_PLUGIN_IMPORT
#if __GNUC__ >= 4
#define COLLISION_DETECTION_FCL_PLUGIN_PUBLIC __attribute__ ((visibility("default")))
#define COLLISION_DETECTION_FCL_PLUGIN_LOCAL __attribute__ ((visibility("hidden")))
#else
#define COLLISION_DETECTION_FCL_PLUGIN_PUBLIC
#define COLLISION_DETECTION_FCL_PLUGIN_LOCAL
#endif
#define COLLISION_DETECTION_FCL_PLUGIN_PUBLIC_TYPE
#endif

// clang-format on
#endif // COLLISION_DETECTION_FCL__VISIBILITY_CONTROL_HPP_
4 changes: 4 additions & 0 deletions moveit_core/kinematics_base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ set_target_properties(${MOVEIT_LIB_NAME} PROPERTIES VERSION "${${PROJECT_NAME}_V
# This line is needed to ensure that messages are done being built before this is built
ament_target_dependencies(${MOVEIT_LIB_NAME} rclcpp urdf urdfdom_headers srdfdom moveit_msgs geometric_shapes geometry_msgs Boost)

# Causes the visibility macros to use dllexport rather than dllimport,
# which is appropriate when building the dll but not consuming it.
target_compile_definitions(${MOVEIT_LIB_NAME} PRIVATE "KINEMATICS_BASE_BUILDING_LIBRARY")

install(TARGETS ${MOVEIT_LIB_NAME}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <geometry_msgs/msg/pose.hpp>
#include <moveit_msgs/msg/move_it_error_codes.hpp>
#include <moveit/macros/class_forward.h>
#include <moveit/kinematics_base/visibility_control.hpp>
#include "rclcpp/rclcpp.hpp"
#include <boost/function.hpp>
#include <string>
Expand Down Expand Up @@ -140,7 +141,7 @@ MOVEIT_CLASS_FORWARD(KinematicsBase) // Defines KinematicsBasePtr, ConstPtr, We
* @class KinematicsBase
* @brief Provides an interface for kinematics solvers.
*/
class KinematicsBase
class KINEMATICS_BASE_PUBLIC KinematicsBase
{
public:
static const rclcpp::Logger LOGGER;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright (c) 2019, Open Source Robotics Foundation, Inc.
// All rights reserved.
//
// Software License Agreement (BSD License 2.0)
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Open Source Robotics Foundation, Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef KINEMATICS_BASE__VISIBILITY_CONTROL_HPP_
#define KINEMATICS_BASE__VISIBILITY_CONTROL_HPP_

// This logic was borrowed (then namespaced) from the examples on the gcc wiki:
// https://gcc.gnu.org/wiki/Visibility

// clang-format off
#if defined _WIN32 || defined __CYGWIN__
#ifdef __GNUC__
#define KINEMATICS_BASE_EXPORT __attribute__ ((dllexport))
#define KINEMATICS_BASE_IMPORT __attribute__ ((dllimport))
#else
#define KINEMATICS_BASE_EXPORT __declspec(dllexport)
#define KINEMATICS_BASE_IMPORT __declspec(dllimport)
#endif
#ifdef KINEMATICS_BASE_BUILDING_LIBRARY
#define KINEMATICS_BASE_PUBLIC KINEMATICS_BASE_EXPORT
#else
#define KINEMATICS_BASE_PUBLIC KINEMATICS_BASE_IMPORT
#endif
#define KINEMATICS_BASE_PUBLIC_TYPE KINEMATICS_BASE_PUBLIC
#define KINEMATICS_BASE_LOCAL
#else
#define KINEMATICS_BASE_EXPORT __attribute__ ((visibility("default")))
#define KINEMATICS_BASE_IMPORT
#if __GNUC__ >= 4
#define KINEMATICS_BASE_PUBLIC __attribute__ ((visibility("default")))
#define KINEMATICS_BASE_LOCAL __attribute__ ((visibility("hidden")))
#else
#define KINEMATICS_BASE_PUBLIC
#define KINEMATICS_BASE_LOCAL
#endif
#define KINEMATICS_BASE_PUBLIC_TYPE
#endif

// clang-format on
#endif // KINEMATICS_BASE__VISIBILITY_CONTROL_HPP_
4 changes: 4 additions & 0 deletions moveit_core/planning_scene/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ target_link_libraries(${MOVEIT_LIB_NAME}
moveit_utils
)

# Causes the visibility macros to use dllexport rather than dllimport,
# which is appropriate when building the dll but not consuming it.
target_compile_definitions(${MOVEIT_LIB_NAME} PRIVATE "PLANNING_SCENE_BUILDING_LIBRARY")

install(TARGETS ${MOVEIT_LIB_NAME}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include <moveit/kinematics_base/kinematics_base.h>
#include <moveit/robot_trajectory/robot_trajectory.h>
#include <moveit/macros/class_forward.h>
#include <moveit/planning_scene/visibility_control.hpp>
#include <moveit_msgs/msg/planning_scene.hpp>
#include <moveit_msgs/msg/robot_trajectory.hpp>
#include <moveit_msgs/msg/constraints.hpp>
Expand Down Expand Up @@ -99,8 +100,8 @@ class PlanningScene : private boost::noncopyable, public std::enable_shared_from
const urdf::ModelInterfaceSharedPtr& urdf_model, const srdf::ModelConstSharedPtr& srdf_model,
const collision_detection::WorldPtr& world = collision_detection::WorldPtr(new collision_detection::World()));

static const std::string OCTOMAP_NS;
static const std::string DEFAULT_SCENE_NAME;
PLANNING_SCENE_PUBLIC static const std::string OCTOMAP_NS;
PLANNING_SCENE_PUBLIC static const std::string DEFAULT_SCENE_NAME;

~PlanningScene();

Expand Down
Loading