CMakeLists.txt 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. cmake_minimum_required(VERSION 3.16)
  2. project(pc_system LANGUAGES CXX)
  3. # 启用 Qt 的自动 UI、MOC 和资源处理
  4. set(CMAKE_AUTOUIC ON)
  5. set(CMAKE_AUTOMOC ON)
  6. set(CMAKE_AUTORCC ON)
  7. # 设置 C++ 标准
  8. set(CMAKE_CXX_STANDARD 17)
  9. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  10. set(CMAKE_PREFIX_PATH "/opt/homebrew/Cellar/qt/6.9.0")
  11. # # 设置 OpenSSL 安装路径
  12. set(OPENSSL_ROOT_DIR "C:/Qt/Tools/OpenSSLv3/Win_x64")
  13. # 查找 OpenSSL 库
  14. find_package(OpenSSL REQUIRED)
  15. if(OpenSSL_FOUND)
  16. message(STATUS "OpenSSL found: ${OpenSSL_VERSION}")
  17. else()
  18. message(FATAL_ERROR "OpenSSL not found. Please install OpenSSL development libraries.")
  19. endif()
  20. find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Gui Widgets Mqtt Sql Network WebEngineWidgets SerialPort Charts)
  21. find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets Mqtt Sql Network WebEngineWidgets SerialPort Charts) # 添加 Widgets
  22. # 定义源文件列表
  23. set(SOURCES
  24. PageWidget.cpp
  25. blastoperationfactory.cpp
  26. blastopepage.cpp
  27. addressfactory.cpp
  28. addresspage.cpp
  29. components/MultiSelectComboBox.cpp
  30. blastProject/blastprojectfactory.cpp
  31. blastProject/blastprojectpage.cpp
  32. blastProject/projectdialog.cpp
  33. blastProject/hproject.cpp
  34. blastProject/hprojectdao.cpp
  35. buttondelegate.cpp
  36. databasemanager.cpp
  37. detInfo/detinfofactory.cpp
  38. detInfo/detinfopage.cpp
  39. detInfo/detdialog.cpp
  40. equipment/equipmentfactory.cpp
  41. equipment/equipmentpage.cpp
  42. global.cpp
  43. httpclient.cpp
  44. jobs.cpp
  45. login/loginwindow.cpp
  46. main.cpp
  47. mainwindow.cpp
  48. registryManager/registrymanager.cpp
  49. mqtt/mqttclient.cpp
  50. blastRecord/blastrecordfactory.cpp
  51. blastRecord/blastrecord.cpp
  52. blastRecord/hblastrecord.cpp
  53. blastRecord/hblastrecorddao.cpp
  54. blastRecordDet/hblastrecorddet.cpp
  55. blastRecordDet/hblastrecorddetdao.cpp
  56. blastRegRecord/hblastregrecord.cpp
  57. blastRegRecord/hblastregrecorddao.cpp
  58. fireWidget/firingwidget.cpp
  59. fireWidget/navprogress.cpp
  60. )
  61. # 定义头文件列表
  62. set(HEADERS
  63. PageWidget.h
  64. blastoperationfactory.h
  65. blastopepage.h
  66. addressfactory.h
  67. addresspage.h
  68. blastProject/blastprojectfactory.h
  69. blastProject/blastprojectpage.h
  70. blastProject/hproject.h
  71. blastProject/hprojectdao.h
  72. blastProject/projectdialog.h
  73. buttondelegate.h
  74. databasemanager.h
  75. detInfo/detinfofactory.h
  76. detInfo/detinfopage.h
  77. detInfo/detdialog.h
  78. equipment/equipmentfactory.h
  79. equipment/equipmentpage.h
  80. global.h
  81. httpclient.h
  82. jobs.h
  83. login/loginwindow.h
  84. mainwindow.h
  85. registryManager/registrymanager.h
  86. mqtt/mqttclient.h
  87. regex.h
  88. blastRecord/blastrecordfactory.h
  89. blastRecord/blastrecord.h
  90. blastRecord/hblastrecord.h
  91. blastRecord/hblastrecorddao.h
  92. blastRecordDet/hblastrecorddet.h
  93. blastRecordDet/hblastrecorddetdao.h
  94. blastRegRecord/hblastregrecord.h
  95. blastRegRecord/hblastregrecorddao.h
  96. fireWidget/firingwidget.h
  97. fireWidget/navprogress.h
  98. )
  99. # 定义 UI 文件列表
  100. set(FORMS
  101. homepage.ui
  102. PageWidget.ui
  103. addresspage.ui
  104. blastProject/blastprojectpage.ui
  105. detInfo/detinfopage.ui
  106. detInfo/detdialog.ui
  107. equipment/equipmentpage.ui
  108. login/loginwindow.ui
  109. mainwindow.ui
  110. blastProject/projectdialog.ui
  111. blastopepage.ui
  112. blastRecord/blastrecord.ui
  113. fireWidget/firingwidget.ui
  114. )
  115. # 定义资源文件列表
  116. set(RESOURCES
  117. media.qrc
  118. )
  119. # 添加可执行文件
  120. add_executable(${PROJECT_NAME}
  121. ${SOURCES}
  122. ${HEADERS}
  123. ${FORMS}
  124. ${RESOURCES}
  125. des3encryption.h des3encryption.cpp
  126. countdownwidget.h countdownwidget.cpp
  127. serial/serialtool.h serial/serialtool.cpp
  128. serial/serialgps.h serial/serialgps.cpp
  129. paregnrmc.cpp paregnrmc.h
  130. serialgpsthread.h serialgpsthread.cpp
  131. worker/timeupdatethread.h worker/timeupdatethread.cpp
  132. logo.rc
  133. logger.h
  134. logger.cpp
  135. loadingWidget.h
  136. loadingWidget.cpp
  137. README.md
  138. backendapimanager.h backendapimanager.cpp
  139. homepage.h homepage.cpp homepage.ui
  140. homepagefactory.cpp
  141. )
  142. set_target_properties(${PROJECT_NAME} PROPERTIES
  143. WIN32_EXECUTABLE FALSE
  144. )
  145. target_link_libraries(pc_system Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui
  146. Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Sql Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Charts
  147. Qt${QT_VERSION_MAJOR}::Mqtt Qt${QT_VERSION_MAJOR}::WebEngineWidgets OpenSSL::Crypto OpenSSL::SSL Qt${QT_VERSION_MAJOR}::SerialPort)
  148. include(GNUInstallDirs)
  149. install(TARGETS pc_system
  150. LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  151. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  152. )