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.

111 lines
3.6 KiB

2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 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. # 如何 BUILD_FOR_TEST_ON_PC == true, 则include cmakepc.cmake
  15. if(BUILD_FOR_TEST_ON_PC)
  16. include(cmakepc.cmake)
  17. return()
  18. endif()
  19. # 设置通用编译选项
  20. set(C_CPP_FLAGS "${C_CPP_FLAGS} ")
  21. set(C_CPP_FLAGS
  22. "${C_CPP_FLAGS} -Wno-unused-local-typedefs -Wno-unused-but-set-variable -Wno-deprecated-declarations -Wno-unused-variable"
  23. )
  24. set(C_CPP_FLAGS
  25. "${C_CPP_FLAGS} -Wno-unused-local-typedefs -Wno-unused-but-set-variable -Wno-deprecated-declarations -Wno-unused-variable"
  26. )
  27. set(C_CPP_FLAGS
  28. "${C_CPP_FLAGS} -Werror=return-type -Werror=parentheses -Wfatal-errors -Wno-comment"
  29. )
  30. set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wno-format-overflow")
  31. set(C_CPP_FLAGS "${C_CPP_FLAGS} -O0 -g3 -fPIC -Wall")
  32. # 设置C编译选项
  33. set(CMAKE_C_FLAGS "${C_CPP_FLAGS}")
  34. message("CMAKE_C_FLAGS : ${CMAKE_C_FLAGS}")
  35. # 设置CPP编译选项
  36. set(CMAKE_CXX_FLAGS "${C_CPP_FLAGS}")
  37. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-pessimizing-move -Wno-reorder")
  38. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
  39. message("CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
  40. message("PROJECT_NAME: ${PROJECT_NAME}")
  41. message("PUBLIC_LINK_DIRECTORIES: ${PUBLIC_LINK_DIRECTORIES}")
  42. message("PUBLIC_INCLUDE_DIRECTORIES: ${PUBLIC_INCLUDE_DIRECTORIES}")
  43. # 添加相应的依赖代码
  44. include(dep/iflytopcpp/module.cmake)
  45. include(dep/asio1.12.2/module.cmake)
  46. include(dep/websocketpp/module.cmake)
  47. include(dep/zservice_container/module.cmake)
  48. include(dep/zwebservice/module.cmake)
  49. include(dep/zlinuxcomponents/alsaplayer/module.cmake)
  50. include(dep/zlinuxcomponents/rootfs_auto_update/module.cmake)
  51. include(dep/zlinuxcomponents/mycroft_precise/module.cmake)
  52. include(dep/zlinuxcomponents/audio/module.cmake)
  53. include(dep/zlinuxcomponents/aiui_ws/module.cmake)
  54. # 设置当前工程依赖的头文件路径和链接的库文件
  55. set(DEP_LINK_LIBRARIES
  56. ${DEP_LINK_LIBRARIES}
  57. # ffmpeg
  58. avcodec
  59. avdevice
  60. avfilter
  61. avformat
  62. avutil
  63. swresample
  64. swscale
  65. m
  66. # sys
  67. asound
  68. pthread
  69. #
  70. # curlpp curl
  71. )
  72. # set(PUBLIC_INCLUDE_DIRECTORIES ${PUBLIC_INCLUDE_DIRECTORIES}
  73. # ./libs/curlpp/include) set(PUBLIC_LINK_DIRECTORIES ${PUBLIC_LINK_DIRECTORIES}
  74. # ./libs/curlpp/lib)
  75. # 添加编译的目标文件
  76. zadd_executable_simple(
  77. TARGET
  78. app.out
  79. SRC
  80. src/main.cpp
  81. src/service/device_io_service.cpp
  82. src/service/device_io_service_mock.cpp
  83. src/service/main_control_service.cpp
  84. src/service/light_control_service.cpp
  85. src/service/report_service.cpp
  86. src/service/voiceprocess/beforeasr_voiceprocesser.cpp
  87. src/service/voiceprocess/beforewakeup_voiceprocesser.cpp
  88. src/service/voiceprocess/wakeup_processer.cpp
  89. src/service/voiceprocess/audio_recoder_service.cpp
  90. src/service/voiceprocess/audio_logging_service.cpp
  91. # aiui
  92. )
  93. zadd_executable_simple(TARGET alsaplayer_main.out SRC
  94. dep/zlinuxcomponents/alsaplayer/test_alsaplayer_main.cpp)
  95. zadd_executable_simple(TARGET audio_recorder_main.out SRC
  96. dep/zlinuxcomponents/audio/audio_recorder_main.cpp)
  97. zadd_executable_simple(TARGET test_asr_main.out SRC
  98. dep/zlinuxcomponents/aiui_ws/aiui_main.c)
  99. zadd_executable_simple(
  100. TARGET test_smart_soundbox_player.out SRC
  101. dep/zlinuxcomponents/alsaplayer/test_smart_soundbox_player.cpp)