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.
107 lines
3.5 KiB
107 lines
3.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)
|
|
|
|
# 如何 BUILD_FOR_TEST_ON_PC == true, 则include cmakepc.cmake
|
|
if(BUILD_FOR_TEST_ON_PC)
|
|
include(cmakepc.cmake)
|
|
return()
|
|
endif()
|
|
|
|
# 设置通用编译选项
|
|
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}")
|
|
message("PUBLIC_LINK_DIRECTORIES: ${PUBLIC_LINK_DIRECTORIES}")
|
|
message("PUBLIC_INCLUDE_DIRECTORIES: ${PUBLIC_INCLUDE_DIRECTORIES}")
|
|
|
|
# 添加相应的依赖代码
|
|
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)
|
|
include(dep/zlinuxcomponents/aiui_ws/module.cmake)
|
|
|
|
# 设置当前工程依赖的头文件路径和链接的库文件
|
|
set(DEP_LINK_LIBRARIES
|
|
${DEP_LINK_LIBRARIES}
|
|
# ffmpeg
|
|
avcodec
|
|
avdevice
|
|
avfilter
|
|
avformat
|
|
avutil
|
|
swresample
|
|
swscale
|
|
m
|
|
# sys
|
|
asound
|
|
pthread
|
|
#
|
|
# curlpp curl
|
|
)
|
|
# set(PUBLIC_INCLUDE_DIRECTORIES ${PUBLIC_INCLUDE_DIRECTORIES}
|
|
# ./libs/curlpp/include) set(PUBLIC_LINK_DIRECTORIES ${PUBLIC_LINK_DIRECTORIES}
|
|
# ./libs/curlpp/lib)
|
|
|
|
# 添加编译的目标文件
|
|
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
|
|
src/service/voiceprocess/beforeasr_voiceprocesser.cpp
|
|
src/service/voiceprocess/beforewakeup_voiceprocesser.cpp
|
|
src/service/voiceprocess/wakeup_processer.cpp
|
|
src/service/voiceprocess/audio_recoder_service.cpp
|
|
src/service/voiceprocess/audio_logging_service.cpp
|
|
# aiui
|
|
)
|
|
|
|
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)
|
|
zadd_executable_simple(TARGET test_asr_main.out SRC dep/zlinuxcomponents/aiui_ws/aiui_main.c)
|