# 设置C++标准
set(CMAKE_CXX_STANDARD 14)
cmake_minimum_required(VERSION 2.8.3)
project(exploration_manager)

# 编译选项
set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -g -pthread")

# 查找依赖包
find_package(Eigen3 REQUIRED)
find_package(PCL 1.7 REQUIRED)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  std_msgs
  geometry_msgs
  quadrotor_msgs
  plan_env
  path_searching
  bspline
  bspline_opt
  traj_utils
  active_perception
  lkh_tsp_solver
  lkh_mtsp_solver
  plan_manage
  cv_bridge
  message_generation
)

# 添加消息文件
add_message_files(
  FILES
  DroneState.msg
  PairOpt.msg
  PairOptResponse.msg
  HGrid.msg
  GridTour.msg
  FsmState.msg
)

# 生成消息
generate_messages(
  DEPENDENCIES
  std_msgs
  geometry_msgs
)

# 配置catkin包
catkin_package(
 INCLUDE_DIRS include
 LIBRARIES exploration_manager
 CATKIN_DEPENDS plan_env path_searching bspline bspline_opt active_perception traj_utils lkh_tsp_solver lkh_mtsp_solver plan_manage message_runtime
)

# 包含目录
include_directories(
  include
  SYSTEM
  ${catkin_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/include
  ${EIGEN3_INCLUDE_DIR}
  ${PCL_INCLUDE_DIRS}
)

# 添加库文件并链接
add_library(exploration_manager
  src/fast_exploration_fsm.cpp
  src/fast_exploration_manager.cpp
)

# 添加可执行文件并链接库
add_executable(exploration_node
  src/exploration_node.cpp 
)
target_link_libraries(exploration_node 
  exploration_manager
  ${catkin_LIBRARIES}
)

add_executable(ground_node
  src/ground_node.cpp 
)
target_link_libraries(ground_node
  exploration_manager
  ${catkin_LIBRARIES}
)

