update hieplm

This commit is contained in:
HiepLM 2026-01-05 13:37:48 +07:00
parent fb03bdf2e8
commit 5c276afb34
18 changed files with 327 additions and 59 deletions

View File

@ -4,6 +4,36 @@ project(robot_geometry_msgs)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
# ========================================================
# Dual-mode CMakeLists.txt: Supports both Catkin and Standalone CMake
# ========================================================
# Detect if building with Catkin
if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL)
set(BUILDING_WITH_CATKIN TRUE)
message(STATUS "Building robot_geometry_msgs with Catkin")
else()
set(BUILDING_WITH_CATKIN FALSE)
message(STATUS "Building robot_geometry_msgs with Standalone CMake")
endif()
# ========================================================
# Catkin specific configuration
# ========================================================
if(BUILDING_WITH_CATKIN)
find_package(catkin REQUIRED COMPONENTS robot_std_msgs utils robot_time)
## The catkin_package macro generates cmake config files for your package
## Note: Dependencies (robot_std_msgs, utils, etc.) are not Catkin packages,
## they are built as CMake targets in the same workspace and will be available
## when this package is built. They are linked via target_link_libraries instead of CATKIN_DEPENDS
catkin_package(
INCLUDE_DIRS include
# LIBRARIES không cn vì đây là header-only library
# CATKIN_DEPENDS không cn vì dependencies không phi Catkin packages
)
endif()
# Thư vin header-only # Thư vin header-only
add_library(robot_geometry_msgs INTERFACE) add_library(robot_geometry_msgs INTERFACE)
@ -21,13 +51,22 @@ target_link_libraries(robot_geometry_msgs INTERFACE robot_std_msgs utils)
add_library(geometry_msgs ALIAS robot_geometry_msgs) add_library(geometry_msgs ALIAS robot_geometry_msgs)
# --- Cài đt thư vin vào h thng khi chy make install --- # --- Cài đt thư vin vào h thng khi chy make install ---
# Export target trong mi trưng hp đ các target khác có th export và ph thuc vào nó
install(TARGETS robot_geometry_msgs install(TARGETS robot_geometry_msgs
EXPORT robot_geometry_msgs-targets EXPORT robot_geometry_msgs-targets
INCLUDES DESTINATION include # Cài đt include INCLUDES DESTINATION include # Cài đt include
) )
# --- Xut export set robot_costmap_2dTargets thành file CMake module --- if(NOT BUILDING_WITH_CATKIN)
# --- To file lib/cmake/robot_geometry_msgs/robot_costmap_2dTargets.cmake --- # Install headers for standalone mode
install(DIRECTORY include/
DESTINATION include
FILES_MATCHING PATTERN "*.h"
)
endif()
# --- Xut export set robot_geometry_msgs-targets thành file CMake module ---
# --- To file lib/cmake/robot_geometry_msgs/robot_geometry_msgs-targets.cmake ---
# --- File này cha cu hình giúp project khác có th dùng --- # --- File này cha cu hình giúp project khác có th dùng ---
# --- Find_package(robot_geometry_msgs REQUIRED) --- # --- Find_package(robot_geometry_msgs REQUIRED) ---
# --- Target_link_libraries(my_app PRIVATE robot_geometry_msgs::robot_geometry_msgs) --- # --- Target_link_libraries(my_app PRIVATE robot_geometry_msgs::robot_geometry_msgs) ---

View File

@ -19,8 +19,12 @@
<buildtool_depend version_gte="0.5.68">catkin</buildtool_depend> <buildtool_depend version_gte="0.5.68">catkin</buildtool_depend>
<build_depend>libconsole-bridge-dev</build_depend> <build_depend>robot_std_msgs</build_depend>
<build_depend>utils</build_depend>
<build_depend>robot_time</build_depend>
<run_depend>libconsole-bridge-dev</run_depend> <run_depend>robot_std_msgs</run_depend>
<run_depend>utils</run_depend>
<run_depend>robot_time</run_depend>
</package> </package>

View File

