cmake_minimum_required(VERSION 2.8.3)
project(LidarMeasure)

## Compile as C++11, supported in ROS Kinetic and newer
add_compile_options(-std=c++11)

#add_definitions(-std=c++11 -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2)

FIND_PACKAGE(OpenCV REQUIRED)
FIND_PACKAGE(PCL REQUIRED)
FIND_PACKAGE(Protobuf REQUIRED)
FIND_PACKAGE(Glog REQUIRED)
FIND_PACKAGE(Ceres REQUIRED)
set(CMAKE_MODULE_PATH "/usr/local/share/")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--no-as-needed")
set(CMAKE_CXX_FLAGS "-std=c++11 -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2")
set(CMAKE_BUILD_TYPE "RELEASE")


#find_package(Eigen3 REQUIRED)

include_directories(
        laser
        plc
        src
        Locate
        /usr/local/include
        /usr/local/include/modbus
        /usr/local/include/snap7
  ${PCL_INCLUDE_DIRS}
  ${OpenCV_INCLUDE_DIRS}
        ${CERES_INCLUDE_DIRS}
)
link_directories("/usr/local/lib")

aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/task TASK_MANAGER_SRC )
aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/error_code ERROR_SRC )
aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/tool TOOL_SRC )
aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/laser LASER_SRC )
aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/plc PLC_SRC )
aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/locate LOCATE_SRC )
aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/terminor TERMINOR_SRC )
aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/verify VERIFY_SRC )
aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/system_manager SYS_SRC )
aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/wj_lidar WJLIDAR_SRC )



add_executable(locate_sample  test/locate_sample.cpp ${LOCATE_SRC}  ${TASK_MANAGER_SRC} ${ERROR_SRC}
        ${TOOL_SRC})
target_link_libraries(locate_sample ${OpenCV_LIBS}
        ${GLOG_LIBRARIES} ${PCL_LIBRARIES} ${PROTOBUF_LIBRARIES} libtensorflow_cc.so
        tf_3dcnn_api.so pointSIFT_API.so dark.so /usr/local/lib/libglog.a
        /usr/local/lib/libgflags.a snap7 nnxx nanomsg)

add_executable(fence_debug  test/plc_s7.cpp wj_lidar/wj_lidar_msg.pb.cc)
target_link_libraries(fence_debug ${GLOG_LIBRARIES} ${PROTOBUF_LIBRARIES} /usr/local/lib/libglog.a
        /usr/local/lib/libgflags.a nnxx nanomsg)


add_executable(locate  main.cpp ${LOCATE_SRC} ${PLC_SRC} ${TERMINOR_SRC} ${TASK_MANAGER_SRC} ${LASER_SRC} ${ERROR_SRC}
        ${TOOL_SRC} ${SYS_SRC} ${VERIFY_SRC} ${WJLIDAR_SRC})
target_link_libraries(locate ${OpenCV_LIBS} ${CERES_LIBRARIES}
        ${GLOG_LIBRARIES} ${PCL_LIBRARIES} ${PROTOBUF_LIBRARIES} ipopt libtensorflow_cc.so
        tf_3dcnn_api.so pointSIFT_API.so dark.so /usr/local/lib/libmodbus.so /usr/local/lib/libglog.a
        /usr/local/lib/libgflags.a /usr/local/lib/liblivox_sdk_static.a /usr/local/apr/lib/libapr-1.a snap7 nnxx nanomsg)


