Skip to content

Commit

Permalink
refactor(behavior_velocity_planner): simplify CMakeLists.txt (#855)
Browse files Browse the repository at this point in the history
Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>
  • Loading branch information
kenji-miyake committed May 9, 2022
1 parent e679068 commit b3a0363
Showing 1 changed file with 27 additions and 269 deletions.
296 changes: 27 additions & 269 deletions planning/behavior_velocity_planner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,292 +11,50 @@ find_package(Eigen3 REQUIRED)
find_package(PCL REQUIRED COMPONENTS common)
find_package(OpenCV REQUIRED)

set(BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES
tier4_api_msgs
autoware_auto_perception_msgs
autoware_auto_planning_msgs
tier4_planning_msgs
tier4_autoware_utils
Boost
Eigen3
diagnostic_msgs
geometry_msgs
lanelet2_extension
PCL
pcl_conversions
rclcpp
sensor_msgs
interpolation
tf2
tf2_eigen
tf2_geometry_msgs
tf2_ros
vehicle_info_util
visualization_msgs
nav_msgs
grid_map_ros
)
set(scene_modules
detection_area
blind_spot
stop_line
crosswalk
traffic_light
intersection
no_stopping_area
virtual_traffic_light
occlusion_spot
)

foreach(scene_module IN LISTS scene_modules)
file(GLOB_RECURSE scene_module_src "src/scene_module/${scene_module}/*")
list(APPEND scene_modules_src ${scene_module_src})
endforeach()


# Common
ament_auto_add_library(scene_module_lib SHARED
ament_auto_add_library(behavior_velocity_planner SHARED
src/node.cpp
src/planner_manager.cpp
src/utilization/path_utilization.cpp
src/utilization/util.cpp
${scene_modules_src}
)

target_include_directories(scene_module_lib
target_include_directories(behavior_velocity_planner
SYSTEM PUBLIC
${BOOST_INCLUDE_DIRS}
${tf2_geometry_msgs_INCLUDE_DIRS}
)

target_include_directories(scene_module_lib
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

target_include_directories(scene_module_lib
SYSTEM PUBLIC
${PCL_INCLUDE_DIRS}
)

ament_target_dependencies(scene_module_lib ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES})

# Scene Module: Stop Line
ament_auto_add_library(scene_module_stop_line SHARED
src/scene_module/stop_line/manager.cpp
src/scene_module/stop_line/scene.cpp
src/scene_module/stop_line/debug.cpp
)

target_include_directories(scene_module_stop_line
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

ament_target_dependencies(scene_module_stop_line ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES})

target_link_libraries(scene_module_stop_line scene_module_lib)

# Scene Module: Crosswalk
ament_auto_add_library(scene_module_crosswalk SHARED
src/scene_module/crosswalk/manager.cpp
src/scene_module/crosswalk/scene_crosswalk.cpp
src/scene_module/crosswalk/scene_walkway.cpp
src/scene_module/crosswalk/debug.cpp
src/scene_module/crosswalk/util.cpp
)

target_include_directories(scene_module_crosswalk
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

ament_target_dependencies(scene_module_crosswalk ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES})

target_link_libraries(scene_module_crosswalk scene_module_lib)

# Scene Module: Intersection
ament_auto_add_library(scene_module_intersection SHARED
src/scene_module/intersection/manager.cpp
src/scene_module/intersection/scene_intersection.cpp
src/scene_module/intersection/scene_merge_from_private_road.cpp
src/scene_module/intersection/debug.cpp
src/scene_module/intersection/util.cpp
)

target_include_directories(scene_module_intersection
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

ament_target_dependencies(scene_module_intersection ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES})

target_link_libraries(scene_module_intersection scene_module_lib)

# Scene Module: Traffic Light
ament_auto_add_library(scene_module_traffic_light SHARED
src/scene_module/traffic_light/manager.cpp
src/scene_module/traffic_light/scene.cpp
src/scene_module/traffic_light/debug.cpp
)

target_include_directories(scene_module_traffic_light
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

ament_target_dependencies(scene_module_traffic_light ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES})

target_link_libraries(scene_module_traffic_light scene_module_lib)

# Scene Module: Blind Spot
ament_auto_add_library(scene_module_blind_spot SHARED
src/scene_module/blind_spot/manager.cpp
src/scene_module/blind_spot/scene.cpp
src/scene_module/blind_spot/debug.cpp
)

target_include_directories(scene_module_blind_spot
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

ament_target_dependencies(scene_module_blind_spot ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES})

target_link_libraries(scene_module_blind_spot scene_module_lib)

# Scene Module: Detection Area
ament_auto_add_library(scene_module_detection_area SHARED
src/scene_module/detection_area/manager.cpp
src/scene_module/detection_area/scene.cpp
src/scene_module/detection_area/debug.cpp
)

target_include_directories(scene_module_detection_area
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

ament_target_dependencies(scene_module_detection_area ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES})

target_link_libraries(scene_module_detection_area scene_module_lib)

# Scene Module: No Stopping Area
ament_auto_add_library(scene_module_no_stopping_area SHARED
src/scene_module/no_stopping_area/manager.cpp
src/scene_module/no_stopping_area/scene_no_stopping_area.cpp
src/scene_module/no_stopping_area/debug.cpp
)

target_include_directories(scene_module_no_stopping_area
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

ament_target_dependencies(scene_module_no_stopping_area ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES})

target_link_libraries(scene_module_no_stopping_area scene_module_lib)

# Scene Module: Virtual Traffic Light
ament_auto_add_library(scene_module_virtual_traffic_light SHARED
src/scene_module/virtual_traffic_light/manager.cpp
src/scene_module/virtual_traffic_light/scene.cpp
src/scene_module/virtual_traffic_light/debug.cpp
)

target_include_directories(scene_module_virtual_traffic_light
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

ament_target_dependencies(scene_module_virtual_traffic_light ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES})

target_link_libraries(scene_module_virtual_traffic_light scene_module_lib)

# SceneModule OcclusionSpot
# Util
ament_auto_add_library(occlusion_spot_lib SHARED
src/scene_module/occlusion_spot/grid_utils.cpp
src/scene_module/occlusion_spot/occlusion_spot_utils.cpp
src/scene_module/occlusion_spot/risk_predictive_braking.cpp
)

target_include_directories(occlusion_spot_lib
SYSTEM PUBLIC
${BOOST_INCLUDE_DIRS}
${tf2_geometry_msgs_INCLUDE_DIRS}
)

target_include_directories(occlusion_spot_lib
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

ament_target_dependencies(occlusion_spot_lib ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES})

ament_auto_add_library(scene_module_occlusion_spot SHARED
src/scene_module/occlusion_spot/manager.cpp
src/scene_module/occlusion_spot/debug.cpp
src/scene_module/occlusion_spot/scene_occlusion_spot.cpp
)

target_include_directories(scene_module_occlusion_spot
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

ament_target_dependencies(scene_module_occlusion_spot ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES})

target_link_libraries(scene_module_occlusion_spot scene_module_lib occlusion_spot_lib)

# Scene Module Manager
ament_auto_add_library(scene_module_manager SHARED
src/planner_manager.cpp
)

target_include_directories(scene_module_manager
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

ament_target_dependencies(scene_module_manager ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES})

target_link_libraries(scene_module_manager scene_module_lib)

# Node
ament_auto_add_library(behavior_velocity_planner SHARED
src/node.cpp
)

target_include_directories(behavior_velocity_planner
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

ament_target_dependencies(behavior_velocity_planner ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES})

target_link_libraries(behavior_velocity_planner
scene_module_lib
scene_module_stop_line
scene_module_crosswalk
scene_module_intersection
scene_module_traffic_light
scene_module_blind_spot
scene_module_occlusion_spot
scene_module_detection_area
scene_module_no_stopping_area
scene_module_virtual_traffic_light
scene_module_manager
ament_target_dependencies(behavior_velocity_planner
Boost
Eigen3
PCL
)

ament_export_dependencies(${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES})

rclcpp_components_register_node(behavior_velocity_planner
PLUGIN "behavior_velocity_planner::BehaviorVelocityPlannerNode"
EXECUTABLE behavior_velocity_planner_node
)


if(BUILD_TESTING)
# utils for test
ament_auto_add_library(utilization SHARED
src/utilization/util.cpp
)

# Gtest for utilization
ament_add_gtest(utilization-test
test/src/test_state_machine.cpp
Expand All @@ -305,7 +63,7 @@ if(BUILD_TESTING)
)
target_link_libraries(utilization-test
gtest_main
utilization
behavior_velocity_planner
)

# Gtest for occlusion spot
Expand All @@ -316,7 +74,7 @@ if(BUILD_TESTING)
)
target_link_libraries(occlusion_spot-test
gtest_main
scene_module_occlusion_spot
behavior_velocity_planner
)
endif()

Expand Down

0 comments on commit b3a0363

Please sign in to comment.