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

fix(autoware_auto_tf2): modify build error in rolling #718

Merged
merged 8 commits into from
Apr 24, 2022
Merged
27 changes: 16 additions & 11 deletions common/autoware_auto_common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,25 @@ if(BUILD_TESTING)
# Unit tests
set(TEST_COMMON test_common_gtest)
ament_add_gtest(${TEST_COMMON}
test/gtest_main.cpp
test/test_bool_comparisons.cpp
test/test_byte_reader.cpp
test/test_float_comparisons.cpp
test/test_mahalanobis_distance.cpp
test/test_message_field_adapters.cpp
test/test_template_utils.cpp
test/test_angle_utils.cpp
test/test_type_name.cpp
test/test_type_traits.cpp)
test/gtest_main.cpp
test/test_bool_comparisons.cpp
test/test_byte_reader.cpp
test/test_float_comparisons.cpp
test/test_mahalanobis_distance.cpp
test/test_message_field_adapters.cpp
test/test_template_utils.cpp
test/test_angle_utils.cpp
test/test_type_name.cpp
test/test_type_traits.cpp
)
autoware_set_compile_options(${TEST_COMMON})
target_compile_options(${TEST_COMMON} PRIVATE -Wno-sign-conversion)
target_include_directories(${TEST_COMMON} PRIVATE include)
ament_target_dependencies(${TEST_COMMON} builtin_interfaces Eigen3)
ament_target_dependencies(${TEST_COMMON}
builtin_interfaces
Eigen3
geometry_msgs
)
endif()

# Ament Exporting
Expand Down
5 changes: 3 additions & 2 deletions common/autoware_auto_common/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
<buildtool_depend>ament_cmake_auto</buildtool_depend>
<buildtool_depend>autoware_auto_cmake</buildtool_depend>

<build_depend>builtin_interfaces</build_depend>
<build_depend>eigen</build_depend>
<depend>builtin_interfaces</depend>
<depend>eigen</depend>

<test_depend>ament_cmake_gtest</test_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>autoware_lint_common</test_depend>
<test_depend>geometry_msgs</test_depend>

<export>
<build_type>ament_cmake</build_type>
Expand Down
7 changes: 7 additions & 0 deletions common/autoware_auto_geometry/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ ament_auto_add_library(${PROJECT_NAME} SHARED
src/bounding_box.cpp)
autoware_set_compile_options(${PROJECT_NAME})

# workaround to allow deprecated header to build on both galactic and rolling
if(${tf2_geometry_msgs_VERSION} VERSION_LESS 0.18.0)
target_compile_definitions(${PROJECT_NAME} PRIVATE
USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER
)
endif()

if(BUILD_TESTING)
# run linters
find_package(ament_lint_auto REQUIRED)
Expand Down
9 changes: 8 additions & 1 deletion common/autoware_auto_tf2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ if(BUILD_TESTING)
# Unit test
ament_add_gtest(test_tf2_autoware_auto_msgs test/test_tf2_autoware_auto_msgs.cpp)
autoware_set_compile_options(test_tf2_autoware_auto_msgs)
# workaround to allow deprecated header to build on both galactic and rolling
if(${tf2_geometry_msgs_VERSION} VERSION_LESS 0.18.0)
target_compile_definitions(test_tf2_autoware_auto_msgs PRIVATE
USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER
)
endif()
target_include_directories(test_tf2_autoware_auto_msgs PRIVATE "include")
ament_target_dependencies(test_tf2_autoware_auto_msgs
"autoware_auto_common"
Expand All @@ -39,8 +45,9 @@ if(BUILD_TESTING)
"geometry_msgs"
"orocos_kdl"
"tf2"
"tf2_geometry_msgs"
"tf2_ros"
)
)
endif()

ament_auto_package()
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@

#include <tf2/convert.h>
#include <tf2/time.h>

#ifdef USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
#else
#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
#endif

#include <string>

Expand Down
1 change: 1 addition & 0 deletions common/autoware_auto_tf2/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<depend>geometry_msgs</depend>
<depend>orocos_kdl</depend>
<depend>tf2</depend>
<depend>tf2_geometry_msgs</depend>
<depend>tf2_ros</depend>

