cmake_minimum_required(VERSION 3.8)
project(calibration_sim)

# 1. 基础编译设置
if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 17)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# 2. 寻找依赖库
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)    # 用于 PointCloud2
find_package(geometry_msgs REQUIRED)  # 用于坐标变换
find_package(tf2_ros REQUIRED)        # 坐标变换工具
find_package(tf2_geometry_msgs REQUIRED)
find_package(pcl_conversions REQUIRED)# ROS <-> PCL 转换桥梁

# 寻找系统级安装的 PCL 库 (非 ROS 包)
find_package(PCL REQUIRED COMPONENTS common io visualization filters registration segmentation)

# 3. 定义可执行文件 (你的核心 C++ 节点)
# 假设你将来会写一个 lidar_fusion_node.cpp
#add_executable(lidar_fusion_node src/lidar_fusion_node.cpp)

# 4. 配置头文件路径
#target_include_directories(lidar_fusion_node PUBLIC
#  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
 # $<INSTALL_INTERFACE:include>
 # ${PCL_INCLUDE_DIRS}  # 必须包含 PCL 的头文件
#)

# 5. 链接库文件
# 链接 ROS 相关的依赖
#ament_target_dependencies(lidar_fusion_node
 # rclcpp
 # std_msgs
  #sensor_msgs
  #geometry_msgs
 # tf2_ros
 # tf2_geometry_msgs
 # pcl_conversions
#)

# 链接 PCL 相关的依赖 (PCL 不是 ament 包，需要单独链接)
#target_link_libraries(lidar_fusion_node
 # ${PCL_LIBRARIES}
#)

# 6. 安装规则 (至关重要!)

# 安装可执行文件 (C++ 节点)
#install(TARGETS
 # lidar_fusion_node
#  DESTINATION lib/${PROJECT_NAME}
#)

# 安装脚本文件 (如果你有 Python 节点)
# install(PROGRAMS
#   scripts/my_python_script.py
#   DESTINATION lib/${PROJECT_NAME}
# )

# 安装资源目录 (Launch, URDF, RViz, Worlds)
# 如果没有这步，你的 ros2 launch 命令会找不到文件
install(DIRECTORY
  launch
  urdf
  rviz
  worlds
  config
  DESTINATION share/${PROJECT_NAME}
)

# 7. 导出依赖与生成包
if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  # the following line skips the linter which checks for copyrights
  # comment the line when a copyright and license is added to all source files
  set(ament_cmake_copyright_FOUND TRUE)
  # the following line skips the linter which checks for eccentric indentation
  # comment the line when it conforms to defaults
  set(ament_cmake_cpplint_FOUND TRUE)
  ament_lint_auto_find_test_dependencies()
endif()

ament_package()
