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

Support Qt6 #170

Open
wants to merge 13 commits into
base: rolling
Choose a base branch
from
17 changes: 12 additions & 5 deletions turtlesim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ endif()
find_package(ament_cmake REQUIRED)
find_package(ament_index_cpp REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(Qt5 REQUIRED COMPONENTS Widgets)
find_package(QT NAMES Qt5 Qt6 REQUIRED COMPONENTS Widgets Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Core)
find_package(rcl_interfaces REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_action REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(std_msgs REQUIRED)
find_package(std_srvs REQUIRED)

include_directories(include ${Qt5Widgets_INCLUDE_DIRS})
include_directories(include ${Qt${QT_VERSION_MAJOR}Widgets_INCLUDE_DIRS})
ahcorde marked this conversation as resolved.
Show resolved Hide resolved

rosidl_generate_interfaces(${PROJECT_NAME}
"action/RotateAbsolute.action"
Expand All @@ -33,10 +34,15 @@ rosidl_generate_interfaces(${PROJECT_NAME}
"srv/TeleportAbsolute.srv"
"srv/TeleportRelative.srv")

qt5_wrap_cpp(turtlesim_node_MOCS include/turtlesim/turtle_frame.hpp)

rosidl_get_typesupport_target(cpp_typesupport_target "${PROJECT_NAME}" "rosidl_typesupport_cpp")

if(${QT_VERSION_MAJOR} GREATER "5")
qt_standard_project_setup()
qt_wrap_cpp(turtlesim_node_MOCS include/turtlesim/turtle_frame.hpp)
else()
qt5_wrap_cpp(turtlesim_node_MOCS include/turtlesim/turtle_frame.hpp)
endif()

add_executable(turtlesim_node
src/turtlesim.cpp
src/turtle.cpp
Expand All @@ -47,8 +53,9 @@ target_link_libraries(turtlesim_node PRIVATE
ament_index_cpp::ament_index_cpp
${cpp_typesupport_target}
${geometry_msgs_TARGETS}
Qt5::Widgets
${rcl_interfaces_TARGETS}
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Widgets
rclcpp::rclcpp
rclcpp_action::rclcpp_action
${std_srvs_TARGETS}
Expand Down