fix file cmake
This commit is contained in:
parent
28a7d14498
commit
ff4856ab15
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# Bỏ qua thư mục build/
|
||||
build/
|
||||
|
|
@ -4,20 +4,39 @@ project(geometry_msgs)
|
|||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
if (NOT TARGET std_msgs)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../std_msgs ${CMAKE_BINARY_DIR}/std_msgs_build)
|
||||
endif()
|
||||
|
||||
# Thư viện header-only
|
||||
add_library(geometry_msgs INTERFACE)
|
||||
|
||||
# Include path tới thư mục chứa file header
|
||||
target_include_directories(geometry_msgs INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
target_include_directories(geometry_msgs
|
||||
INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
# Liên kết với std_msgs nếu bạn có file Header.h trong include/std_msgs/
|
||||
target_link_libraries(geometry_msgs INTERFACE std_msgs)
|
||||
|
||||
# --- Cài đặt thư viện vào hệ thống khi chạy make install ---
|
||||
install(TARGETS geometry_msgs
|
||||
EXPORT geometry_msgs-targets
|
||||
ARCHIVE DESTINATION lib # Thư viện tĩnh .a
|
||||
LIBRARY DESTINATION lib # Thư viện động .so
|
||||
RUNTIME DESTINATION bin # File thực thi (nếu có)
|
||||
INCLUDES DESTINATION include # Cài đặt include
|
||||
)
|
||||
|
||||
# --- Xuất export set costmap_2dTargets thành file CMake module ---
|
||||
# --- Tạo file lib/cmake/geometry_msgs/costmap_2dTargets.cmake ---
|
||||
# --- File này chứa cấu hình giúp project khác có thể dùng ---
|
||||
# --- Find_package(geometry_msgs REQUIRED) ---
|
||||
# --- Target_link_libraries(my_app PRIVATE geometry_msgs::geometry_msgs) ---
|
||||
install(EXPORT geometry_msgs-targets
|
||||
FILE geometry_msgs-targets.cmake
|
||||
NAMESPACE geometry_msgs::
|
||||
DESTINATION lib/cmake/geometry_msgs
|
||||
)
|
||||
|
||||
add_executable(test_geometry test/main.cpp)
|
||||
target_link_libraries(test_geometry PRIVATE geometry_msgs)
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ struct Pose
|
|||
{
|
||||
Point position;
|
||||
Quaternion orientation;
|
||||
|
||||
Pose() = default;
|
||||
};
|
||||
|
||||
} // namespace geometry_msgs
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ struct Quaternion
|
|||
double w;
|
||||
|
||||
// Constructor mặc định
|
||||
Quaternion() : x(0.0), y(0.0), z(0.0), w(0.0) {}
|
||||
Quaternion() : x(0.0), y(0.0), z(0.0), w(1.0) {}
|
||||
|
||||
// Constructor khởi tạo nhanh
|
||||
Quaternion(double x_, double y_, double z_, double w_)
|
||||
|
|
|
|||
|
|
@ -4,17 +4,35 @@ project(map_msgs)
|
|||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
if (NOT TARGET std_msgs)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../common_msgs/std_msgs ${CMAKE_BINARY_DIR}/std_msgs_build)
|
||||
endif()
|
||||
|
||||
# Thư viện header-only
|
||||
add_library(map_msgs INTERFACE)
|
||||
|
||||
# Include path tới thư mục chứa file header
|
||||
target_include_directories(map_msgs INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
target_include_directories(map_msgs
|
||||
INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
# Liên kết với std_msgs nếu bạn có file Header.h trong include/std_msgs/
|
||||
target_link_libraries(map_msgs INTERFACE std_msgs)
|
||||
|
||||
# --- Cài đặt thư viện vào hệ thống khi chạy make install ---
|
||||
install(TARGETS map_msgs
|
||||
EXPORT map_msgs-targets
|
||||
ARCHIVE DESTINATION lib # Thư viện tĩnh .a
|
||||
LIBRARY DESTINATION lib # Thư viện động .so
|
||||
RUNTIME DESTINATION bin # File thực thi (nếu có)
|
||||
INCLUDES DESTINATION include # Cài đặt include
|
||||
)
|
||||
|
||||
# --- Xuất export set costmap_2dTargets thành file CMake module ---
|
||||
# --- Tạo file lib/cmake/map_msgs/costmap_2dTargets.cmake ---
|
||||
# --- File này chứa cấu hình giúp project khác có thể dùng ---
|
||||
# --- Find_package(map_msgs REQUIRED) ---
|
||||
# --- Target_link_libraries(my_app PRIVATE map_msgs::map_msgs) ---
|
||||
install(EXPORT map_msgs-targets
|
||||
FILE map_msgs-targets.cmake
|
||||
NAMESPACE map_msgs::
|
||||
DESTINATION lib/cmake/map_msgs
|
||||
)
|
||||
|
|
@ -4,26 +4,42 @@ project(nav_msgs)
|
|||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
if (NOT TARGET std_msgs)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../std_msgs ${CMAKE_BINARY_DIR}/std_msgs_build)
|
||||
endif()
|
||||
if (NOT TARGET geometry_msgs)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../geometry_msgs ${CMAKE_BINARY_DIR}/geometry_msgs_build)
|
||||
endif()
|
||||
|
||||
# Thư viện header-only
|
||||
add_library(nav_msgs INTERFACE)
|
||||
|
||||
# Include path tới thư mục chứa file header
|
||||
target_include_directories(nav_msgs INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
target_include_directories(nav_msgs
|
||||
INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
# Liên kết với std_msgs nếu bạn có file Header.h trong include/std_msgs/
|
||||
target_link_libraries(nav_msgs INTERFACE
|
||||
std_msgs
|
||||
nav_msgs
|
||||
geometry_msgs
|
||||
)
|
||||
|
||||
# --- Cài đặt thư viện vào hệ thống khi chạy make install ---
|
||||
install(TARGETS nav_msgs
|
||||
EXPORT nav_msgs-targets
|
||||
ARCHIVE DESTINATION lib # Thư viện tĩnh .a
|
||||
LIBRARY DESTINATION lib # Thư viện động .so
|
||||
RUNTIME DESTINATION bin # File thực thi (nếu có)
|
||||
INCLUDES DESTINATION include # Cài đặt include
|
||||
)
|
||||
|
||||
# --- Xuất export set costmap_2dTargets thành file CMake module ---
|
||||
# --- Tạo file lib/cmake/nav_msgs/costmap_2dTargets.cmake ---
|
||||
# --- File này chứa cấu hình giúp project khác có thể dùng ---
|
||||
# --- Find_package(nav_msgs REQUIRED) ---
|
||||
# --- Target_link_libraries(my_app PRIVATE nav_msgs::nav_msgs) ---
|
||||
install(EXPORT nav_msgs-targets
|
||||
FILE nav_msgs-targets.cmake
|
||||
NAMESPACE nav_msgs::
|
||||
DESTINATION lib/cmake/nav_msgs
|
||||
)
|
||||
|
||||
add_executable(test_nav test/main.cpp)
|
||||
target_link_libraries(test_nav PRIVATE nav_msgs)
|
||||
|
|
|
|||
|
|
@ -4,21 +4,38 @@ project(sensor_msgs)
|
|||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
if (NOT TARGET std_msgs)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../std_msgs ${CMAKE_BINARY_DIR}/std_msgs_build)
|
||||
endif()
|
||||
|
||||
# Thư viện header-only
|
||||
add_library(sensor_msgs INTERFACE)
|
||||
|
||||
# Include path tới thư mục chứa file header
|
||||
target_include_directories(sensor_msgs INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
target_include_directories(sensor_msgs
|
||||
INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
# Liên kết với std_msgs nếu bạn có file Header.h trong include/std_msgs/
|
||||
target_link_libraries(sensor_msgs INTERFACE std_msgs)
|
||||
# target_link_libraries(sensor_msgs yaml-cpp)
|
||||
|
||||
# --- Cài đặt thư viện vào hệ thống khi chạy make install ---
|
||||
install(TARGETS sensor_msgs
|
||||
EXPORT sensor_msgs-targets
|
||||
ARCHIVE DESTINATION lib # Thư viện tĩnh .a
|
||||
LIBRARY DESTINATION lib # Thư viện động .so
|
||||
RUNTIME DESTINATION bin # File thực thi (nếu có)
|
||||
INCLUDES DESTINATION include # Cài đặt include
|
||||
)
|
||||
|
||||
# --- Xuất export set costmap_2dTargets thành file CMake module ---
|
||||
# --- Tạo file lib/cmake/sensor_msgs/costmap_2dTargets.cmake ---
|
||||
# --- File này chứa cấu hình giúp project khác có thể dùng ---
|
||||
# --- Find_package(sensor_msgs REQUIRED) ---
|
||||
# --- Target_link_libraries(my_app PRIVATE sensor_msgs::sensor_msgs) ---
|
||||
install(EXPORT sensor_msgs-targets
|
||||
FILE sensor_msgs-targets.cmake
|
||||
NAMESPACE sensor_msgs::
|
||||
DESTINATION lib/cmake/sensor_msgs
|
||||
)
|
||||
|
||||
# Tạo file test ví dụ
|
||||
add_executable(test_battery_state test/main.cpp)
|
||||
|
|
|
|||
|
|
@ -3,12 +3,32 @@ project(std_msgs)
|
|||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
if (NOT TARGET robot_time)
|
||||
# add_subdirectory(${CMAKE_SOURCE_DIR}/../robot_time ${CMAKE_BINARY_DIR}/robot_time_build)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../robot_time ${CMAKE_BINARY_DIR}/robot_time_build)
|
||||
endif()
|
||||
|
||||
add_library(std_msgs INTERFACE)
|
||||
target_include_directories(std_msgs INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/../robot_time/include)
|
||||
|
||||
target_include_directories(std_msgs
|
||||
INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
target_link_libraries(std_msgs INTERFACE robot_time)
|
||||
|
||||
# --- Cài đặt thư viện vào hệ thống khi chạy make install ---
|
||||
install(TARGETS std_msgs
|
||||
EXPORT std_msgs-targets
|
||||
ARCHIVE DESTINATION lib # Thư viện tĩnh .a
|
||||
LIBRARY DESTINATION lib # Thư viện động .so
|
||||
RUNTIME DESTINATION bin # File thực thi (nếu có)
|
||||
INCLUDES DESTINATION include # Cài đặt include
|
||||
)
|
||||
|
||||
# --- Xuất export set std_msgs-targets thành file CMake module ---
|
||||
# --- Tạo file lib/cmake/std_msgs/std_msgs-targets.cmake ---
|
||||
# --- File này chứa cấu hình giúp project khác có thể dùng ---
|
||||
# --- Find_package(std_msgs REQUIRED) ---
|
||||
# --- Target_link_libraries(my_app PRIVATE std_msgs::std_msgs) ---
|
||||
install(EXPORT std_msgs-targets
|
||||
FILE std_msgs-targets.cmake
|
||||
NAMESPACE std_msgs::
|
||||
DESTINATION lib/cmake/std_msgs
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user