cmake_minimum_required(VERSION 3.8) project(mpc_drv_ctap_ba) set(MODULE_NAME dpc_decision) add_compile_options(-std=c++17 -fPIC) # add_compile_options(-g) # only for local debug # add_compile_options(-Wall -Wextra -Wpedantic) # find dependencies # find_package(ament_cmake REQUIRED) # find_package(Boost REQUIRED COMPONENTS # thread timer chrono) #示例:添加库 # uncomment the following section in order to fill in # further dependencies manually. # find_package( REQUIRED) # find_package(rclcpp REQUIRED) # find_package(visualization_msgs REQUIRED) # find_package(mpc_drv_msgs REQUIRED) set(BA_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(CMAKE_BUILD_TYPE RELEASE) # set(CMAKE_BUILD_TYPE DEBUG) # set(CMAKE_EXE_LINK_FLAGS "${CMAKE_EXE_LINK_FLAGS} -fsanitize=address") # only for local debug set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-compare -Wreturn-type") #no return type warning # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") #警告变错误 # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w -fpermissive") #忽视警告 # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-rpath=./")#设置rpath,用于指定程序运行时依赖库路径(当前程序所在目录) # set(CMAKE_EXE_LINKER_FLAGS " -no-pie") #防止链接动态库时出现错误 : can not be used when making a PIE object; recompile with -fPIC file(GLOB SOURCES_FILES ${BA_DIR}/source/*.cpp ${BA_DIR}/source/wrappers/*.cpp ${BA_DIR}/source/modules/*.cpp ${BA_DIR}/source/PD_module/*.cpp ${BA_DIR}/source/PD_module/include/CtApPrediction/*.cpp ${BA_DIR}/source/PD_module/source/*.cpp ${CMAKE_SOURCE_DIR}/generated/src/jac/ap/dmservice/*.cpp ${CMAKE_SOURCE_DIR}/generated/src/jac/ap/emservice/*.cpp ${CMAKE_SOURCE_DIR}/generated/src/jac/ap/slamservice/*.cpp ${CMAKE_SOURCE_DIR}/generated/src/jac/ap/vedservice/*.cpp ${CMAKE_SOURCE_DIR}/generated/src/jac/ap/canservice/*.cpp ${CMAKE_SOURCE_DIR}/generated/src/jac/ap/smservice/*.cpp ) message(STATUS "${MODULE_NAME}") add_executable(${MODULE_NAME} ${SOURCES_FILES} source/main.cpp ) # ament_target_dependencies(${MODULE_NAME} rclcpp mpc_drv_msgs visualization_msgs) # CHANGE target_include_directories(${MODULE_NAME} PUBLIC $ $ ${CMAKE_SOURCE_DIR}/generated/includes ${CMAKE_SOURCE_DIR}/modules/common/inc/ap-cm-wrapper) target_compile_features(${MODULE_NAME} PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17 include_directories( ${BA_DIR}/include/ # include # ${CMAKE_INCLUDE_CURRENT_DIR} ${CMAKE_SOURCE_DIR}/generated/includes ${BA_DIR}/source/ ${BA_DIR}/source/modules ${BA_DIR}/source/PD_module ${BA_DIR}/source/wrappers ${BA_DIR}/source/PD_module/include ${BA_DIR}/source/PD_module/include/CtApPrediction ${BA_DIR}/source/PD_module/source ${BA_DIR}/include/CtApBehaviorAnalysis_ ${CMAKE_SOURCE_DIR}/modules/common/inc/ap-cm-wrapper # ${Boost_INCLUDE_DIRS} ${BA_DIR}/third_party ${BA_DIR}/third_party/gtest ${BA_DIR}/third_party/glog ${BA_DIR}/third_party/gflags ) link_directories( ${BA_DIR}/third_party ${BA_DIR}/third_party/gtest ${BA_DIR}/third_party/glog ${BA_DIR}/third_party/gflags ) # add_definitions(-DGTEST) # add_definitions(-DGLOG) add_definitions(-DBA_Debug) # add_definitions(-DPD_Debug) add_definitions(-DBA_RVIZ) add_definitions(-O2) target_link_libraries( ${MODULE_NAME} PRIVATE ${AP_LIBRARIES} pthread jsoncpp yaml-cpp -llog common ${BA_DIR}/third_party/glog/libglog.a ${BA_DIR}/third_party/gflags/libgflags.a # ${Boost_LIBRARIES} ) ## Set install Options ## # install(DIRECTORY config/ # DESTINATION ${MODULE_NAME}/config # ) # install(DIRECTORY lib/${ARCH}/ # DESTINATION ${MODULE_NAME}/lib # USE_SOURCE_PERMISSIONS # ) install(TARGETS ${MODULE_NAME} # ARCHIVE DESTINATION ${MODULE_NAME}/lib LIBRARY DESTINATION ${MODULE_NAME}/lib RUNTIME DESTINATION ${MODULE_NAME}/lib ) install(DIRECTORY script/ DESTINATION ${MODULE_NAME}/script USE_SOURCE_PERMISSIONS ) install(DIRECTORY source/config DESTINATION ${MODULE_NAME}) if(BUILD_TESTING) # find_package(ament_lint_auto REQUIRED) # the following line skips the linter which checks for copyrights # uncomment the line when a copyright and license is not present in all source files #set(ament_cmake_copyright_FOUND TRUE) # the following line skips cpplint (only works in a git repo) # uncomment the line when this package is not in a git repo #set(ament_cmake_cpplint_FOUND TRUE) # ament_lint_auto_find_test_dependencies() endif() # ament_package()