<test_depend>ament_cmake_gtest</test_depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <rclcpp/clock.hpp>

#include <gtest/gtest.h>
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
#include <tf2_ros/buffer.h>
#include <tf2_ros/transform_listener.h>

Expand Down
7 changes: 7 additions & 0 deletions common/motion_common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ ament_auto_add_library(${PROJECT_NAME} SHARED
)
autoware_set_compile_options(${PROJECT_NAME})

# workaround to allow deprecated header to build on both galactic and rolling
if(${tf2_geometry_msgs_VERSION} VERSION_LESS 0.18.0)
target_compile_definitions(${PROJECT_NAME} PRIVATE
USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER
)
endif()

### Test
if(BUILD_TESTING)
# Linters
Expand Down
5 changes: 5 additions & 0 deletions common/motion_common/include/motion_common/motion_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@

#include <tf2/LinearMath/Quaternion.h>
#include <tf2/utils.h>

#ifdef USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
#else
#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
#endif

#include <algorithm>
#include <cmath>
Expand Down
2 changes: 0 additions & 2 deletions common/motion_common/src/motion_common/motion_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#include "helper_functions/angle_utils.hpp"
#include "tf2/utils.h"

#include "tf2_geometry_msgs/tf2_geometry_msgs.h"

#include <algorithm>
#include <cmath>
#include <limits>
Expand Down
7 changes: 7 additions & 0 deletions common/motion_testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ ament_auto_find_build_dependencies()
ament_auto_add_library(${PROJECT_NAME} SHARED src/motion_testing/motion_testing.cpp)
autoware_set_compile_options(${PROJECT_NAME})

# workaround to allow deprecated header to build on both galactic and rolling
if(${tf2_geometry_msgs_VERSION} VERSION_LESS 0.18.0)
target_compile_definitions(${PROJECT_NAME} PRIVATE
USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER
)
endif()

### Test
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
Expand Down
5 changes: 5 additions & 0 deletions common/motion_testing/src/motion_testing/motion_testing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@
#include <tf2/LinearMath/Quaternion.h>
#include <tf2/convert.h>
#include <tf2/utils.h>

#ifdef USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
#else
#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
#endif

#include <limits>

Expand Down
13 changes: 13 additions & 0 deletions simulator/simple_planning_simulator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ autoware_set_compile_options(${PROJECT_NAME})

target_compile_options(${PROJECT_NAME} PRIVATE -Wno-old-style-cast) # RCLCPP_ERROR_THROTTLE() has built-in old-style casts.

# workaround to allow deprecated header to build on both galactic and rolling
if(${tf2_geometry_msgs_VERSION} VERSION_LESS 0.18.0)
target_compile_definitions(${PROJECT_NAME} PRIVATE
USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER
)
endif()

# Node executable
rclcpp_components_register_node(${PROJECT_NAME}
Expand All @@ -46,6 +52,13 @@ if(BUILD_TESTING)
target_link_libraries(test_simple_planning_simulator
${PROJECT_NAME}
)

# workaround to allow deprecated header to build on both galactic and rolling
if(${tf2_geometry_msgs_VERSION} VERSION_LESS 0.18.0)
target_compile_definitions(test_simple_planning_simulator PRIVATE
USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER
)
endif()
endif()


Expand Down
2 changes: 2 additions & 0 deletions simulator/simple_planning_simulator/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
<depend>motion_common</depend>
<depend>nav_msgs</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
<depend>tf2</depend>
<depend>tf2_geometry_msgs</depend>
<depend>tf2_ros</depend>
<depend>tier4_api_utils</depend>
<depend>tier4_autoware_utils</depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
#include "simple_planning_simulator/simple_planning_simulator_core.hpp"
#include "tf2/utils.h"

#ifdef USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER
#include "tf2_geometry_msgs/tf2_geometry_msgs.h"
#else
#include "tf2_geometry_msgs/tf2_geometry_msgs.hpp"
#endif

#include <memory>

using autoware_auto_control_msgs::msg::AckermannControlCommand;
Expand Down