Skip to content

Commit

Permalink
format CMakeLists.txt for better readability
Browse files Browse the repository at this point in the history
  • Loading branch information
christianrauch committed Jun 6, 2024
1 parent 8d8b3e2 commit c2f2a98
Showing 1 changed file with 58 additions and 15 deletions.
73 changes: 58 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,66 @@ find_package(image_transport REQUIRED)
find_package(cv_bridge REQUIRED)
find_package(Eigen3 REQUIRED NO_MODULE)
find_package(Threads REQUIRED)
find_package(OpenCV REQUIRED)
find_package(OpenCV REQUIRED COMPONENTS core calib3d)
find_package(apriltag 3.2 REQUIRED)

if(cv_bridge_VERSION VERSION_GREATER_EQUAL 3.3.0)
add_compile_definitions(cv_bridge_HPP)
endif()

add_library(tags OBJECT src/tag_functions.cpp)
target_link_libraries(tags apriltag::apriltag)
set_property(TARGET tags PROPERTY POSITION_INDEPENDENT_CODE ON)

add_library(pose_estimation OBJECT src/pose_estimation.cpp)
target_include_directories(pose_estimation PRIVATE ${OpenCV_INCLUDE_DIRS})
target_link_libraries(pose_estimation apriltag::apriltag Eigen3::Eigen ${OpenCV_LIBS})
set_property(TARGET pose_estimation PROPERTY POSITION_INDEPENDENT_CODE ON)
ament_target_dependencies(pose_estimation tf2_ros)
# database of tag functions
add_library(tags STATIC
src/tag_functions.cpp
)
target_link_libraries(tags
apriltag::apriltag
)
set_property(TARGET tags PROPERTY
POSITION_INDEPENDENT_CODE ON
)


# pose estimation methods
add_library(pose_estimation STATIC
src/pose_estimation.cpp
)
target_link_libraries(pose_estimation
apriltag::apriltag
Eigen3::Eigen
opencv_core
opencv_calib3d
)
ament_target_dependencies(pose_estimation
geometry_msgs
)
set_property(TARGET pose_estimation PROPERTY
POSITION_INDEPENDENT_CODE ON
)


add_library(AprilTagNode SHARED src/AprilTagNode.cpp)
ament_target_dependencies(AprilTagNode rclcpp rclcpp_components sensor_msgs apriltag_msgs tf2_ros image_transport cv_bridge)
target_link_libraries(AprilTagNode apriltag::apriltag tags pose_estimation Eigen3::Eigen)
rclcpp_components_register_node(AprilTagNode PLUGIN "AprilTagNode" EXECUTABLE "apriltag_node")
# composable node
add_library(AprilTagNode SHARED
src/AprilTagNode.cpp
)
ament_target_dependencies(AprilTagNode
rclcpp
rclcpp_components
sensor_msgs
apriltag_msgs
tf2_ros
image_transport
cv_bridge
)
target_link_libraries(AprilTagNode
apriltag::apriltag
tags
pose_estimation
)
rclcpp_components_register_node(AprilTagNode
PLUGIN "AprilTagNode"
EXECUTABLE "apriltag_node"
)

ament_environment_hooks(${ament_cmake_package_templates_ENVIRONMENT_HOOK_LIBRARY_PATH})

Expand All @@ -70,9 +109,13 @@ install(TARGETS AprilTagNode
LIBRARY DESTINATION lib
)

install(DIRECTORY cfg/ DESTINATION share/${PROJECT_NAME}/cfg)
install(DIRECTORY cfg
DESTINATION share/${PROJECT_NAME}
)

install(DIRECTORY launch DESTINATION share/${PROJECT_NAME})
install(DIRECTORY launch
DESTINATION share/${PROJECT_NAME}
)

if(BUILD_TESTING)
set(ament_cmake_clang_format_CONFIG_FILE "${CMAKE_SOURCE_DIR}/.clang-format")
Expand Down

0 comments on commit c2f2a98

Please sign in to comment.