You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

72 lines
2.5 KiB

cmake_minimum_required(VERSION 3.13)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_INSTALL_PREFIX "./")
include(zcmake/zcmake.cmake)
project(app)
# 设置ccache加速C++编译速度
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
# 设置通用编译选项
set(C_CPP_FLAGS "${C_CPP_FLAGS} ")
set(C_CPP_FLAGS
"${C_CPP_FLAGS} -Wno-unused-local-typedefs -Wno-unused-but-set-variable -Wno-deprecated-declarations -Wno-unused-variable"
)
set(C_CPP_FLAGS
"${C_CPP_FLAGS} -Wno-unused-local-typedefs -Wno-unused-but-set-variable -Wno-deprecated-declarations -Wno-unused-variable"
)
set(C_CPP_FLAGS
"${C_CPP_FLAGS} -Werror=return-type -Werror=parentheses -Wfatal-errors -Wno-comment"
)
set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wno-format-overflow")
set(C_CPP_FLAGS "${C_CPP_FLAGS} -O0 -g3 -fPIC -Wall")
# 设置C编译选项
set(CMAKE_C_FLAGS "${C_CPP_FLAGS}")
message("CMAKE_C_FLAGS : ${CMAKE_C_FLAGS}")
# 设置CPP编译选项
set(CMAKE_CXX_FLAGS "${C_CPP_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-pessimizing-move -Wno-reorder")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
message("CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
message("PROJECT_NAME: ${PROJECT_NAME}")
# 添加相应的依赖代码
include(dep/iflytopcpp/module.cmake)
include(dep/asio1.12.2/module.cmake)
include(dep/websocketpp/module.cmake)
include(dep/zservice_container/module.cmake)
include(dep/zwebservice/module.cmake)
include(dep/zlinuxcomponents/alsaplayer/module.cmake)
include(dep/zlinuxcomponents/rootfs_auto_update/module.cmake)
include(dep/zlinuxcomponents/mycroft_precise/module.cmake)
include(dep/zlinuxcomponents/audio/module.cmake)
# 设置当前工程依赖的头文件路径和链接的库文件
set(DEP_INCLUDE ${DEP_INCLUDE} ./dep/)
set(DEP_LINK_LIBRARIES ${DEP_LINK_LIBRARIES} asound pthread)
# 添加编译的目标文件
zadd_executable_simple(
TARGET
app.out
SRC
src/main.cpp
src/service/device_io_service.cpp
src/service/device_io_service_mock.cpp
src/service/main_control_service.cpp
src/service/light_control_service.cpp
src/service/report_service.cpp)
zadd_executable_simple(TARGET alsaplayer_main.out SRC
dep/zlinuxcomponents/alsaplayer/alsaplayer_main.cpp)
zadd_executable_simple(TARGET audio_recorder_main.out SRC
dep/zlinuxcomponents/audio/audio_recorder_main.cpp)