CMakeLists.txt 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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 NetWork 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/app_sq_save.h
  81. #header/camerahandler.h
  82. src/main.cpp
  83. src/mserial.cpp
  84. src/ImageStitcher.cpp
  85. #src/userfunc.cpp
  86. src/cameramanager.cpp
  87. src/m_opencv.cpp
  88. src/m_workthread.cpp
  89. src/m_json.cpp
  90. src/mqtthandler.cpp
  91. src/ymodem.cpp
  92. src/m_loger.cpp
  93. src/EasyTableModel.cpp
  94. src/mysql.cpp
  95. src/customitem.cpp
  96. src/app_curlFunc.cpp
  97. src/TreeModel.cpp
  98. src/app_sq_save.cpp
  99. ${QmlFiles}
  100. ${AssetsFiles}
  101. )
  102. felgo_configure_executable(q6_felgo_iot)
  103. # Deploy resources to build folder/package directly
  104. # comment for publishing
  105. deploy_resources("${QmlFiles};${AssetsFiles}")
  106. # Add QML files and resources to QML module to included them via QRC automatically:
  107. # 添加资源文件
  108. set(QRC_FILES
  109. resources.qrc
  110. )
  111. qt_add_resources(QRC_SOURCES ${QRC_FILES})
  112. qt_add_shaders(q6_felgo_iot "shaders"
  113. BATCHABLE
  114. PRECOMPILE
  115. OPTIMIZED
  116. PREFIX
  117. "/"
  118. FILES
  119. "shaders/mandelbrot.vert"
  120. "shaders/mandelbrot.frag"
  121. )
  122. ## 链接路径
  123. if(WIN32)
  124. message(STATUS ${PROJECT_SOURCE_DIR})
  125. message(STATUS "windows paltform.")
  126. link_directories(../Lib/Spdlog/win)
  127. link_directories(../Lib/opencv451/libs/x64/mingw/bin)
  128. link_directories(../Lib/curl/win)
  129. elseif(ANDROID)
  130. message(STATUS "android palform.")
  131. message(STATUS "${PROJECT_SOURCE_DIR}/Lib/Spdlog/Android")
  132. #link_directories(${PROJECT_SOURCE_DIR}/Lib/Spdlog/Android)
  133. link_directories(${PROJECT_SOURCE_DIR}/Lib/opencv451/staticlibs/arm64-v8a)
  134. link_directories(${OPENCV_LIB_3RDPATHS})
  135. link_directories(${PROJECT_SOURCE_DIR}/Lib/opencv451)
  136. link_directories(${PROJECT_SOURCE_DIR}/Lib/zlib)
  137. link_directories(${PROJECT_SOURCE_DIR}/Lib/libuvc/Android-Arm-v8a)
  138. endif()
  139. # NOTE: for PUBLISHING, perform the following steps:
  140. # 1. comment the deploy_resources line above, to avoid shipping your qml files with the application (instead they get compiled to the app binary)
  141. # 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
  142. # 3. change the setMainQmlFile() call in main.cpp to the one starting with "qrc:/" - this loads the qml files from the resources
  143. # for more details see the "Deployment Guides" in the Felgo Documentation
  144. # 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)
  145. # 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
  146. target_compile_definitions(q6_felgo_iot
  147. PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
  148. target_link_libraries(q6_felgo_iot PRIVATE Felgo)
  149. target_link_libraries(q6_felgo_iot PRIVATE
  150. Qt6::Core
  151. Qt6::CorePrivate
  152. Qt6::Quick
  153. Qt6::SerialPort
  154. Qt6::Sql
  155. Qt6::Multimedia
  156. Qt6::Mqtt
  157. Qt6::TextToSpeech
  158. Qt6::Positioning
  159. Qt6::ShaderTools
  160. Qt6::Widgets
  161. Qt6::Svg
  162. Qt6::Network
  163. mediandk)
  164. if (ANDROID)
  165. target_link_libraries(q6_felgo_iot
  166. PRIVATE ${CURL_LIB_PATHS}/libcurl.so)
  167. target_link_libraries(q6_felgo_iot PRIVATE ${SPDLOG_LIB_PATHS}/libspdlog.a)
  168. target_link_libraries(q6_felgo_iot
  169. PRIVATE libz.so)
  170. target_link_libraries(q6_felgo_iot
  171. PRIVATE ${LIBUVC_PATH}/libusb1.0.so ${LIBUVC_PATH}/libuvc.so)
  172. target_link_libraries(q6_felgo_iot
  173. PRIVATE
  174. ${MVS_LIB_PATHS}/libCppUnit_gcc49_v3_0.so
  175. ${MVS_LIB_PATHS}/libGCBase_gcc49_v3_0.so
  176. ${MVS_LIB_PATHS}/libGenApi_gcc49_v3_0.so
  177. ${MVS_LIB_PATHS}/libLog_gcc49_v3_0.so
  178. ${MVS_LIB_PATHS}/libMathParser_gcc49_v3_0.so
  179. ${MVS_LIB_PATHS}/libMediaProcess.so
  180. ${MVS_LIB_PATHS}/libMvCameraControl.so
  181. ${MVS_LIB_PATHS}/libMvCameraControlWrapper.so
  182. ${MVS_LIB_PATHS}/libMVGigEVisionSDK.so
  183. ${MVS_LIB_PATHS}/libMvUsb3vTL.so
  184. ${MVS_LIB_PATHS}/libNodeMapData_gcc49_v3_0.so
  185. ${MVS_LIB_PATHS}/libXmlParser_gcc49_v3_0.so)
  186. target_link_libraries(q6_felgo_iot
  187. PRIVATE
  188. ${OPENCV_LIB_3RDPATHS}/libade.a
  189. ${OPENCV_LIB_3RDPATHS}/libcpufeatures.a
  190. ${OPENCV_LIB_3RDPATHS}/libIlmImf.a
  191. ${OPENCV_LIB_3RDPATHS}/libittnotify.a
  192. ${OPENCV_LIB_3RDPATHS}/liblibjpeg-turbo.a
  193. ${OPENCV_LIB_3RDPATHS}/liblibopenjp2.a
  194. ${OPENCV_LIB_3RDPATHS}/liblibpng.a
  195. ${OPENCV_LIB_3RDPATHS}/liblibprotobuf.a
  196. ${OPENCV_LIB_3RDPATHS}/liblibtiff.a
  197. ${OPENCV_LIB_3RDPATHS}/liblibwebp.a
  198. ${OPENCV_LIB_3RDPATHS}/libquirc.a
  199. ${OPENCV_LIB_3RDPATHS}/libtegra_hal.a)
  200. target_link_libraries(q6_felgo_iot
  201. PRIVATE
  202. ${OPENCV_LIB_PATHS}/libopencv_calib3d.a
  203. ${OPENCV_LIB_PATHS}/libopencv_core.a
  204. ${OPENCV_LIB_PATHS}/libopencv_dnn.a
  205. ${OPENCV_LIB_PATHS}/libopencv_features2d.a
  206. ${OPENCV_LIB_PATHS}/libopencv_flann.a
  207. ${OPENCV_LIB_PATHS}/libopencv_gapi.a
  208. ${OPENCV_LIB_PATHS}/libopencv_highgui.a
  209. ${OPENCV_LIB_PATHS}/libopencv_imgcodecs.a
  210. ${OPENCV_LIB_PATHS}/libopencv_imgproc.a
  211. ${OPENCV_LIB_PATHS}/libopencv_ml.a
  212. ${OPENCV_LIB_PATHS}/libopencv_objdetect.a
  213. ${OPENCV_LIB_PATHS}/libopencv_photo.a
  214. ${OPENCV_LIB_PATHS}/libopencv_stitching.a
  215. ${OPENCV_LIB_PATHS}/libopencv_video.a
  216. ${OPENCV_LIB_PATHS}/libopencv_videoio.a
  217. ${OPENCV_LIB_PATHS}/libopencv_xfeatures2d.a
  218. )
  219. else()
  220. #target_link_libraries(appq6_felgo_iot
  221. # PRIVATE
  222. # libopencv_calib3d451.dll
  223. # libopencv_core451.dll
  224. # libopencv_dnn451.dll
  225. # libopencv_features2d451.dll
  226. # libopencv_flann451.dll
  227. # libopencv_gapi451.dll
  228. # libopencv_highgui451.dll
  229. # libopencv_imgcodecs451.dll
  230. # libopencv_imgproc451.dll
  231. # libopencv_ml451.dll
  232. # libopencv_objdetect451.dll
  233. # libopencv_photo451.dll
  234. # libopencv_stitching451.dll
  235. # libopencv_video451.dll
  236. # libopencv_videoio451.dll
  237. # libopencv_xfeatures2d451.dll)
  238. #target_link_libraries(appq6_felgo_iot
  239. # PRIVATE libcurl.dll)
  240. endif()
  241. # uncomment this line to add the Live Client Module and use live reloading with your custom C++ code
  242. # for the remaining steps to build a custom Live Code Reload app see here: https://felgo.com/custom-code-reload-app/
  243. #find_package(FelgoLive REQUIRED)
  244. #target_link_libraries(appq6_felgo_iot PRIVATE FelgoLive)