# Copyright(c) 2019 livoxtech limited. cmake_minimum_required(VERSION 2.8.3) #--------------------------------------------------------------------------------------- # Start livox_ros_driver project #--------------------------------------------------------------------------------------- project(lio_livox_cpp) #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) #--------------------------------------------------------------------------------------- # find package and the dependecy #--------------------------------------------------------------------------------------- find_package(Boost 1.54 REQUIRED COMPONENTS system thread chrono ) find_package (Eigen3 REQUIRED CONFIG QUIET) find_package(Pangolin 0.8 REQUIRED) find_package(PCL REQUIRED) find_package(Ceres REQUIRED) find_package(OpenCV REQUIRED) find_package(SuiteSparse REQUIRED) find_package(PkgConfig) pkg_check_modules(APR apr-1) if (APR_FOUND) message(${APR_INCLUDE_DIRS}) message(${APR_LIBRARIES}) endif (APR_FOUND) #--------------------------------------------------------------------------------------- # Set default build to release #--------------------------------------------------------------------------------------- if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose Release or Debug" FORCE) endif() #--------------------------------------------------------------------------------------- # Compiler config #--------------------------------------------------------------------------------------- set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) ## make sure the livox_sdk_static library is installed find_library(LIVOX_SDK_LIBRARY liblivox_sdk_static.a /usr/local/lib) include_directories( define lio/include lio/src ${Pangolin_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIR} ${PCL_INCLUDE_DIRS} ${CERES_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} ${SUITESPARSE_INCLUDE_DIRS} ${APR_INCLUDE_DIRS} livox/common livox/common/rapidjson livox/comon/rapdidxml livox/common/comm livox/timesync livox/timesync/user_uart livox/livox_driver) ## PCL library link_directories(${PCL_LIBRARY_DIRS}) add_definitions(${PCL_DEFINITIONS}) #--------------------------------------------------------------------------------------- # generate excutable and add libraries #--------------------------------------------------------------------------------------- add_executable(${PROJECT_NAME}_node main.cpp lio/src/segment/LidarFeatureExtractor.cpp lio/src/segment/segment.cpp lio/src/segment/pointsCorrect.cpp lio/src/lio/LocalMapIvox.cpp lio/src/lio/mapper.cpp lio/src/lio/Estimator.cpp lio/src/lio/IMUIntegrator.cpp lio/src/lio/ceresfunc.cpp lio/src/lio/ndtMap.cpp lio/src/utils/TimerRecord.cpp livox/livox_driver/lvx_file.cpp livox/livox_driver/ldq.cpp livox/livox_driver/lds.cpp livox/livox_driver/lds_lvx.cpp livox/livox_driver/lds_lidar.cpp livox/livox_driver/lds_hub.cpp livox/livox_driver/lddc.cpp livox/timesync/timesync.cpp livox/timesync/user_uart/user_uart.cpp livox/common/comm/comm_protocol.cpp livox/common/comm/sdk_protocol.cpp livox/common/comm/gps_protocol.cpp pangolinViewer.cpp ) #--------------------------------------------------------------------------------------- # precompile macro and compile option #--------------------------------------------------------------------------------------- target_compile_options(${PROJECT_NAME}_node PRIVATE $<$:-Wall> ) #--------------------------------------------------------------------------------------- # link libraries #--------------------------------------------------------------------------------------- target_link_libraries(${PROJECT_NAME}_node pango_display livox_sdk_static.a ${PCL_LIBRARIES} ${OpenCV_LIBRARIES} ${CERES_LIBRARIES} ${Boost_LIBRARY} ${APR_LIBRARIES} -lpthread ipopt ) #--------------------------------------------------------------------------------------- # end of CMakeList.txt #---------------------------------------------------------------------------------------