update hieplm

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

View File

@@ -1,27 +1,57 @@
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(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 cần vì đây là header-only library
)
endif()
# --- Tạo INTERFACE library (header-only) ---
add_library(utils INTERFACE)
# --- Include directories ---
target_include_directories(utils
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> # build nội bộ
$<INSTALL_INTERFACE:include/utils> # dùng khi install/export
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> # build nội bộ
$<INSTALL_INTERFACE:include> # dùng khi install/export
)
# --- Cài đặt header files ---
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
DESTINATION include/utils
FILES_MATCHING PATTERN "*.h"
)
if(NOT BUILDING_WITH_CATKIN)
install(DIRECTORY include/
DESTINATION include
FILES_MATCHING PATTERN "*.h"
)
endif()
# --- Cài đặt target INTERFACE để export ---
# Export target trong mọi trường hợp để các target khác có thể export và phụ thuộc vào nó
install(TARGETS utils
EXPORT utils-targets
INCLUDES DESTINATION include
)
# --- Export target file ---

View File

@@ -19,8 +19,4 @@
<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>