@@ -12,6 +12,8 @@ elseif($ENV{ROS_DISTRO} MATCHES "jazzy")
1212 add_compile_definitions (JAZZY)
1313elseif ($ENV{ROS_DISTRO} MATCHES "rolling" )
1414 add_compile_definitions (ROLLING)
15+ elseif ($ENV{ROS_DISTRO} MATCHES "kilted" )
16+ add_compile_definitions (KILTED)
1517endif ()
1618
1719# ROS2 Packages
@@ -36,6 +38,8 @@ elseif($ENV{ROS_DISTRO} MATCHES "iron")
3638 find_package (Python 3.10 EXACT REQUIRED COMPONENTS Development)
3739elseif ($ENV{ROS_DISTRO} MATCHES "jazzy" )
3840 find_package (Python 3.12 EXACT REQUIRED COMPONENTS Development)
41+ elseif ($ENV{ROS_DISTRO} MATCHES "kilted" )
42+ find_package (Python 3.12 EXACT REQUIRED COMPONENTS Development)
3943elseif ($ENV{ROS_DISTRO} MATCHES "rolling" )
4044 find_package (Python 3.12 EXACT REQUIRED COMPONENTS Development)
4145endif ()
@@ -108,27 +112,46 @@ add_executable(driver
108112 src/utils/Math.cpp
109113 src/utils/Utils.cpp
110114)
111- ament_target_dependencies(driver
112- rosgraph_msgs
113- rclcpp
114- pluginlib
115- sensor_msgs
116- std_msgs
117- tf2_geometry_msgs
118- tf2_ros
119- vision_msgs
120- webots_ros2_msgs
121- tinyxml2_vendor
122- TinyXML2
123- )
115+
116+ if ($ENV{ROS_DISTRO} MATCHES "humble" OR $ENV{ROS_DISTRO} MATCHES "jazzy" )
117+ ament_target_dependencies(driver
118+ rosgraph_msgs
119+ rclcpp
120+ pluginlib
121+ sensor_msgs
122+ std_msgs
123+ tf2_geometry_msgs
124+ tf2_ros
125+ vision_msgs
126+ webots_ros2_msgs
127+ tinyxml2_vendor
128+ TinyXML2
129+ )
130+ target_link_libraries (driver
131+ ${WEBOTS_LIB}
132+ ${Python_LIBRARIES}
133+ yaml-cpp
134+ )
135+ else ()
136+ target_link_libraries (driver
137+ ${rosgraph_msgs_TARGETS}
138+ rclcpp::rclcpp
139+ pluginlib::pluginlib
140+ ${sensor_msgs_TARGETS}
141+ ${std_msgs_TARGETS}
142+ tf2_geometry_msgs::tf2_geometry_msgs
143+ tf2_ros::tf2_ros
144+ ${vision_msgs_TARGETS}
145+ ${webots_ros2_msgs_TARGETS}
146+ tinyxml2::tinyxml2
147+ ${WEBOTS_LIB}
148+ ${Python_LIBRARIES}
149+ yaml-cpp
150+ )
151+ endif ()
124152add_dependencies (driver
125153 compile-lib-vehicle
126154)
127- target_link_libraries (driver
128- ${WEBOTS_LIB}
129- ${Python_LIBRARIES}
130- yaml-cpp
131- )
132155install (
133156 DIRECTORY include /
134157 DESTINATION include
@@ -146,19 +169,30 @@ add_library(
146169 src/plugins/Ros2SensorPlugin.cpp
147170 src/utils/Utils.cpp
148171)
149- ament_target_dependencies(${PROJECT_NAME} _imu
150- rclcpp
151- sensor_msgs
152- webots_ros2_msgs
153- pluginlib
154- tf2_ros
155- )
172+ if ($ENV{ROS_DISTRO} MATCHES "humble" OR $ENV{ROS_DISTRO} MATCHES "jazzy" )
173+ ament_target_dependencies(${PROJECT_NAME} _imu
174+ rclcpp
175+ sensor_msgs
176+ webots_ros2_msgs
177+ pluginlib
178+ tf2_ros
179+ )
180+ target_link_libraries (${PROJECT_NAME} _imu
181+ ${WEBOTS_LIB}
182+ )
183+ else ()
184+ target_link_libraries (${PROJECT_NAME} _imu
185+ rclcpp::rclcpp
186+ ${sensor_msgs_TARGETS}
187+ ${webots_ros2_msgs_TARGETS}
188+ pluginlib::pluginlib
189+ tf2_ros::tf2_ros
190+ ${WEBOTS_LIB}
191+ )
192+ endif ()
156193add_dependencies (${PROJECT_NAME} _imu
157194 compile-lib-vehicle
158195)
159- target_link_libraries (${PROJECT_NAME} _imu
160- ${WEBOTS_LIB}
161- )
162196install (TARGETS ${PROJECT_NAME} _imu
163197 RUNTIME DESTINATION bin
164198 ARCHIVE DESTINATION lib
@@ -174,18 +208,28 @@ add_library(
174208 src/plugins/Ros2SensorPlugin.cpp
175209 src/utils/Utils.cpp
176210)
177- ament_target_dependencies(${PROJECT_NAME} _rgbd
178- rclcpp
179- sensor_msgs
180- pluginlib
181- tf2_ros
182- )
211+ if ($ENV{ROS_DISTRO} MATCHES "humble" OR $ENV{ROS_DISTRO} MATCHES "jazzy" )
212+ ament_target_dependencies(${PROJECT_NAME} _rgbd
213+ rclcpp
214+ sensor_msgs
215+ pluginlib
216+ tf2_ros
217+ )
218+ target_link_libraries (${PROJECT_NAME} _rgbd
219+ ${WEBOTS_LIB}
220+ )
221+ else ()
222+ target_link_libraries (${PROJECT_NAME} _rgbd
223+ rclcpp::rclcpp
224+ ${sensor_msgs_TARGETS}
225+ pluginlib::pluginlib
226+ tf2_ros::tf2_ros
227+ ${WEBOTS_LIB}
228+ )
229+ endif ()
183230add_dependencies (${PROJECT_NAME} _rgbd
184231 compile-lib-vehicle
185232)
186- target_link_libraries (${PROJECT_NAME} _rgbd
187- ${WEBOTS_LIB}
188- )
189233install (TARGETS ${PROJECT_NAME} _rgbd
190234 RUNTIME DESTINATION bin
191235 ARCHIVE DESTINATION lib
@@ -272,4 +316,5 @@ ament_export_libraries(
272316 ${PROJECT_NAME} _rgbd
273317 ${WEBOTS_LIB_PATH}
274318)
319+
275320ament_package()
0 commit comments