CMakeLists.txt 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. # # 设置 OpenSSL 安装路径
  11. set(OPENSSL_ROOT_DIR "D:/qt/Tools/OpenSSLv3/Win_x64")
  12. # 查找 OpenSSL 库
  13. find_package(OpenSSL REQUIRED)
  14. if(OpenSSL_FOUND)
  15. message(STATUS "OpenSSL found: ${OpenSSL_VERSION}")
  16. else()
  17. message(FATAL_ERROR "OpenSSL not found. Please install OpenSSL development libraries.")
  18. endif()
  19. find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Gui Widgets Mqtt Sql Network WebEngineWidgets SerialPort)
  20. find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets Mqtt Sql Network WebEngineWidgets SerialPort) # 添加 Widgets
  21. # 定义源文件列表
  22. set(SOURCES
  23. PageWidget.cpp
  24. blastoperationfactory.cpp
  25. blastopepage.cpp
  26. addressfactory.cpp
  27. addresspage.cpp
  28. blastProject/blastprojectfactory.cpp
  29. blastProject/blastprojectpage.cpp
  30. blastProject/projectdialog.cpp
  31. blastProject/hproject.cpp
  32. blastProject/hprojectdao.cpp
  33. buttondelegate.cpp
  34. databasemanager.cpp
  35. detInfo/detinfofactory.cpp
  36. detInfo/detinfopage.cpp
  37. detInfo/detdialog.cpp
  38. equipment/equipmentfactory.cpp
  39. equipment/equipmentpage.cpp
  40. global.cpp
  41. httpclient.cpp
  42. jobs.cpp
  43. login/loginwindow.cpp
  44. main.cpp
  45. mainwindow.cpp
  46. registryManager/registrymanager.cpp
  47. mqtt/mqttclient.cpp
  48. blastRecord/blastrecordfactory.cpp
  49. blastRecord/blastrecord.cpp
  50. blastRecord/hblastrecord.cpp
  51. blastRecord/hblastrecorddao.cpp
  52. blastRecordDet/hblastrecorddet.cpp
  53. blastRecordDet/hblastrecorddetdao.cpp
  54. blastRegRecord/hblastregrecord.cpp
  55. blastRegRecord/hblastregrecorddao.cpp
  56. fireWidget/firingwidget.cpp
  57. fireWidget/navprogress.cpp
  58. )
  59. # 定义头文件列表
  60. set(HEADERS
  61. PageWidget.h
  62. blastoperationfactory.h
  63. blastopepage.h
  64. addressfactory.h
  65. addresspage.h
  66. blastProject/blastprojectfactory.h
  67. blastProject/blastprojectpage.h
  68. blastProject/hproject.h
  69. blastProject/hprojectdao.h
  70. blastProject/projectdialog.h
  71. buttondelegate.h
  72. databasemanager.h
  73. detInfo/detinfofactory.h
  74. detInfo/detinfopage.h
  75. detInfo/detdialog.h
  76. equipment/equipmentfactory.h
  77. equipment/equipmentpage.h
  78. global.h
  79. httpclient.h
  80. jobs.h
  81. login/loginwindow.h
  82. mainwindow.h
  83. registryManager/registrymanager.h
  84. mqtt/mqttclient.h
  85. regex.h
  86. blastRecord/blastrecordfactory.h
  87. blastRecord/blastrecord.h
  88. blastRecord/hblastrecord.h
  89. blastRecord/hblastrecorddao.h
  90. blastRecordDet/hblastrecorddet.h
  91. blastRecordDet/hblastrecorddetdao.h
  92. blastRegRecord/hblastregrecord.h
  93. blastRegRecord/hblastregrecorddao.h
  94. fireWidget/firingwidget.h
  95. fireWidget/navprogress.h
  96. )
  97. # 定义 UI 文件列表
  98. set(FORMS
  99. PageWidget.ui
  100. addresspage.ui
  101. blastProject/blastprojectpage.ui
  102. detInfo/detinfopage.ui
  103. detInfo/detdialog.ui
  104. equipment/equipmentpage.ui
  105. login/loginwindow.ui
  106. mainwindow.ui
  107. blastProject/projectdialog.ui
  108. blastopepage.ui
  109. blastRecord/blastrecord.ui
  110. fireWidget/firingwidget.ui
  111. )
  112. # 定义资源文件列表
  113. set(RESOURCES
  114. media.qrc
  115. )
  116. # 添加可执行文件
  117. add_executable(${PROJECT_NAME}
  118. ${SOURCES}
  119. ${HEADERS}
  120. ${FORMS}
  121. ${RESOURCES}
  122. des3encryption.h des3encryption.cpp
  123. countdownwidget.h countdownwidget.cpp
  124. mqttthread.cpp mqttthread.h
  125. serial/serialtool.h serial/serialtool.cpp
  126. serial/serialgps.h serial/serialgps.cpp
  127. paregnrmc.cpp paregnrmc.h
  128. serialgpsthread.h serialgpsthread.cpp
  129. worker/timeupdatethread.h worker/timeupdatethread.cpp
  130. logo.rc
  131. loadingdialog.h loadingdialog.cpp
  132. )
  133. target_link_libraries(pc_system Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui
  134. Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Sql Qt${QT_VERSION_MAJOR}::Network
  135. Qt${QT_VERSION_MAJOR}::Mqtt Qt${QT_VERSION_MAJOR}::WebEngineWidgets OpenSSL::Crypto OpenSSL::SSL Qt${QT_VERSION_MAJOR}::SerialPort)
  136. include(GNUInstallDirs)
  137. install(TARGETS pc_system
  138. LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  139. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  140. )