Skip to content

Commit

Permalink
Refactor CMake config and fix exporting of pluginlib classes
Browse files Browse the repository at this point in the history
Signed-off-by: Andrej Orsula <[email protected]>
  • Loading branch information
AndrejOrsula committed Jun 6, 2022
1 parent 8b1d0c0 commit 1a81445
Show file tree
Hide file tree
Showing 8 changed files with 238 additions and 239 deletions.
106 changes: 28 additions & 78 deletions moveit_calibration_gui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,101 +1,51 @@
cmake_minimum_required(VERSION 3.16.3)
cmake_minimum_required(VERSION 3.10.2)
project(moveit_calibration_gui)

# Common cmake code applied to all moveit packages
find_package(moveit_common REQUIRED)
moveit_package()

find_package(ament_cmake REQUIRED)
find_package(ament_index_cpp REQUIRED)
find_package(class_loader REQUIRED)
find_package(geometric_shapes REQUIRED)
# find dependencies
find_package(ament_cmake_ros REQUIRED)
find_package(cv_bridge REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(eigen3_cmake_module REQUIRED)
find_package(image_geometry REQUIRED)
find_package(image_transport REQUIRED)
find_package(moveit_calibration_plugins REQUIRED)
find_package(moveit_core REQUIRED)
find_package(moveit_ros_perception REQUIRED)
find_package(moveit_ros_planning REQUIRED)
find_package(moveit_ros_planning_interface REQUIRED)
find_package(moveit_ros_visualization REQUIRED)
find_package(moveit_visual_tools REQUIRED)
find_package(OpenCV REQUIRED)
find_package(pluginlib REQUIRED)
find_package(tf2_eigen REQUIRED)

find_package(rviz2 REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rviz_common REQUIRED)
find_package(rviz_default_plugins REQUIRED)
find_package(rviz_rendering REQUIRED)
find_package(rviz_visual_tools REQUIRED)
find_package(rviz_ogre_vendor REQUIRED)

find_package(OpenCV REQUIRED)
find_package(eigen3_cmake_module REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(OpenGL REQUIRED)
find_package(GLUT REQUIRED)

# Qt Stuff
find_package(Qt5 ${rviz_QT_VERSION} REQUIRED Core Widgets)
set(QT_LIBRARIES Qt5::Widgets)
macro(qt_wrap_ui)
qt5_wrap_ui(${ARGN})
endmacro()

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_definitions(-DQT_NO_KEYWORDS)
find_package(tf2_eigen REQUIRED)

set(THIS_PACKAGE_INCLUDE_DEPENDS
ament_index_cpp
Eigen3
eigen3_cmake_module
image_transport
moveit_core
moveit_calibration_plugins
moveit_ros_perception
moveit_ros_planning
moveit_ros_planning_interface
moveit_ros_visualization
moveit_visual_tools
rclcpp
rviz_common
rviz_default_plugins
rviz_visual_tools
rviz_rendering
rviz_ogre_vendor
pluginlib
tf2_eigen
)

set(THIS_PACKAGE_LIBRARIES
moveit_handeye_calibration_rviz_plugin_core
moveit_handeye_calibration_rviz_plugin
cv_bridge
Eigen3
image_geometry
image_transport
moveit_calibration_plugins
moveit_ros_planning_interface
moveit_visual_tools
pluginlib
rclcpp
rviz_common
rviz_visual_tools
tf2_eigen
)

include_directories(
handeye_calibration_rviz_plugin/include
)
include_directories("${OGRE_PREFIX_DIR}/include")

# Add project sub-libraries
add_subdirectory(handeye_calibration_rviz_plugin)

pluginlib_export_plugin_description_file(rviz_common handeye_calibration_rviz_plugin_description.xml)

install(
TARGETS ${THIS_PACKAGE_LIBRARIES}
EXPORT export_${PROJECT_NAME}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
# Export plugin descriptions to register with pluginlib
pluginlib_export_plugin_description_file(
rviz_common
handeye_calibration_rviz_plugin_description.xml
)

# if (CATKIN_ENABLE_TESTING)
# find_package(rostest REQUIRED)
# endif()

ament_export_targets(export_${PROJECT_NAME} HAS_LIBRARY_TARGET)
ament_export_dependencies(${THIS_PACKAGE_INCLUDE_DEPENDS})
ament_package()
ament_package()
Original file line number Diff line number Diff line change
@@ -1,45 +1,72 @@
set(MOVEIT_LIB_NAME moveit_handeye_calibration_rviz_plugin)
set(HEADERS
include/moveit/handeye_calibration_rviz_plugin/handeye_calibration_display.h
include/moveit/handeye_calibration_rviz_plugin/handeye_calibration_frame.h
include/moveit/handeye_calibration_rviz_plugin/handeye_target_widget.h
include/moveit/handeye_calibration_rviz_plugin/handeye_context_widget.h
include/moveit/handeye_calibration_rviz_plugin/handeye_control_widget.h
include/moveit/handeye_calibration_rviz_plugin/handeye_target_widget.h
)

#catkin_lint: ignore_once missing_directory
include_directories(${CMAKE_CURRENT_BINARY_DIR})

# Plugin Source
set(SOURCE_FILES
set(SOURCE_FILES_CORE
src/handeye_calibration_display.cpp
src/handeye_calibration_frame.cpp
src/handeye_target_widget.cpp
src/handeye_context_widget.cpp
src/handeye_control_widget.cpp
src/handeye_target_widget.cpp
)
set(SOURCE_FILES_PLUGINS
src/plugin_init.cpp
)

set(MOVEIT_LIB_NAME moveit_handeye_calibration_rviz_plugin)
# Qt Stuff
find_package(Qt5 ${rviz_QT_VERSION} REQUIRED Core Widgets)
set(QT_LIBRARIES Qt5::Widgets)
macro(qt_wrap_ui)
qt5_wrap_ui(${ARGN})
endmacro()

add_library(${MOVEIT_LIB_NAME}_core SHARED ${SOURCE_FILES} ${HEADERS})
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_definitions(-DQT_NO_KEYWORDS)

# Core library
# TODO: Remove headers from moveit_handeye_calibration_rviz_plugin library compilation
add_library(${MOVEIT_LIB_NAME}_core SHARED ${SOURCE_FILES_CORE} ${HEADERS})
set_target_properties(${MOVEIT_LIB_NAME}_core PROPERTIES VERSION "${${PROJECT_NAME}_VERSION}")
target_link_libraries(${MOVEIT_LIB_NAME}_core ${OpenCV_LIBS})
ament_target_dependencies(${MOVEIT_LIB_NAME}_core
rviz2
rviz_ogre_vendor
Qt5
pluginlib
image_transport
rviz_visual_tools
moveit_visual_tools
moveit_core
moveit_calibration_plugins
moveit_ros_planning_interface)
target_include_directories(${MOVEIT_LIB_NAME}_core PRIVATE "${OGRE_PREFIX_DIR}/include")
target_include_directories(${MOVEIT_LIB_NAME}_core PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
ament_target_dependencies(
${MOVEIT_LIB_NAME}_core
${THIS_PACKAGE_INCLUDE_DEPENDS}
)

add_library(${MOVEIT_LIB_NAME} SHARED src/plugin_init.cpp)
# Plugin library
add_library(${MOVEIT_LIB_NAME} SHARED ${SOURCE_FILES_PLUGINS})
set_target_properties(${MOVEIT_LIB_NAME} PROPERTIES VERSION "${${PROJECT_NAME}_VERSION}")
target_link_libraries(${MOVEIT_LIB_NAME} ${MOVEIT_LIB_NAME}_core)
ament_target_dependencies(${MOVEIT_LIB_NAME} pluginlib rviz_ogre_vendor rviz_visual_tools)
target_include_directories(${MOVEIT_LIB_NAME} PRIVATE "${OGRE_PREFIX_DIR}/include")
target_include_directories(${MOVEIT_LIB_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
ament_target_dependencies(
${MOVEIT_LIB_NAME}
pluginlib
)

install(DIRECTORY include/ DESTINATION include)
install(
TARGETS ${MOVEIT_LIB_NAME}_core ${MOVEIT_LIB_NAME}
EXPORT export_${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)

ament_export_include_directories(
include
)
ament_export_libraries(
{MOVEIT_LIB_NAME}_core {MOVEIT_LIB_NAME}
)
36 changes: 14 additions & 22 deletions moveit_calibration_gui/package.xml
Original file line number Diff line number Diff line change
@@ -1,51 +1,43 @@
<?xml version='1.0' encoding='utf-8'?>
<package format="3">
<name>moveit_calibration_gui</name>
<version>0.1.0</version>
<description>MoveIt calibration GUI</description>

<version>2.0.0</version>
<description>MoveIt calibration GUI plugins</description>
<author email="[email protected]">Yu Yan</author>

<maintainer email="[email protected]">Yu Yan</maintainer>

<license>BSD</license>

<url type="website">http://moveit.ros.org</url>
<url type="website">https://moveit.ros.org</url>
<url type="bugtracker">https://github.com/ros-planning/moveit_calibration/issues</url>
<url type="repository">https://github.com/ros-planning/moveit_calibration</url>

<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>ament_cmake_ros</buildtool_depend>

<build_depend>class_loader</build_depend>
<build_depend>eigen</build_depend>
<build_depend>eigen3_cmake_module</build_depend>
<build_depend>moveit_common</build_depend>
<build_depend>qtbase5-dev</build_depend>
<build_depend>image_geometry</build_depend>

<exec_depend>libqt5-core</exec_depend>
<exec_depend>libqt5-gui</exec_depend>
<exec_depend>libqt5-widgets</exec_depend>

<depend>cv_bridge</depend>
<depend>geometric_shapes</depend>
<depend>eigen</depend>
<depend>image_geometry</depend>
<depend>image_transport</depend>
<depend>moveit_ros_visualization</depend>
<depend>libopencv-dev</depend>
<depend>moveit_calibration_plugins</depend>
<depend>moveit_core</depend>
<depend>moveit_ros_perception</depend>
<depend>moveit_ros_planning</depend>
<depend>moveit_ros_planning_interface</depend>
<depend>moveit_visual_tools</depend>
<depend version_gte="1.11.2">pluginlib</depend>
<depend>pluginlib</depend>
<depend>rclcpp</depend>
<depend>rviz_common</depend>
<depend>rviz_visual_tools</depend>
<depend>tf2_eigen</depend>

<!-- <test_depend>rostest</test_depend> -->
<exec_depend>libqt5-core</exec_depend>
<exec_depend>libqt5-gui</exec_depend>
<exec_depend>libqt5-widgets</exec_depend>

<export>
<rviz plugin="${prefix}/handeye_calibration_rviz_plugin_description.xml"/>
<build_type>ament_cmake</build_type>
<rviz plugin="${prefix}/handeye_calibration_rviz_plugin_description.xml"/>
</export>

</package>
53 changes: 17 additions & 36 deletions moveit_calibration_plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
cmake_minimum_required(VERSION 3.16.3)
cmake_minimum_required(VERSION 3.10.2)
project(moveit_calibration_plugins)

# Common cmake code applied to all moveit packages
find_package(moveit_common REQUIRED)
moveit_package()

find_package(ament_cmake REQUIRED)
# find dependencies
find_package(ament_cmake_ros REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(eigen3_cmake_module REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(OpenCV REQUIRED imgcodecs aruco)
find_package(pluginlib REQUIRED)
Expand All @@ -15,52 +17,31 @@ find_package(sensor_msgs REQUIRED)
find_package(tf2 REQUIRED)
find_package(tf2_eigen REQUIRED)

include_directories(
handeye_calibration_target/include
handeye_calibration_solver/include
)
include_directories(
SYSTEM
${OpenCV_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS}
)

set(THIS_PACKAGE_INCLUDE_DEPENDS
Eigen3
geometry_msgs
OpenCV
pluginlib
rclcpp
sensor_msgs
tf2
tf2_eigen
)
set(THIS_PACKAGE_LIBRARIES
moveit_handeye_calibration_solver_core
moveit_handeye_calibration_solver
moveit_handeye_calibration_target_core
moveit_handeye_calibration_target
)

if(OpenCV_VERSION VERSION_EQUAL 3.2)
message(WARNING "Your version of OpenCV (3.2) is known to have buggy ArUco pose detection! Use a ChArUco target or upgrade OpenCV")
endif()

add_subdirectory(handeye_calibration_target)
# Add project sub-libraries
add_subdirectory(handeye_calibration_solver)
add_subdirectory(handeye_calibration_target)

install(
TARGETS
${THIS_PACKAGE_LIBRARIES}
EXPORT export_${PROJECT_NAME}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
# Export plugin descriptions to register with pluginlib
pluginlib_export_plugin_description_file(
moveit_calibration_plugins
handeye_calibration_target_plugin_description.xml
)
pluginlib_export_plugin_description_file(
moveit_calibration_plugins
handeye_calibration_solver_plugin_description.xml
)

pluginlib_export_plugin_description_file(moveit_calibration_gui handeye_calibration_target_plugin_description.xml)
pluginlib_export_plugin_description_file(moveit_calibration_gui handeye_calibration_solver_plugin_description.xml)

ament_export_targets(export_${PROJECT_NAME} HAS_LIBRARY_TARGET)
ament_export_dependencies(${THIS_PACKAGE_INCLUDE_DEPENDS})

ament_package()
ament_package()
Loading

0 comments on commit 1a81445

Please sign in to comment.