Refactor CMake configuration to find installed unitree_sdk2 package instead of using a local path. Removed obsolete subdirectory addition and include paths. Cleaned up unnecessary install commands for config files.

This commit is contained in:
2025-09-07 17:11:20 +08:00
parent 6acff483dd
commit ecb4c602a1

View File

@@ -9,14 +9,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(PkgConfig REQUIRED)
find_package(Threads REQUIRED)
# Find unitree_sdk2
set(UNITREE_SDK2_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../unitree_sdk2")
if(NOT EXISTS ${UNITREE_SDK2_PATH})
message(FATAL_ERROR "unitree_sdk2 not found at ${UNITREE_SDK2_PATH}")
endif()
# Add unitree_sdk2 as subdirectory
add_subdirectory(${UNITREE_SDK2_PATH} unitree_sdk2)
# Find installed unitree_sdk2
find_package(unitree_sdk2 REQUIRED)
# Find MQTT library (Eclipse Paho)
pkg_check_modules(PAHO_MQTT REQUIRED libpaho-mqtt3c)
@@ -28,7 +22,6 @@ find_package(nlohmann_json REQUIRED)
# Include directories
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/include
${UNITREE_SDK2_PATH}/include
)
# Source files
@@ -69,7 +62,3 @@ install(TARGETS main
RUNTIME DESTINATION bin
)
# Copy config files
install(FILES config/robot_config.json
DESTINATION etc/${PROJECT_NAME}
)