@ -4,6 +4,27 @@ project(robot_map_msgs)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
# ========================================================
# Catkin specific configuration
# ========================================================
if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL)
set(BUILDING_WITH_CATKIN TRUE)
message(STATUS "Building robot_map_msgs with Catkin")
else()
set(BUILDING_WITH_CATKIN FALSE)
message(STATUS "Building robot_map_msgs with Standalone CMake")
endif()
if(BUILDING_WITH_CATKIN)
find_package(catkin REQUIRED COMPONENTS robot_std_msgs)
## The catkin_package macro generates cmake config files for your package
catkin_package(
INCLUDE_DIRS include
# LIBRARIES không cn vì đây là header-only library
)
endif()
# Thư vin header-only # Thư vin header-only
add_library(robot_map_msgs INTERFACE) add_library(robot_map_msgs INTERFACE)
@ -18,13 +39,22 @@ target_include_directories(robot_map_msgs
target_link_libraries(robot_map_msgs INTERFACE robot_std_msgs) target_link_libraries(robot_map_msgs INTERFACE robot_std_msgs)
# --- Cài đt thư vin vào h thng khi chy make install --- # --- Cài đt thư vin vào h thng khi chy make install ---
# Export target trong mi trưng hp đ các target khác có th export và ph thuc vào nó
install(TARGETS robot_map_msgs install(TARGETS robot_map_msgs
EXPORT robot_map_msgs-targets EXPORT robot_map_msgs-targets
INCLUDES DESTINATION include # Cài đt include INCLUDES DESTINATION include # Cài đt include
) )
# --- Xut export set robot_costmap_2dTargets thành file CMake module --- if(NOT BUILDING_WITH_CATKIN)
# --- To file lib/cmake/robot_map_msgs/robot_costmap_2dTargets.cmake --- # Install headers for standalone mode
install(DIRECTORY include/
DESTINATION include
FILES_MATCHING PATTERN "*.h"
)
endif()
# --- Xut export set robot_map_msgs-targets thành file CMake module ---
# --- To file lib/cmake/robot_map_msgs/robot_map_msgs-targets.cmake ---
# --- File này cha cu hình giúp project khác có th dùng --- # --- File này cha cu hình giúp project khác có th dùng ---
# --- Find_package(robot_map_msgs REQUIRED) --- # --- Find_package(robot_map_msgs REQUIRED) ---
# --- Target_link_libraries(my_app PRIVATE robot_map_msgs::robot_map_msgs) --- # --- Target_link_libraries(my_app PRIVATE robot_map_msgs::robot_map_msgs) ---

View File

@ -2,7 +2,8 @@
#define ROBOT_OCCUPANCY_GRID_UPDATE_H #define ROBOT_OCCUPANCY_GRID_UPDATE_H
#include <vector> #include <vector>
#include "robot_std_msgs/Header.h" #include <robot_std_msgs/Header.h>
namespace robot_map_msgs namespace robot_map_msgs
{ {
struct OccupancyGridUpdate struct OccupancyGridUpdate

View File

@ -1,13 +1,8 @@
<package> <package>
<name>robot_nav_msgs</name> <name>robot_map_msgs</name>
<version>0.7.10</version> <version>0.7.10</version>
<description> <description>
robot_nav_msgs is the second generation of the transform library, which lets robot_map_msgs provides message types for map-related data structures.
the user keep track of multiple coordinate frames over time. robot_nav_msgs
maintains the relationship between coordinate frames in a tree
structure buffered in time, and lets the user transform points,
vectors, etc between any two coordinate frames at any desired
point in time.
</description> </description>
<author>Tully Foote</author> <author>Tully Foote</author>
<author>Eitan Marder-Eppstein</author> <author>Eitan Marder-Eppstein</author>
@ -15,12 +10,11 @@
<maintainer email="tfoote@osrfoundation.org">Tully Foote</maintainer> <maintainer email="tfoote@osrfoundation.org">Tully Foote</maintainer>
<license>BSD</license> <license>BSD</license>
<url type="website">http://www.ros.org/wiki/robot_nav_msgs</url> <url type="website">http://www.ros.org/wiki/robot_map_msgs</url>
<buildtool_depend version_gte="0.5.68">catkin</buildtool_depend> <buildtool_depend version_gte="0.5.68">catkin</buildtool_depend>
<build_depend>libconsole-bridge-dev</build_depend> <build_depend>robot_std_msgs</build_depend>
<run_depend>robot_std_msgs</run_depend>
<run_depend>libconsole-bridge-dev</run_depend>
</package> </package>

View File

@ -4,6 +4,31 @@ project(robot_nav_msgs)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
# ========================================================
# Catkin specific configuration
# ========================================================
if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL)
set(BUILDING_WITH_CATKIN TRUE)
message(STATUS "Building robot_nav_msgs with Catkin")
else()
set(BUILDING_WITH_CATKIN FALSE)
message(STATUS "Building robot_nav_msgs with Standalone CMake")
endif()
if(BUILDING_WITH_CATKIN)
find_package(catkin REQUIRED COMPONENTS robot_std_msgs robot_geometry_msgs)
## The catkin_package macro generates cmake config files for your package
## Note: Dependencies (robot_std_msgs, robot_geometry_msgs, etc.) are not Catkin packages,
## they are built as CMake targets in the same workspace and will be available
## when this package is built. They are linked via target_link_libraries instead of CATKIN_DEPENDS
catkin_package(
INCLUDE_DIRS include
# LIBRARIES không cn vì đây là header-only library
# CATKIN_DEPENDS không cn vì dependencies không phi Catkin packages
)
endif()
# Thư vin header-only # Thư vin header-only
add_library(robot_nav_msgs INTERFACE) add_library(robot_nav_msgs INTERFACE)
@ -22,13 +47,22 @@ target_link_libraries(robot_nav_msgs INTERFACE
) )
# --- Cài đt thư vin vào h thng khi chy make install --- # --- Cài đt thư vin vào h thng khi chy make install ---
# Export target trong mi trưng hp đ các target khác có th export và ph thuc vào nó
install(TARGETS robot_nav_msgs install(TARGETS robot_nav_msgs
EXPORT robot_nav_msgs-targets EXPORT robot_nav_msgs-targets
INCLUDES DESTINATION include # Cài đt include INCLUDES DESTINATION include # Cài đt include
) )
# --- Xut export set robot_costmap_2dTargets thành file CMake module --- if(NOT BUILDING_WITH_CATKIN)
# --- To file lib/cmake/robot_nav_msgs/robot_costmap_2dTargets.cmake --- # Install headers for standalone mode
install(DIRECTORY include/
DESTINATION include
FILES_MATCHING PATTERN "*.h"
)
endif()
# --- Xut export set robot_nav_msgs-targets thành file CMake module ---
# --- To file lib/cmake/robot_nav_msgs/robot_nav_msgs-targets.cmake ---
# --- File này cha cu hình giúp project khác có th dùng --- # --- File này cha cu hình giúp project khác có th dùng ---
# --- Find_package(robot_nav_msgs REQUIRED) --- # --- Find_package(robot_nav_msgs REQUIRED) ---
# --- Target_link_libraries(my_app PRIVATE robot_nav_msgs::robot_nav_msgs) --- # --- Target_link_libraries(my_app PRIVATE robot_nav_msgs::robot_nav_msgs) ---

View File

@ -1,9 +1,9 @@
<package> <package>
<name>robot_robot_nav_msgs</name> <name>robot_nav_msgs</name>
<version>0.7.10</version> <version>0.7.10</version>
<description> <description>
robot_robot_nav_msgs is the second generation of the transform library, which lets robot_nav_msgs is the second generation of the transform library, which lets
the user keep track of multiple coordinate frames over time. robot_robot_nav_msgs the user keep track of multiple coordinate frames over time. robot_nav_msgs
maintains the relationship between coordinate frames in a tree maintains the relationship between coordinate frames in a tree
structure buffered in time, and lets the user transform points, structure buffered in time, and lets the user transform points,
vectors, etc between any two coordinate frames at any desired vectors, etc between any two coordinate frames at any desired
@ -15,12 +15,13 @@
<maintainer email="tfoote@osrfoundation.org">Tully Foote</maintainer> <maintainer email="tfoote@osrfoundation.org">Tully Foote</maintainer>
<license>BSD</license> <license>BSD</license>
<url type="website">http://www.ros.org/wiki/robot_robot_nav_msgs</url> <url type="website">http://www.ros.org/wiki/robot_nav_msgs</url>
<buildtool_depend version_gte="0.5.68">catkin</buildtool_depend> <buildtool_depend version_gte="0.5.68">catkin</buildtool_depend>
<build_depend>libconsole-bridge-dev</build_depend> <build_depend>robot_std_msgs</build_depend>
<build_depend>robot_geometry_msgs</build_depend>
<run_depend>libconsole-bridge-dev</run_depend>
<run_depend>robot_std_msgs</run_depend>
<run_depend>robot_geometry_msgs</run_depend>
</package> </package>

View File

@ -4,6 +4,28 @@ project(robot_protocol_msgs)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
# ========================================================
# Catkin specific configuration
# ========================================================
if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL)
set(BUILDING_WITH_CATKIN TRUE)
message(STATUS "Building robot_protocol_msgs with Catkin")
else()
set(BUILDING_WITH_CATKIN FALSE)
message(STATUS "Building robot_protocol_msgs with Standalone CMake")
endif()
if(BUILDING_WITH_CATKIN)
find_package(catkin REQUIRED COMPONENTS robot_std_msgs robot_geometry_msgs)
## The catkin_package macro generates cmake config files for your package
catkin_package(
INCLUDE_DIRS include
LIBRARIES robot_protocol_msgs
CATKIN_DEPENDS robot_std_msgs robot_geometry_msgs
)
endif()
# Thư vin header-only # Thư vin header-only
add_library(robot_protocol_msgs INTERFACE) add_library(robot_protocol_msgs INTERFACE)
@ -18,16 +40,19 @@ target_include_directories(robot_protocol_msgs
target_link_libraries(robot_protocol_msgs INTERFACE) target_link_libraries(robot_protocol_msgs INTERFACE)
# --- Cài đt thư vin vào h thng khi chy make install --- # --- Cài đt thư vin vào h thng khi chy make install ---
# Export target trong mi trưng hp đ các target khác có th export và ph thuc vào nó
install(TARGETS robot_protocol_msgs install(TARGETS robot_protocol_msgs
EXPORT robot_protocol_msgs-targets EXPORT robot_protocol_msgs-targets
INCLUDES DESTINATION include # Cài đt include INCLUDES DESTINATION include # Cài đt include
) )
# --- Cài đt headers --- if(NOT BUILDING_WITH_CATKIN)
# Install headers for standalone mode
install(DIRECTORY include/ install(DIRECTORY include/
DESTINATION include DESTINATION include
FILES_MATCHING PATTERN "*.h" FILES_MATCHING PATTERN "*.h"
) )
endif()
# --- Xut export set robot_protocol_msgs-targets thành file CMake module --- # --- Xut export set robot_protocol_msgs-targets thành file CMake module ---
# --- To file lib/cmake/robot_protocol_msgs/robot_protocol_msgs-targets.cmake --- # --- To file lib/cmake/robot_protocol_msgs/robot_protocol_msgs-targets.cmake ---

View File

@ -19,8 +19,8 @@
<buildtool_depend version_gte="0.5.68">catkin</buildtool_depend> <buildtool_depend version_gte="0.5.68">catkin</buildtool_depend>
<build_depend>libconsole-bridge-dev</build_depend> <build_depend>robot_std_msgs</build_depend>
<build_depend>robot_geometry_msgs</build_depend>
<run_depend>libconsole-bridge-dev</run_depend> <run_depend>robot_std_msgs</run_depend>
<run_depend>robot_geometry_msgs</run_depend>
</package> </package>

View File

@ -4,6 +4,28 @@ project(robot_sensor_msgs)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
# ========================================================
# Catkin specific configuration
# ========================================================
if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL)
set(BUILDING_WITH_CATKIN TRUE)
message(STATUS "Building robot_sensor_msgs with Catkin")
else()
set(BUILDING_WITH_CATKIN FALSE)
message(STATUS "Building robot_sensor_msgs with Standalone CMake")
endif()
if(BUILDING_WITH_CATKIN)
find_package(catkin REQUIRED COMPONENTS robot_std_msgs robot_geometry_msgs)
## The catkin_package macro generates cmake config files for your package
catkin_package(
INCLUDE_DIRS include
LIBRARIES robot_sensor_msgs
CATKIN_DEPENDS robot_std_msgs robot_geometry_msgs
)
endif()
# Thư vin header-only # Thư vin header-only
add_library(robot_sensor_msgs INTERFACE) add_library(robot_sensor_msgs INTERFACE)
@ -18,13 +40,22 @@ target_include_directories(robot_sensor_msgs
target_link_libraries(robot_sensor_msgs INTERFACE robot_std_msgs) target_link_libraries(robot_sensor_msgs INTERFACE robot_std_msgs)
# --- Cài đt thư vin vào h thng khi chy make install --- # --- Cài đt thư vin vào h thng khi chy make install ---
# Export target trong mi trưng hp đ các target khác có th export và ph thuc vào nó
install(TARGETS robot_sensor_msgs install(TARGETS robot_sensor_msgs
EXPORT robot_sensor_msgs-targets EXPORT robot_sensor_msgs-targets
INCLUDES DESTINATION include # Cài đt include INCLUDES DESTINATION include # Cài đt include
) )
# --- Xut export set robot_costmap_2dTargets thành file CMake module --- if(NOT BUILDING_WITH_CATKIN)
# --- To file lib/cmake/robot_sensor_msgs/robot_costmap_2dTargets.cmake --- # Install headers for standalone mode
install(DIRECTORY include/
DESTINATION include
FILES_MATCHING PATTERN "*.h"
)
endif()
# --- Xut export set robot_sensor_msgs-targets thành file CMake module ---
# --- To file lib/cmake/robot_sensor_msgs/robot_sensor_msgs-targets.cmake ---
# --- File này cha cu hình giúp project khác có th dùng --- # --- File này cha cu hình giúp project khác có th dùng ---
# --- Find_package(robot_sensor_msgs REQUIRED) --- # --- Find_package(robot_sensor_msgs REQUIRED) ---
# --- Target_link_libraries(my_app PRIVATE robot_sensor_msgs::robot_sensor_msgs) --- # --- Target_link_libraries(my_app PRIVATE robot_sensor_msgs::robot_sensor_msgs) ---

View File

@ -19,8 +19,9 @@
<buildtool_depend version_gte="0.5.68">catkin</buildtool_depend> <buildtool_depend version_gte="0.5.68">catkin</buildtool_depend>
<build_depend>libconsole-bridge-dev</build_depend> <build_depend>robot_std_msgs</build_depend>
<build_depend>robot_geometry_msgs</build_depend>
<run_depend>libconsole-bridge-dev</run_depend> <run_depend>robot_std_msgs</run_depend>
<run_depend>robot_geometry_msgs</run_depend>
</package> </package>

View File

@ -4,6 +4,31 @@ project(robot_std_msgs)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
# ========================================================
# Catkin specific configuration
# ========================================================
if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL)
set(BUILDING_WITH_CATKIN TRUE)
message(STATUS "Building robot_std_msgs with Catkin")
else()
set(BUILDING_WITH_CATKIN FALSE)
message(STATUS "Building robot_std_msgs with Standalone CMake")
endif()
if(BUILDING_WITH_CATKIN)
find_package(catkin REQUIRED COMPONENTS robot_time)
## The catkin_package macro generates cmake config files for your package
## Note: Dependencies (robot_time, etc.) are not Catkin packages,
## they are built as CMake targets in the same workspace and will be available
## when this package is built. They are linked via target_link_libraries instead of CATKIN_DEPENDS
catkin_package(
INCLUDE_DIRS include
LIBRARIES robot_std_msgs
CATKIN_DEPENDS robot_time
)
endif()
add_library(robot_std_msgs INTERFACE) add_library(robot_std_msgs INTERFACE)
target_include_directories(robot_std_msgs target_include_directories(robot_std_msgs
@ -15,11 +40,20 @@ target_include_directories(robot_std_msgs
target_link_libraries(robot_std_msgs INTERFACE robot_time) target_link_libraries(robot_std_msgs INTERFACE robot_time)
# --- Cài đt thư vin vào h thng khi chy make install --- # --- Cài đt thư vin vào h thng khi chy make install ---
# Export target trong mi trưng hp đ các target khác có th export và ph thuc vào nó
install(TARGETS robot_std_msgs install(TARGETS robot_std_msgs
EXPORT robot_std_msgs-targets EXPORT robot_std_msgs-targets
INCLUDES DESTINATION include # Cài đt include INCLUDES DESTINATION include # Cài đt include
) )
if(NOT BUILDING_WITH_CATKIN)
# Install headers for standalone mode
install(DIRECTORY include/
DESTINATION include
FILES_MATCHING PATTERN "*.h"
)
endif()
# --- Xut export set robot_std_msgs-targets thành file CMake module --- # --- Xut export set robot_std_msgs-targets thành file CMake module ---
# --- To file lib/cmake/robot_std_msgs/robot_std_msgs-targets.cmake --- # --- To file lib/cmake/robot_std_msgs/robot_std_msgs-targets.cmake ---
# --- File này cha cu hình giúp project khác có th dùng --- # --- File này cha cu hình giúp project khác có th dùng ---

View File

@ -19,8 +19,8 @@
<buildtool_depend version_gte="0.5.68">catkin</buildtool_depend> <buildtool_depend version_gte="0.5.68">catkin</buildtool_depend>
<build_depend>libconsole-bridge-dev</build_depend> <build_depend>robot_time</build_depend>
<run_depend>libconsole-bridge-dev</run_depend> <run_depend>robot_time</run_depend>
</package> </package>

View File

@ -1,9 +1,40 @@
cmake_minimum_required(VERSION 3.10) cmake_minimum_required(VERSION 3.10)
# ========================================================
# Dual-mode CMakeLists.txt: Supports both Catkin and Standalone CMake
# ========================================================
# Detect if building with Catkin
if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL)
set(BUILDING_WITH_CATKIN TRUE)
message(STATUS "Building robot_visualization_msgs with Catkin")
find_package(catkin REQUIRED)
else()
set(BUILDING_WITH_CATKIN FALSE)
message(STATUS "Building robot_visualization_msgs with Standalone CMake")
endif()
project(robot_visualization_msgs) project(robot_visualization_msgs)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
# ========================================================
# Catkin specific configuration
# ========================================================
if(BUILDING_WITH_CATKIN)
## The catkin_package macro generates cmake config files for your package
## Note: Dependencies (robot_std_msgs) is not a Catkin package,
## it is built as a CMake target in the same workspace and will be available
## when this package is built. It is linked via target_link_libraries instead of CATKIN_DEPENDS
catkin_package(
INCLUDE_DIRS include
# LIBRARIES không cn vì đây là header-only library
# CATKIN_DEPENDS không cn vì dependencies không phi Catkin packages
)
endif()
# Thư vin header-only # Thư vin header-only
add_library(robot_visualization_msgs INTERFACE) add_library(robot_visualization_msgs INTERFACE)
@ -14,17 +45,37 @@ target_include_directories(robot_visualization_msgs
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
) )
# Add include directories from dependencies explicitly for Catkin build
if(BUILDING_WITH_CATKIN)
# Use relative paths from current source directory
# From robot_visualization_msgs (pnkx_nav_core/src/Libraries/common_msgs/robot_visualization_msgs)
# to robot_std_msgs (pnkx_nav_core/src/Libraries/common_msgs/robot_std_msgs) is ../robot_std_msgs
get_filename_component(ROBOT_STD_MSGS_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/../robot_std_msgs/include" ABSOLUTE)
target_include_directories(robot_visualization_msgs INTERFACE
$<BUILD_INTERFACE:${ROBOT_STD_MSGS_INCLUDE}>
)
endif()
# Liên kết vi robot_std_msgs nếu bn có file Header.h trong include/robot_std_msgs/ # Liên kết vi robot_std_msgs nếu bn có file Header.h trong include/robot_std_msgs/
target_link_libraries(robot_visualization_msgs INTERFACE robot_std_msgs) target_link_libraries(robot_visualization_msgs INTERFACE robot_std_msgs)
# --- Cài đt thư vin vào h thng khi chy make install --- # --- Cài đt thư vin vào h thng khi chy make install ---
# Export target trong mi trưng hp đ các target khác có th export và ph thuc vào nó
install(TARGETS robot_visualization_msgs install(TARGETS robot_visualization_msgs
EXPORT robot_visualization_msgs-targets EXPORT robot_visualization_msgs-targets
INCLUDES DESTINATION include # Cài đt include INCLUDES DESTINATION include # Cài đt include
) )
# --- Xut export set robot_costmap_2dTargets thành file CMake module --- if(NOT BUILDING_WITH_CATKIN)
# --- To file lib/cmake/robot_visualization_msgs/robot_costmap_2dTargets.cmake --- # Install headers for standalone mode
install(DIRECTORY include/
DESTINATION include
FILES_MATCHING PATTERN "*.h"
)
endif()
# --- Xut export set robot_visualization_msgs-targets thành file CMake module ---
# --- To file lib/cmake/robot_visualization_msgs/robot_visualization_msgs-targets.cmake ---
# --- File này cha cu hình giúp project khác có th dùng --- # --- File này cha cu hình giúp project khác có th dùng ---
# --- Find_package(robot_visualization_msgs REQUIRED) --- # --- Find_package(robot_visualization_msgs REQUIRED) ---
# --- Target_link_libraries(my_app PRIVATE robot_visualization_msgs::robot_visualization_msgs) --- # --- Target_link_libraries(my_app PRIVATE robot_visualization_msgs::robot_visualization_msgs) ---

View File

@ -19,8 +19,5 @@
<buildtool_depend version_gte="0.5.68">catkin</buildtool_depend> <buildtool_depend version_gte="0.5.68">catkin</buildtool_depend>
<build_depend>libconsole-bridge-dev</build_depend>
<run_depend>libconsole-bridge-dev</run_depend>
</package> </package>

View File

@ -1,27 +1,57 @@
cmake_minimum_required(VERSION 3.10) cmake_minimum_required(VERSION 3.10)
# ========================================================
# Dual-mode CMakeLists.txt: Supports both Catkin and Standalone CMake
# ========================================================
# Detect if building with Catkin
if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL)
set(BUILDING_WITH_CATKIN TRUE)
message(STATUS "Building utils with Catkin")
find_package(catkin REQUIRED)
else()
set(BUILDING_WITH_CATKIN FALSE)
message(STATUS "Building utils with Standalone CMake")
endif()
# --- Project riêng cho utils --- # --- Project riêng cho utils ---
project(utils LANGUAGES CXX) project(utils LANGUAGES CXX)
# ========================================================
# Catkin specific configuration
# ========================================================
if(BUILDING_WITH_CATKIN)
## The catkin_package macro generates cmake config files for your package
catkin_package(
INCLUDE_DIRS include
# LIBRARIES không cn vì đây là header-only library
)
endif()
# --- To INTERFACE library (header-only) --- # --- To INTERFACE library (header-only) ---
add_library(utils INTERFACE) add_library(utils INTERFACE)
# --- Include directories --- # --- Include directories ---
target_include_directories(utils target_include_directories(utils
INTERFACE INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> # build ni b $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> # build ni b
$<INSTALL_INTERFACE:include/utils> # dùng khi install/export $<INSTALL_INTERFACE:include> # dùng khi install/export
) )
# --- Cài đt header files --- # --- Cài đt header files ---
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ if(NOT BUILDING_WITH_CATKIN)
DESTINATION include/utils install(DIRECTORY include/
DESTINATION include
FILES_MATCHING PATTERN "*.h" FILES_MATCHING PATTERN "*.h"
) )
endif()
# --- Cài đt target INTERFACE đ export --- # --- Cài đt target INTERFACE đ export ---
# Export target trong mi trưng hp đ các target khác có th export và ph thuc vào nó
install(TARGETS utils install(TARGETS utils
EXPORT utils-targets EXPORT utils-targets
INCLUDES DESTINATION include
) )
# --- Export target file --- # --- Export target file ---

View File

@ -19,8 +19,4 @@
<buildtool_depend version_gte="0.5.68">catkin</buildtool_depend> <buildtool_depend version_gte="0.5.68">catkin</buildtool_depend>
<build_depend>libconsole-bridge-dev</build_depend>
<run_depend>libconsole-bridge-dev</run_depend>
</package> </package>