CMakeLists.txt 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. cmake_minimum_required(VERSION 3.16)
  2. project(q6_felgo_iot VERSION 0.1 LANGUAGES CXX)
  3. set(CMAKE_AUTOMOC ON)
  4. set(CMAKE_CXX_STANDARD 11)
  5. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  6. add_compile_definitions(QT_DEPRECATED_WARNINGS)
  7. add_compile_definitions(ACCESS_RAW_DESCRIPTORS)
  8. # 设置可能的库列表
  9. set(OPENCV_LIB_PATHS
  10. ##第三方库的绝对路径
  11. ${PROJECT_SOURCE_DIR}/../Lib/opencv451/staticlibs/arm64-v8a
  12. )
  13. set(OPENCV_LIB_3RDPATHS
  14. ##第三方库的绝对路径
  15. ${PROJECT_SOURCE_DIR}/../Lib/opencv451/3rdparty/libs/arm64-v8a
  16. )
  17. set(SPDLOG_LIB_PATHS
  18. ##第三方库的绝对路径/
  19. ${PROJECT_SOURCE_DIR}/../Lib/Spdlog/Android/felgo
  20. )
  21. set(CURL_LIB_PATHS
  22. ##第三方库的绝对路径/
  23. ${PROJECT_SOURCE_DIR}/../Lib/curl
  24. )
  25. set(MVS_LIB_PATHS
  26. ##第三方库的绝对路径
  27. ${PROJECT_SOURCE_DIR}/../Lib/mvs/arm64-v8a
  28. )
  29. set(LIBUVC_PATH
  30. #libuvc库路径
  31. ${PROJECT_SOURCE_DIR}/../Lib/libuvc/Android-Arm-v8a
  32. )
  33. find_package(Felgo REQUIRED)
  34. find_package(Qt6 COMPONENTS Core Quick SerialPort Sql Multimedia Mqtt TextToSpeech Positioning ShaderTools Widgets Svg REQUIRED)
  35. #find_package(FelgoLive REQUIRED)
  36. # Project identifier and version
  37. # More information: https://felgo.com/doc/felgo-publishing/#project-configuration
  38. set(PRODUCT_IDENTIFIER "com.yfkj.cb.Q6iot")
  39. set(PRODUCT_VERSION_NAME "1.0.0")
  40. set(PRODUCT_VERSION_CODE 1)
  41. # Set either "test" or "publish" stage:产品状态,测试?发布
  42. set(PRODUCT_STAGE "test")
  43. # Optionally set a license key that is used instead of the license key from
  44. # main.qml file (App::licenseKey for your app or GameWindow::licenseKey for your game)
  45. # Only used for local builds and Felgo Cloud Builds (https://felgo.com/cloud-builds)
  46. # Not used if using Felgo Live
  47. set(PRODUCT_LICENSE_KEY "7A0F7761276CA0ACFD172072656BA4B6567C0D73526F505C4383F731A317F0756F5FA09CD0B3CD0D0F30279EC5EA2D0FD851E07D4E59CDB32E3C5E26B341969809B11E2051E4881C86B38D72897C0808F5593230C44D3B5B3C4929986F4354F11BE16FB196173178BE2D52B4BD4803CCF2BC85B3E96B0023CA0904B3DEDEC45EC24ECD27EAABCE9DA4A1EB5CDA9B340C4691E6F8487D894BD777574A6A0FF22AAF95815969D68CC8C31798E2B0B5366346236DFAEF6CD2FE6596930C402195EAFA06ECB608B90947EA8CA20D97EC36A0D57B87288EBC33AEFFE2B124FB741972B70D8178E14690C4409774487F7F0C4A2B8F6C48CA3EC9A81075CB50EB46D9A6775DE013346B616165EDC9D2064C6DC3F5B51227B1685449BB441DFC11876CD23813C3737107B6BEC44EBC1B691A45E6")
  48. #set(FELGO_PLUGINS)
  49. # Find all QML/JS files for the QML compiler:
  50. file(GLOB_RECURSE QmlFiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} qml/*.qml qml/*.js)
  51. # Find all non-QML/JS files in the qml and assets folder to add as resources:
  52. file(GLOB_RECURSE AssetsFiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} assets/* qml/*)
  53. list(REMOVE_ITEM AssetsFiles ${QmlFiles})
  54. ## 头文件
  55. include_directories(header)
  56. include_directories(${PROJECT_SOURCE_DIR}/../Lib/opencv451/header)
  57. include_directories(${PROJECT_SOURCE_DIR}/../Lib/spdlog/header)
  58. include_directories(${PROJECT_SOURCE_DIR}/../Lib/curl/header)
  59. include_directories(${PROJECT_SOURCE_DIR}/../Lib/libuvc/Android-Arm-v8a/header)
  60. include_directories(${PROJECT_SOURCE_DIR}/../Lib/mvs/includes)
  61. qt_add_executable(q6_felgo_iot
  62. header/main.h
  63. #header/userfunc.h
  64. header/mserial.h
  65. header/ImageStitcher.h
  66. header/cameramanager.h
  67. header/SerialEvent.h
  68. header/m_opencv.h
  69. header/m_workthread.h
  70. header/m_json.h
  71. header/mqtthandler.h
  72. header/ymodem.h
  73. header/m_loger.h
  74. header/EasyTableModel.h
  75. header/mysql.h
  76. header/customitem.h
  77. header/TreeModel.h
  78. header/app_fileHandle.h
  79. header/app_curlFunc.h
  80. #header/camerahandler.h
  81. src/main.cpp
  82. src/mserial.cpp
  83. src/ImageStitcher.cpp
  84. #src/userfunc.cpp
  85. src/cameramanager.cpp
  86. src/m_opencv.cpp
  87. src/m_workthread.cpp
  88. src/m_json.cpp
  89. src/mqtthandler.cpp
  90. src/ymodem.cpp
  91. src/m_loger.cpp
  92. src/EasyTableModel.cpp
  93. src/mysql.cpp
  94. src/customitem.cpp
  95. src/app_curlFunc.cpp
  96. src/TreeModel.cpp
  97. ${QmlFiles}
  98. ${AssetsFiles}
  99. )
  100. felgo_configure_executable(q6_felgo_iot)
  101. # Deploy resources to build folder/package directly
  102. # comment for publishing
  103. deploy_resources("${QmlFiles};${AssetsFiles}")
  104. # Add QML files and resources to QML module to included them via QRC automatically:
  105. # 添加资源文件
  106. set(QRC_FILES
  107. resources.qrc
  108. )
  109. qt_add_resources(QRC_SOURCES ${QRC_FILES})
  110. qt_add_shaders(q6_felgo_iot "shaders"
  111. BATCHABLE
  112. PRECOMPILE
  113. OPTIMIZED
  114. PREFIX
  115. "/"
  116. FILES
  117. "shaders/mandelbrot.vert"
  118. "shaders/mandelbrot.frag"
  119. )
  120. ## 链接路径
  121. if(WIN32)
  122. message(STATUS ${PROJECT_SOURCE_DIR})
  123. message(STATUS "windows paltform.")
  124. link_directories(../Lib/Spdlog/win)
  125. link_directories(../Lib/opencv451/libs/x64/mingw/bin)
  126. link_directories(../Lib/curl/win)
  127. elseif(ANDROID)
  128. message(STATUS "android palform.")
  129. message(STATUS "${PROJECT_SOURCE_DIR}/Lib/Spdlog/Android")
  130. #link_directories(${PROJECT_SOURCE_DIR}/Lib/Spdlog/Android)
  131. link_directories(${PROJECT_SOURCE_DIR}/Lib/opencv451/staticlibs/arm64-v8a)
  132. link_directories(${OPENCV_LIB_3RDPATHS})
  133. link_directories(${PROJECT_SOURCE_DIR}/Lib/opencv451)
  134. link_directories(${PROJECT_SOURCE_DIR}/Lib/zlib)
  135. link_directories(${PROJECT_SOURCE_DIR}/Lib/libuvc/Android-Arm-v8a)
  136. endif()
  137. # NOTE: for PUBLISHING, perform the following steps:
  138. # 1. comment the deploy_resources line above, to avoid shipping your qml files with the application (instead they get compiled to the app binary)
  139. # 2. uncomment the QML_FILES and RESOURCES above; this compiles your qml files and js files to the app binary and protects your source code
  140. # 3. change the setMainQmlFile() call in main.cpp to the one starting with "qrc:/" - this loads the qml files from the resources
  141. # for more details see the "Deployment Guides" in the Felgo Documentation
  142. # during development, use the deploy_resources because you then get shorter compilation times (the qml files do not need to be compiled to the binary but are just copied)
  143. # also, for quickest deployment on Desktop disable the "Shadow Build" option in Projects/Builds - you can then select "Run Without Deployment" from the Build menu in Qt Creator if you only changed QML files; this speeds up application start, because your app is not copied & re-compiled but just re-interpreted
  144. target_compile_definitions(q6_felgo_iot
  145. PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
  146. target_link_libraries(q6_felgo_iot PRIVATE Felgo)
  147. target_link_libraries(q6_felgo_iot PRIVATE Qt6::Core Qt6::CorePrivate Qt6::Quick Qt6::SerialPort Qt6::Sql Qt6::Multimedia Qt6::Mqtt Qt6::TextToSpeech Qt6::Positioning Qt6::ShaderTools Qt6::Widgets Qt6::Svg mediandk)
  148. if (ANDROID)
  149. target_link_libraries(q6_felgo_iot
  150. PRIVATE ${CURL_LIB_PATHS}/libcurl.so)
  151. target_link_libraries(q6_felgo_iot PRIVATE ${SPDLOG_LIB_PATHS}/libspdlog.a)
  152. target_link_libraries(q6_felgo_iot
  153. PRIVATE libz.so)
  154. target_link_libraries(q6_felgo_iot
  155. PRIVATE ${LIBUVC_PATH}/libusb1.0.so ${LIBUVC_PATH}/libuvc.so)
  156. target_link_libraries(q6_felgo_iot
  157. PRIVATE
  158. ${MVS_LIB_PATHS}/libCppUnit_gcc49_v3_0.so
  159. ${MVS_LIB_PATHS}/libGCBase_gcc49_v3_0.so
  160. ${MVS_LIB_PATHS}/libGenApi_gcc49_v3_0.so
  161. ${MVS_LIB_PATHS}/libLog_gcc49_v3_0.so
  162. ${MVS_LIB_PATHS}/libMathParser_gcc49_v3_0.so
  163. ${MVS_LIB_PATHS}/libMediaProcess.so
  164. ${MVS_LIB_PATHS}/libMvCameraControl.so
  165. ${MVS_LIB_PATHS}/libMvCameraControlWrapper.so
  166. ${MVS_LIB_PATHS}/libMVGigEVisionSDK.so
  167. ${MVS_LIB_PATHS}/libMvUsb3vTL.so
  168. ${MVS_LIB_PATHS}/libNodeMapData_gcc49_v3_0.so
  169. ${MVS_LIB_PATHS}/libXmlParser_gcc49_v3_0.so)
  170. target_link_libraries(q6_felgo_iot
  171. PRIVATE
  172. ${OPENCV_LIB_3RDPATHS}/libade.a
  173. ${OPENCV_LIB_3RDPATHS}/libcpufeatures.a
  174. ${OPENCV_LIB_3RDPATHS}/libIlmImf.a
  175. ${OPENCV_LIB_3RDPATHS}/libittnotify.a
  176. ${OPENCV_LIB_3RDPATHS}/liblibjpeg-turbo.a
  177. ${OPENCV_LIB_3RDPATHS}/liblibopenjp2.a
  178. ${OPENCV_LIB_3RDPATHS}/liblibpng.a
  179. ${OPENCV_LIB_3RDPATHS}/liblibprotobuf.a
  180. ${OPENCV_LIB_3RDPATHS}/liblibtiff.a
  181. ${OPENCV_LIB_3RDPATHS}/liblibwebp.a
  182. ${OPENCV_LIB_3RDPATHS}/libquirc.a
  183. ${OPENCV_LIB_3RDPATHS}/libtegra_hal.a)
  184. target_link_libraries(q6_felgo_iot
  185. PRIVATE
  186. ${OPENCV_LIB_PATHS}/libopencv_calib3d.a
  187. ${OPENCV_LIB_PATHS}/libopencv_core.a
  188. ${OPENCV_LIB_PATHS}/libopencv_dnn.a
  189. ${OPENCV_LIB_PATHS}/libopencv_features2d.a
  190. ${OPENCV_LIB_PATHS}/libopencv_flann.a
  191. ${OPENCV_LIB_PATHS}/libopencv_gapi.a
  192. ${OPENCV_LIB_PATHS}/libopencv_highgui.a
  193. ${OPENCV_LIB_PATHS}/libopencv_imgcodecs.a
  194. ${OPENCV_LIB_PATHS}/libopencv_imgproc.a
  195. ${OPENCV_LIB_PATHS}/libopencv_ml.a
  196. ${OPENCV_LIB_PATHS}/libopencv_objdetect.a
  197. ${OPENCV_LIB_PATHS}/libopencv_photo.a
  198. ${OPENCV_LIB_PATHS}/libopencv_stitching.a
  199. ${OPENCV_LIB_PATHS}/libopencv_video.a
  200. ${OPENCV_LIB_PATHS}/libopencv_videoio.a
  201. ${OPENCV_LIB_PATHS}/libopencv_xfeatures2d.a
  202. )
  203. else()
  204. #target_link_libraries(appq6_felgo_iot
  205. # PRIVATE
  206. # libopencv_calib3d451.dll
  207. # libopencv_core451.dll
  208. # libopencv_dnn451.dll
  209. # libopencv_features2d451.dll
  210. # libopencv_flann451.dll
  211. # libopencv_gapi451.dll
  212. # libopencv_highgui451.dll
  213. # libopencv_imgcodecs451.dll
  214. # libopencv_imgproc451.dll
  215. # libopencv_ml451.dll
  216. # libopencv_objdetect451.dll
  217. # libopencv_photo451.dll
  218. # libopencv_stitching451.dll
  219. # libopencv_video451.dll
  220. # libopencv_videoio451.dll
  221. # libopencv_xfeatures2d451.dll)
  222. #target_link_libraries(appq6_felgo_iot
  223. # PRIVATE libcurl.dll)
  224. endif()
  225. # uncomment this line to add the Live Client Module and use live reloading with your custom C++ code
  226. # for the remaining steps to build a custom Live Code Reload app see here: https://felgo.com/custom-code-reload-app/
  227. #find_package(FelgoLive REQUIRED)
  228. #target_link_libraries(appq6_felgo_iot PRIVATE FelgoLive)