1 Star 0 Fork 27

likepeng/airos-vehicle

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
CMakeLists.txt 2.63 KB
一键复制 编辑 原始数据 按行查看 历史
qiumiaohan 提交于 2023-05-16 10:47 . AIROS Vehicle
CMAKE_MINIMUM_REQUIRED(VERSION 3.16)
PROJECT(airos-vehicle)
SET(CMAKE_C_STANDARD 11)
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_C_FLAGS "-fPIC -g -DPIC -Werror=return-type -DNDEBUG -DDCHECK_ALWAYS_ON=0")
SET(CMAKE_CXX_FLAGS "-fPIC -g -DPIC -Werror=return-type -DNDEBUG -DDCHECK_ALWAYS_ON=0")
### option
OPTION(LOAD_SERVICE_FROM_LIB "load service from airos-vehicle/service" ON)
OPTION(USE_FAKE_OBU "load fake obu service" ON)
OPTION(USE_SCENE_SERVICE "load scene service" ON)
OPTION(USE_PC5_SERVICE "load pc5 service" ON)
IF (LOAD_SERVICE_FROM_LIB)
add_definitions(-DLOAD_SERVICE_FROM_LIB)
ENDIF()
IF (USE_FAKE_OBU)
add_definitions(-DUSE_FAKE_OBU)
ENDIF()
IF (USE_SCENE_SERVICE)
add_definitions(-DUSE_SCENE_SERVICE)
ENDIF()
IF (USE_PC5_SERVICE)
add_definitions(-DUSE_PC5_SERVICE)
ENDIF()
### output path
SET(FRAMEWORK_OUTPUT_ROOT "${CMAKE_BINARY_DIR}/output")
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${FRAMEWORK_OUTPUT_ROOT}/lib)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${FRAMEWORK_OUTPUT_ROOT}/lib)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${FRAMEWORK_OUTPUT_ROOT}/bin)
### install path
SET(CMAKE_INSTALL_PREFIX "$ENV{HOME}/${CMAKE_PROJECT_NAME}")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
SET(FRAMEWORK_TEST_DIR "${CMAKE_INSTALL_PREFIX}/test/")
SET(FRAMEWORK_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin/")
SET(FRAMEWORK_INC_DIR "${CMAKE_INSTALL_PREFIX}/include/")
SET(FRAMEWORK_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib/")
SET(FRAMEWORK_LOG_DIR "${CMAKE_INSTALL_PREFIX}/log/")
SET(FRAMEWORK_SERVICE_DIR "${CMAKE_INSTALL_PREFIX}/service/")
SET(FRAMEWORK_CONF_DIR "${CMAKE_INSTALL_PREFIX}/conf/")
### deps libs
SET(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
FIND_PACKAGE(Boost REQUIRED COMPONENTS system)
FIND_PACKAGE(Threads REQUIRED)
FIND_PACKAGE(jsoncpp REQUIRED)
FIND_PACKAGE(gflags REQUIRED)
FIND_PACKAGE(glog REQUIRED)
FIND_PACKAGE(GTest REQUIRED)
FIND_PACKAGE(websocketpp REQUIRED)
FIND_PACKAGE(protobuf REQUIRED)
IF ("${CMAKE_SYSTEM_NAME}" STREQUAL "Android")
## FIT for cross compile
SET_TARGET_PROPERTIES(protobuf::protoc PROPERTIES
IMPORTED_LOCATION_RELEASE
/usr/local/bin/protoc
)
ELSE ()
LINK_LIBRARIES(pthread rt)
ENDIF ()
LINK_LIBRARIES(
uuid
jsoncpp_lib
glog::glog
gflags
protobuf::libprotobuf
Boost::system
ssl crypto
dl m
-Wl,-z,defs
)
### include dir
INCLUDE_DIRECTORIES(src)
### sub directory
ADD_SUBDIRECTORY(src)
### install file/dir
INSTALL(DIRECTORY DESTINATION ${FRAMEWORK_LOG_DIR})
INSTALL(DIRECTORY DESTINATION ${FRAMEWORK_SERVICE_DIR})
INSTALL(DIRECTORY conf DESTINATION ${CMAKE_INSTALL_PREFIX})
INSTALL(DIRECTORY templates DESTINATION ${CMAKE_INSTALL_PREFIX})
INSTALL(DIRECTORY tools DESTINATION ${CMAKE_INSTALL_PREFIX})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/lkpworkspace/airos-vehicle.git
[email protected]:lkpworkspace/airos-vehicle.git
lkpworkspace
airos-vehicle
airos-vehicle
master

搜索帮助