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.

91 lines
3.0 KiB

2 years ago
3 years ago
  1. cmake_minimum_required(VERSION 3.13)
  2. set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
  3. set(CMAKE_SYSTEM_NAME Linux)
  4. set(CMAKE_BUILD_TYPE Debug)
  5. set(CMAKE_SKIP_BUILD_RPATH FALSE)
  6. set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
  7. set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
  8. set(CMAKE_INSTALL_PREFIX "./")
  9. include(zcmake/zcmake.cmake)
  10. project(app)
  11. # 设置ccache加速C++编译速度
  12. set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
  13. set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
  14. # 设置通用编译选项
  15. set(C_CPP_FLAGS "${C_CPP_FLAGS} ")
  16. set(C_CPP_FLAGS
  17. "${C_CPP_FLAGS} -Wno-unused-local-typedefs -Wno-unused-but-set-variable -Wno-deprecated-declarations -Wno-unused-variable"
  18. )
  19. set(C_CPP_FLAGS
  20. "${C_CPP_FLAGS} -Wno-unused-local-typedefs -Wno-unused-but-set-variable -Wno-deprecated-declarations -Wno-unused-variable"
  21. )
  22. set(C_CPP_FLAGS
  23. "${C_CPP_FLAGS} -Werror=return-type -Werror=parentheses -Wfatal-errors -Wno-comment"
  24. )
  25. set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wno-format-overflow")
  26. set(C_CPP_FLAGS "${C_CPP_FLAGS} -O0 -g3 -fPIC -Wall")
  27. # 设置C编译选项
  28. set(CMAKE_C_FLAGS "${C_CPP_FLAGS}")
  29. message("CMAKE_C_FLAGS : ${CMAKE_C_FLAGS}")
  30. # 设置CPP编译选项
  31. set(CMAKE_CXX_FLAGS "${C_CPP_FLAGS}")
  32. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-pessimizing-move -Wno-reorder")
  33. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
  34. message("CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
  35. message("PROJECT_NAME: ${PROJECT_NAME}")
  36. message("PUBLIC_LINK_DIRECTORIES: ${PUBLIC_LINK_DIRECTORIES}")
  37. message("PUBLIC_INCLUDE_DIRECTORIES: ${PUBLIC_INCLUDE_DIRECTORIES}")
  38. # 添加相应的依赖代码
  39. include(dep/iflytopcpp/module.cmake)
  40. include(dep/asio1.12.2/module.cmake)
  41. include(dep/websocketpp/module.cmake)
  42. include(dep/zservice_container/module.cmake)
  43. include(dep/zwebservice/module.cmake)
  44. include(dep/zlinuxcomponents/alsaplayer/module.cmake)
  45. include(dep/zlinuxcomponents/rootfs_auto_update/module.cmake)
  46. include(dep/zlinuxcomponents/mycroft_precise/module.cmake)
  47. include(dep/zlinuxcomponents/audio/module.cmake)
  48. # 设置当前工程依赖的头文件路径和链接的库文件
  49. set(DEP_LINK_LIBRARIES
  50. ${DEP_LINK_LIBRARIES}
  51. # ffmpeg
  52. avcodec
  53. avdevice
  54. avfilter
  55. avformat
  56. avutil
  57. swresample
  58. swscale
  59. m
  60. # sys
  61. asound
  62. pthread)
  63. # 添加编译的目标文件
  64. zadd_executable_simple(
  65. TARGET
  66. app.out
  67. SRC
  68. src/main.cpp
  69. src/service/device_io_service.cpp
  70. src/service/device_io_service_mock.cpp
  71. src/service/main_control_service.cpp
  72. src/service/light_control_service.cpp
  73. src/service/report_service.cpp
  74. src/service/voiceprocess/asr_service.cpp
  75. src/service/voiceprocess/beforeasr_voiceprocesser.cpp
  76. src/service/voiceprocess/beforewakeup_voiceprocesser.cpp
  77. src/service/voiceprocess/voiceprocess_service.cpp
  78. src/service/voiceprocess/wakeup_processer.cpp)
  79. zadd_executable_simple(TARGET alsaplayer_main.out SRC
  80. dep/zlinuxcomponents/alsaplayer/alsaplayer_main.cpp)
  81. zadd_executable_simple(TARGET audio_recorder_main.out SRC
  82. dep/zlinuxcomponents/audio/audio_recorder_main.cpp)