optimal & fix file cmake

This commit is contained in:
2026-08-03 22:41:32 +07:00
parent d8babff20b
commit 701d25f952
70 changed files with 5572 additions and 1146 deletions

View File

@@ -70,6 +70,14 @@ if(NOT BUILDING_WITH_CATKIN)
${STANDALONE_PACKAGE_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
# These runtime packages are siblings while they still live below Test/.
# The explicit paths keep `cmake ..` in move_base2 working before the
# packages are moved below pnkx_nav_core/src.
${CMAKE_CURRENT_SOURCE_DIR}/../recovery_core/include
${CMAKE_CURRENT_SOURCE_DIR}/../action_core/include
${CMAKE_CURRENT_SOURCE_DIR}/../mission_adapters/include
${CMAKE_CURRENT_SOURCE_DIR}/../nav_test_harness/include
/usr/local/include
)
@@ -83,6 +91,14 @@ if(NOT BUILDING_WITH_CATKIN)
robot_cpp
robot_time
robot_xmlrpcpp
# move_base2 public headers and runners use these packages directly.
# When configured from the pnkx_nav_core root, these names resolve to
# CMake targets and propagate their public include directories.
recovery_core
action_core
mission_adapters
nav_test_harness
)
find_library(TF3_LIBRARY
@@ -91,7 +107,7 @@ if(NOT BUILDING_WITH_CATKIN)
)
if(NOT TF3_LIBRARY)
message(FATAL_ERROR "tf3 không tìm thấy — cài tf3 (/usr/local/lib/libtf3.so) trước khi build")
message(FATAL_ERROR "tf3 not found — install tf3 (/usr/local/lib/libtf3.so) before building")
endif()
if(EXISTS ${WORKSPACE_DEVEL_LIB_DIR})
@@ -127,7 +143,11 @@ else()
# RecoveryRunner include thẳng recovery_core: đó là chỗ duy nhất trong gói này biết tới nó.
recovery_core
# MissionAdapterBridge include thẳng mission_adapters: chỗ duy nhất trong gói này biết tới nó.
# ActionRunner include thẳng action_core: chỗ duy nhất trong gói này biết tới nó.
action_core
# `bridges/` include thẳng mission_adapters: biên duy nhất trong gói này biết tới nó
# (MissionAdapterBridge dịch contract, MissionLayer lắp ráp framework).
mission_adapters
# scenario_test chạy kịch bản khai báo qua khung của nav_test_harness.
@@ -140,7 +160,7 @@ else()
)
if(NOT TF3_LIBRARY)
message(FATAL_ERROR "tf3 không tìm thấy — cài tf3 (/usr/local/lib/libtf3.so) trước khi build")
message(FATAL_ERROR "tf3 not found — install tf3 (/usr/local/lib/libtf3.so) before building")
endif()
catkin_package(
@@ -150,7 +170,6 @@ else()
LIBRARIES
move_base2_core
move_base2
move_base2_noop_action_handler
CATKIN_DEPENDS
move_base_core
@@ -201,9 +220,11 @@ add_library(move_base2_core SHARED
src/runners/action_runner.cpp
src/runners/planner_runner.cpp
src/runners/controller_runner.cpp
src/io/runtime_stats.cpp
src/io/sensor_gateway.cpp
src/io/costmap_exporter.cpp
src/bridges/mission_adapter_bridge.cpp
src/bridges/mission_layer.cpp
src/navigation_runtime.cpp
)
@@ -217,35 +238,6 @@ target_include_directories(move_base2_core
)
# ========================================================
# ActionHandler mặc định — plugin riêng, nạp qua Boost.DLL như mọi handler khác.
# ========================================================
add_library(move_base2_noop_action_handler SHARED
plugins/noop_action_handler.cpp
)
target_compile_options(move_base2_noop_action_handler PRIVATE -Wall -Wextra)
target_include_directories(move_base2_noop_action_handler
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
set_target_properties(move_base2_noop_action_handler PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_link_libraries(move_base2_noop_action_handler
PUBLIC
move_base2_core
PRIVATE
${catkin_LIBRARIES}
Boost::boost
Boost::system
Boost::filesystem
${CMAKE_DL_LIBS}
)
# ========================================================
# Plugin library — facade BaseNavigation + export Boost.DLL.
# ========================================================
@@ -357,7 +349,7 @@ endif()
# ========================================================
if(BUILDING_WITH_CATKIN)
install(TARGETS move_base2_core move_base2 move_base2_noop_action_handler
install(TARGETS move_base2_core move_base2
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
@@ -374,7 +366,7 @@ if(BUILDING_WITH_CATKIN)
else()
install(TARGETS move_base2_core move_base2 move_base2_noop_action_handler
install(TARGETS move_base2_core move_base2
EXPORT ${PROJECT_NAME}-targets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
@@ -442,10 +434,12 @@ if(BUILD_MOVE_BASE2_TESTS AND BUILDING_WITH_CATKIN)
action_runner_test
recovery_runner_test
sensor_gateway_test
runtime_stats_test
navigation_server_test
planner_runner_test
controller_runner_test
mission_adapter_bridge_test
mission_layer_test
move_base2_scenario_test # tên có tiền tố gói: nav_test_harness đã có target scenario_test
)