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

Cleanup CMakeLists target dependencies #228

Merged
merged 2 commits into from
Jul 18, 2020
Merged
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
16 changes: 2 additions & 14 deletions moveit_core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ find_library(LIBFCL_LIBRARIES_FULL ${LIBFCL_LIBRARIES} ${LIBFCL_LIBRARY_DIRS})
set(LIBFCL_LIBRARIES "${LIBFCL_LIBRARIES_FULL}")


find_package(octomap REQUIRED)
find_package(OCTOMAP REQUIRED)
v4hn marked this conversation as resolved.
Show resolved Hide resolved
find_package(urdfdom REQUIRED)
find_package(urdf REQUIRED)
find_package(urdfdom_headers REQUIRED)
Expand Down Expand Up @@ -169,19 +169,7 @@ include_directories(SYSTEM ${EIGEN3_INCLUDE_DIRS}
# ${BULLET_INCLUDE_DIRS}
)

include_directories(${THIS_PACKAGE_INCLUDE_DIRS}
${VERSION_FILE_PATH}
${rclcpp_INCLUDE_DIRS}
${rmw_implementation_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${urdfdom_INCLUDE_DIRS}
${urdfdom_headers_INCLUDE_DIRS}
${OCTOMAP_INCLUDE_DIRS}
${moveit_msgs_INCLUDE_DIRS}
${random_numbers_INCLUDE_DIRS}
${srdfdom_INCLUDE_DIRS}
${geometric_shapes_INCLUDE_DIRS}
)
include_directories(${THIS_PACKAGE_INCLUDE_DIRS} ${VERSION_FILE_PATH})

# Generate and install version.h
string(REGEX REPLACE "^([0-9]+)\\..*" "\\1" MOVEIT_VERSION_MAJOR "${${PROJECT_NAME}_VERSION}")
Expand Down
16 changes: 8 additions & 8 deletions moveit_core/background_processing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ set(MOVEIT_LIB_NAME moveit_background_processing)

add_library(${MOVEIT_LIB_NAME} SHARED src/background_processing.cpp)
set_target_properties(${MOVEIT_LIB_NAME} PROPERTIES VERSION "${${PROJECT_NAME}_VERSION}")

target_link_libraries(${MOVEIT_LIB_NAME}
${rclcpp_LIBRARIES}
${rmw_implementation_LIBRARIES}
${urdfdom_LIBRARIES}
${urdfdom_headers_LIBRARIES}
${Boost_LIBRARIES})
ament_target_dependencies(${MOVEIT_LIB_NAME}
Boost
rclcpp
urdfdom
urdfdom_headers
)

install(TARGETS ${MOVEIT_LIB_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
LIBRARY DESTINATION lib
)

install(DIRECTORY include/ DESTINATION include)
29 changes: 4 additions & 25 deletions moveit_core/collision_detection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ament_target_dependencies(${MOVEIT_LIB_NAME}
tf2_eigen
geometric_shapes
Boost
octomap
OCTOMAP
)

target_link_libraries(${MOVEIT_LIB_NAME}
Expand All @@ -30,7 +30,6 @@ target_link_libraries(${MOVEIT_LIB_NAME}

# unit tests
if(BUILD_TESTING)
find_package(resource_retriever REQUIRED)
if(WIN32)
# TODO add window paths
else()
Expand All @@ -39,35 +38,15 @@ if(BUILD_TESTING)

ament_add_gtest(test_world test/test_world.cpp
APPEND_LIBRARY_DIRS "${append_library_dirs}")
target_link_libraries(test_world
${MOVEIT_LIB_NAME}
${urdfdom}
${urdfdom_headers}
${Boost_LIBRARIES}
${geometric_shapes_LIBRARIES}
)
target_link_libraries(test_world ${MOVEIT_LIB_NAME})

ament_add_gtest(test_world_diff test/test_world_diff.cpp
APPEND_LIBRARY_DIRS "${append_library_dirs}")
target_link_libraries(test_world_diff
${MOVEIT_LIB_NAME}
${urdfdom}
${urdfdom_headers}
${Boost_LIBRARIES}
${geometric_shapes_LIBRARIES}
)
target_link_libraries(test_world_diff ${MOVEIT_LIB_NAME})

ament_add_gtest(test_all_valid test/test_all_valid.cpp
APPEND_LIBRARY_DIRS "${append_library_dirs}")
target_link_libraries(test_all_valid
${MOVEIT_LIB_NAME}
moveit_robot_model
${urdfdom}
${urdfdom_headers}
${Boost_LIBRARIES}
${geometric_shapes_LIBRARIES}
resource_retriever::resource_retriever
)
target_link_libraries(test_all_valid ${MOVEIT_LIB_NAME} moveit_robot_model)
endif()

install(TARGETS ${MOVEIT_LIB_NAME}
Expand Down
21 changes: 6 additions & 15 deletions moveit_core/collision_detection_fcl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,34 +33,25 @@ target_link_libraries(collision_detector_fcl_plugin
)

install(TARGETS ${MOVEIT_LIB_NAME} collision_detector_fcl_plugin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
)
install(DIRECTORY include/ DESTINATION include)

if(BUILD_TESTING)
find_package(moveit_resources REQUIRED)
include_directories(${moveit_resources_INCLUDE_DIRS})
find_package(resource_retriever REQUIRED)

if(WIN32)
# set(append_library_dirs "$<TARGET_FILE_DIR:${PROJECT_NAME}>;$<TARGET_FILE_DIR:${PROJECT_NAME}_TestPlugins1>")
else()
set(append_library_dirs "${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_BINARY_DIR}/../collision_detection;${CMAKE_CURRENT_BINARY_DIR}/../robot_state;${CMAKE_CURRENT_BINARY_DIR}/../robot_model;${CMAKE_CURRENT_BINARY_DIR}/../utils")
endif()

ament_add_gtest(test_fcl_collision_env test/test_fcl_env.cpp)
target_link_libraries(test_fcl_collision_env
moveit_test_utils
${MOVEIT_LIB_NAME}
${Boost_LIBRARIES}
moveit_robot_state
)
target_link_libraries(test_fcl_collision_env moveit_test_utils ${MOVEIT_LIB_NAME})

ament_add_gtest(test_fcl_collision_detection test/test_fcl_collision_detection_pr2.cpp)
target_link_libraries(test_fcl_collision_detection moveit_test_utils ${MOVEIT_LIB_NAME} ${Boost_LIBRARIES})
target_link_libraries(test_fcl_collision_detection moveit_test_utils ${MOVEIT_LIB_NAME})

ament_add_gtest(test_fcl_collision_detection_panda test/test_fcl_collision_detection_panda.cpp)
target_link_libraries(test_fcl_collision_detection_panda moveit_test_utils ${MOVEIT_LIB_NAME} ${Boost_LIBRARIES})
target_link_libraries(test_fcl_collision_detection_panda moveit_test_utils ${MOVEIT_LIB_NAME})
endif()
2 changes: 1 addition & 1 deletion moveit_core/collision_distance_field/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ament_target_dependencies(${MOVEIT_LIB_NAME}
visualization_msgs
tf2_eigen
geometric_shapes
octomap
OCTOMAP
)

target_link_libraries(${MOVEIT_LIB_NAME}
Expand Down
25 changes: 4 additions & 21 deletions moveit_core/constraint_samplers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ target_link_libraries(${MOVEIT_LIB_NAME}
)

install(TARGETS ${MOVEIT_LIB_NAME}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
)

install(DIRECTORY include/ DESTINATION include)
Expand All @@ -49,30 +49,13 @@ if(BUILD_TESTING)
test/pr2_arm_kinematics_plugin.cpp
test/pr2_arm_ik.cpp
)

target_include_directories(test_constraint_samplers PUBLIC
${geometry_msgs_INCLUDE_DIRS}
)

ament_target_dependencies(test_constraint_samplers kdl_parser)
target_link_libraries(test_constraint_samplers
moveit_constraint_samplers
moveit_kinematic_constraints
moveit_planning_scene
moveit_test_utils
moveit_utils
moveit_robot_state
${MOVEIT_LIB_NAME}
${angles_LIBRARIES}
${urdf_LIBRARIES}
${tf2_LIBRARIES}
${tf2_kdl_LIBRARIES}
${tf2_ros_LIBRARIES}
${kdl_parser_LIBRARIES}
${OCTOMAP_LIBRARIES}
${orcos_kdl_LIBRARIES}
${urdfdom_LIBRARIES}
${urdfdom_headers_LIBRARIES}
${rclcpp_headers_LIBRARIES}
${geometric_shapes_LIBRARIES}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are none of these needed anymore?

the test does use, e.g., moveit_constraint_samplers for all that I can see.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moveit_constraint_samplers is ${MOVEIT_LIB_NAME}. All other targets are provided with $MOVEIT_LIB_NAME so I didn't specify the same deps again for the test.

)
endif()
23 changes: 6 additions & 17 deletions moveit_core/distance_field/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,22 @@ ament_target_dependencies(${MOVEIT_LIB_NAME}
visualization_msgs
geometric_shapes
tf2_eigen
octomap
OCTOMAP
)

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

if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)

ament_add_gtest(test_voxel_grid test/test_voxel_grid.cpp)
target_link_libraries(test_voxel_grid
${MOVEIT_LIB_NAME}
)
target_link_libraries(test_voxel_grid ${MOVEIT_LIB_NAME})

ament_add_gtest(test_distance_field test/test_distance_field.cpp)

target_link_libraries(test_distance_field
${MOVEIT_LIB_NAME}
${visualization_msgs_LIBRARIES}
${tf2_eigen_LIBRARIES}
${Boost_LIBRARIES}
${geometric_shapes_LIBRARIES}
${OCTOMAP_LIBRARIES}
${console_bridge_LIBRARIES}
)
target_link_libraries(test_distance_field ${MOVEIT_LIB_NAME})
endif()
16 changes: 10 additions & 6 deletions moveit_core/exceptions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ set(MOVEIT_LIB_NAME moveit_exceptions)

add_library(${MOVEIT_LIB_NAME} SHARED src/exceptions.cpp)
set_target_properties(${MOVEIT_LIB_NAME} PROPERTIES VERSION "${${PROJECT_NAME}_VERSION}")

target_link_libraries(${MOVEIT_LIB_NAME} ${rclcpp_LIBRARIES} ${rmw_implementation_LIBRARIES} ${urdfdom_LIBRARIES} ${urdfdom_headers_LIBRARIES} ${Boost_LIBRARIES})

ament_target_dependencies(${MOVEIT_LIB_NAME}
Boost
rclcpp
urdfdom
urdfdom_headers
)
install(TARGETS ${MOVEIT_LIB_NAME}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin)
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
)
install(DIRECTORY include/ DESTINATION include)
17 changes: 1 addition & 16 deletions moveit_core/kinematic_constraints/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,9 @@ install(DIRECTORY include/ DESTINATION include)

if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)
find_package(moveit_resources REQUIRED)
find_package(resource_retriever REQUIRED)

include_directories(${moveit_resources_INCLUDE_DIRS})

ament_add_gtest(test_constraints test/test_constraints.cpp
APPEND_LIBRARY_DIRS "${append_library_dirs}"
)

target_link_libraries(test_constraints
moveit_kinematic_constraints
moveit_collision_detection_fcl
moveit_robot_model
moveit_robot_state
moveit_utils
moveit_test_utils
${geometric_shapes_LIBRARIES}
resource_retriever::resource_retriever
${MOVEIT_LIB_NAME}
)
target_link_libraries(test_constraints moveit_test_utils ${MOVEIT_LIB_NAME})
endif()
3 changes: 2 additions & 1 deletion moveit_core/kinematics_base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ add_library(${MOVEIT_LIB_NAME} SHARED src/kinematics_base.cpp)
set_target_properties(${MOVEIT_LIB_NAME} PROPERTIES VERSION "${${PROJECT_NAME}_VERSION}")

# This line is needed to ensure that messages are done being built before this is built
ament_target_dependencies(${MOVEIT_LIB_NAME} urdf urdfdom_headers)
ament_target_dependencies(${MOVEIT_LIB_NAME} rclcpp urdf urdfdom_headers moveit_msgs geometry_msgs Boost)
target_link_libraries(${MOVEIT_LIB_NAME} moveit_robot_model)

install(TARGETS ${MOVEIT_LIB_NAME}
LIBRARY DESTINATION lib
Expand Down
38 changes: 13 additions & 25 deletions moveit_core/planning_scene/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ set(MOVEIT_LIB_NAME moveit_planning_scene)
add_library(${MOVEIT_LIB_NAME} SHARED src/planning_scene.cpp)
#TODO: Fix the versioning
set_target_properties(${MOVEIT_LIB_NAME} PROPERTIES VERSION "${${PROJECT_NAME}_VERSION}")

target_include_directories(${MOVEIT_LIB_NAME} PUBLIC
${octomap_msgs_INCLUDE_DIRS}
${octomap_INCLUDE_DIRS}
ament_target_dependencies(${MOVEIT_LIB_NAME}
Boost
rclcpp
urdfdom
urdfdom_headers
octomap_msgs
OCTOMAP
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This added public target includes for octomap before so that other libs linking with moveit_planning_scene automatically include the octomap headers. Does ament_target_dependencies automagically add the correct target includes as public/interface/private? How would it differentiate between private and non-private includes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not PUBLIC in MoveIt 1, so I removed it. We can specify octomap PUBLIC with ament_target_dependencies though.


target_link_libraries(${MOVEIT_LIB_NAME}
Expand All @@ -20,14 +23,6 @@ target_link_libraries(${MOVEIT_LIB_NAME}
moveit_robot_trajectory
moveit_trajectory_processing
moveit_utils
${LIBOCTOMAP_LIBRARIES}
${rclcpp_LIBRARIES}
${rmw_implementation_LIBRARIES}
${urdfdom_LIBRARIES}
${urdfdom_headers_LIBRARIES}
${Boost_LIBRARIES}
${octomap_msgs_LIBRARIES}
${OCTOMAP_LIBRARIES}
)

install(TARGETS ${MOVEIT_LIB_NAME}
Expand All @@ -47,21 +42,14 @@ if(BUILD_TESTING)

ament_add_gtest(test_planning_scene test/test_planning_scene.cpp
APPEND_LIBRARY_DIRS "${append_library_dirs}")
target_link_libraries(test_planning_scene
${MOVEIT_LIB_NAME}
${srdfdom_LIBRARIES}
${urdf_LIBRARIES}
${geometric_shapes_LIBRARIES}
${OCTOMAP_LIBRARIES}
${ament_index_cpp_LIBRARIES}
ament_target_dependencies(test_planning_scene
ament_index_cpp
geometric_shapes
srdfdom
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

urdf_parser is included, but not listed here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

provided by ${MOVEIT_LIB_NAME}

)
target_link_libraries(test_planning_scene ${MOVEIT_LIB_NAME})

ament_add_gtest(test_multi_threaded test/test_multi_threaded.cpp
APPEND_LIBRARY_DIRS "${append_library_dirs}")
target_link_libraries(test_multi_threaded
moveit_planning_scene
moveit_test_utils
${MOVEIT_LIB_NAME}
${urdfdom_LIBRARIES}
${urdfdom_headers_LIBRARIES})
target_link_libraries(test_multi_threaded moveit_test_utils ${MOVEIT_LIB_NAME})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

robot_state, robot_model and collision_detection are included, but not listed here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

endif()
Loading