2
0

CMakeLists.txt 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. cmake_minimum_required(VERSION 3.0)
  2. project(openPilotLog LANGUAGES CXX)
  3. set(CMAKE_INCLUDE_CURRENT_DIR ON)
  4. set(CMAKE_AUTOUIC ON)
  5. set(CMAKE_AUTOMOC ON)
  6. set(CMAKE_AUTORCC ON)
  7. set(CMAKE_CXX_STANDARD 20)
  8. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  9. set(QT_MIN_VERSION "5.5.1")
  10. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_USE_QSTRINGBUILDER")
  11. MESSAGE ("Enabling QStringBuilder")
  12. find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets Sql Network REQUIRED)
  13. # find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets Sql Network LinguistTools REQUIRED)
  14. # find_package(OpenSSL REQUIRED) # Pending testing
  15. find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets Sql Network REQUIRED)
  16. set(PROJECT_SOURCES
  17. main.cpp
  18. src/opl.h
  19. src/opl.cpp
  20. ## GUI
  21. mainwindow.h
  22. mainwindow.cpp
  23. mainwindow.ui
  24. # Dialogs
  25. src/gui/dialogues/firstrundialog.h
  26. src/gui/dialogues/firstrundialog.cpp
  27. src/gui/dialogues/firstrundialog.ui
  28. src/gui/dialogues/newairportdialog.h
  29. src/gui/dialogues/newairportdialog.cpp
  30. src/gui/dialogues/newairportdialog.ui
  31. src/gui/dialogues/newflightdialog.h
  32. src/gui/dialogues/newflightdialog.cpp
  33. src/gui/dialogues/newflightdialog.ui
  34. src/gui/dialogues/newpilotdialog.h
  35. src/gui/dialogues/newpilotdialog.cpp
  36. src/gui/dialogues/newpilot.ui
  37. src/gui/dialogues/newtaildialog.h
  38. src/gui/dialogues/newtaildialog.cpp
  39. src/gui/dialogues/newtail.ui
  40. src/gui/dialogues/newsimdialog.h
  41. src/gui/dialogues/newsimdialog.cpp
  42. src/gui/dialogues/newsimdialog.ui
  43. src/gui/dialogues/exporttocsvdialog.h
  44. src/gui/dialogues/exporttocsvdialog.cpp
  45. src/gui/dialogues/exporttocsvdialog.ui
  46. src/gui/dialogues/entryeditdialog.h
  47. src/gui/dialogues/entryeditdialog.cpp
  48. src/gui/dialogues/flightentryeditdialog.h
  49. src/gui/dialogues/flightentryeditdialog.cpp
  50. # Widgets
  51. src/gui/widgets/homewidget.h
  52. src/gui/widgets/homewidget.cpp
  53. src/gui/widgets/homewidget.ui
  54. src/gui/widgets/totalswidget.h
  55. src/gui/widgets/totalswidget.cpp
  56. src/gui/widgets/totalswidget.ui
  57. src/gui/widgets/backupwidget.h
  58. src/gui/widgets/backupwidget.cpp
  59. src/gui/widgets/backupwidget.ui
  60. src/gui/widgets/debugwidget.h
  61. src/gui/widgets/debugwidget.cpp
  62. src/gui/widgets/debugwidget.ui
  63. src/gui/widgets/settingswidget.h
  64. src/gui/widgets/settingswidget.cpp
  65. src/gui/widgets/settingswidget.ui
  66. src/gui/widgets/tableeditwidget.h
  67. src/gui/widgets/tableeditwidget.cpp
  68. src/gui/widgets/pilottableeditwidget.h
  69. src/gui/widgets/pilottableeditwidget.cpp
  70. src/gui/widgets/tailtableeditwidget.h
  71. src/gui/widgets/tailtableeditwidget.cpp
  72. src/gui/widgets/airporttableeditwidget.h
  73. src/gui/widgets/airporttableeditwidget.cpp
  74. src/gui/widgets/logbooktableeditwidget.h
  75. src/gui/widgets/logbooktableeditwidget.cpp
  76. # Verification
  77. src/gui/verification/validationstate.h
  78. src/gui/verification/userinput.h
  79. src/gui/verification/userinput.cpp
  80. src/gui/verification/timeinput.h
  81. src/gui/verification/timeinput.cpp
  82. src/gui/verification/airportinput.h
  83. src/gui/verification/airportinput.cpp
  84. src/gui/verification/pilotinput.h
  85. src/gui/verification/pilotinput.cpp
  86. src/gui/verification/completerprovider.h
  87. src/gui/verification/completerprovider.cpp
  88. src/gui/verification/tailinput.h
  89. src/gui/verification/tailinput.cpp
  90. src/gui/widgets/currencywidget.h
  91. src/gui/widgets/currencywidget.cpp
  92. # Classes
  93. src/classes/style.h
  94. src/classes/style.cpp
  95. src/classes/paths.h
  96. src/classes/paths.cpp
  97. src/classes/downloadhelper.h
  98. src/classes/downloadhelper.cpp
  99. src/classes/runguard.h
  100. src/classes/runguard.cpp
  101. src/classes/settings.h
  102. src/classes/settings.cpp
  103. src/classes/translator.h
  104. src/classes/translator.cpp
  105. src/classes/jsonhelper.h
  106. src/classes/jsonhelper.cpp
  107. src/classes/md5sum.h
  108. src/classes/md5sum.cpp
  109. src/classes/time.h
  110. src/classes/time.cpp
  111. src/classes/easaftl.h
  112. src/classes/easaftl.cpp
  113. src/classes/date.h
  114. src/classes/date.cpp
  115. src/classes/styleddatedelegate.h
  116. src/classes/styleddatedelegate.cpp
  117. src/classes/styledtimedelegate.h
  118. src/classes/styledtimedelegate.cpp
  119. src/classes/styledpilotdelegate.h
  120. src/classes/styledpilotdelegate.cpp
  121. src/classes/styledregistrationdelegate.h
  122. src/classes/styledregistrationdelegate.cpp
  123. src/classes/styledtypedelegate.h
  124. src/classes/styledtypedelegate.cpp
  125. # Database Entries
  126. src/database/flightentry.h
  127. src/database/flightentry.cpp
  128. src/database/aircraftentry.h
  129. src/database/aircraftentry.cpp
  130. src/database/tailentry.h
  131. src/database/tailentry.cpp
  132. src/database/airportentry.h
  133. src/database/airportentry.cpp
  134. src/database/pilotentry.h
  135. src/database/pilotentry.cpp
  136. src/database/simulatorentry.h
  137. src/database/simulatorentry.cpp
  138. src/database/currencyentry.h
  139. src/database/currencyentry.cpp
  140. src/database/previousexperienceentry.h
  141. src/database/previousexperienceentry.cpp
  142. # Namespaces
  143. src/functions/calc.h
  144. src/functions/calc.cpp
  145. src/functions/log.h
  146. src/functions/log.cpp
  147. src/functions/readcsv.h
  148. src/functions/statistics.h
  149. src/functions/statistics.cpp
  150. src/functions/datetime.h
  151. src/functions/datetime.cpp
  152. # Database
  153. src/database/database.h
  154. src/database/database.cpp
  155. src/database/row.h
  156. src/database/row.cpp
  157. src/database/dbsummary.h
  158. src/database/dbsummary.cpp
  159. src/database/databasecache.h
  160. src/database/databasecache.cpp
  161. src/database/views/logbookviewinfo.h
  162. # Ressources
  163. assets/icons.qrc
  164. assets/database/templates.qrc
  165. assets/themes/stylesheets/breeze/breeze.qrc
  166. assets/themes/stylesheets/qdarkstyle/qdarkstyle.qrc
  167. # network
  168. src/network/flightawareflightdata.h
  169. src/network/flightawarequery.h
  170. src/network/flightawarequery.cpp
  171. src/network/flightawarejsonparser.h
  172. src/network/flightawarejsonparser.cpp
  173. # Testing / Debug
  174. src/testing/importCrewlounge/importcrewlounge.h
  175. src/testing/importCrewlounge/importcrewlounge.cpp
  176. src/testing/importCrewlounge/processpilots.h
  177. src/testing/importCrewlounge/processpilots.cpp
  178. src/testing/importCrewlounge/processaircraft.h
  179. src/testing/importCrewlounge/processaircraft.cpp
  180. src/testing/importCrewlounge/processflights.h
  181. src/testing/importCrewlounge/processflights.cpp
  182. src/testing/atimer.h
  183. src/testing/atimer.cpp
  184. src/testing/randomgenerator.h
  185. src/testing/randomgenerator.cpp
  186. )
  187. # This is currently a bit buggy, see
  188. # https://bugreports.qt.io/browse/QTBUG-41736
  189. # https://bugreports.qt.io/browse/QTBUG-76410
  190. # Before working on the translations themselves, check for updates and consider not updating for
  191. # every build due to danger of loss of translations...
  192. #if (Qt5Widgets_FOUND)
  193. # if (Qt5Widgets_VERSION VERSION_LESS 5.15.0)
  194. # message("Translations are available for Qt5 version >= 5.15")
  195. # else()
  196. # message("Qt > 5.15 detected. Enabling translations.")
  197. # set(TS_FILES
  198. # l10n/openpilotlog_en.ts
  199. # l10n/openpilotlog_de.ts
  200. # l10n/openpilotlog_es.ts
  201. # )
  202. # set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "l10n")
  203. # qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
  204. # endif(Qt5Widgets_VERSION VERSION_LESS 5.15.0)
  205. #endif(Qt5Widgets_FOUND)
  206. # Disable Debug output for Release Build
  207. if(CMAKE_BUILD_TYPE STREQUAL "Debug")
  208. message("Build type: Debug")
  209. elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
  210. message("Build type: Release")
  211. add_definitions(-DQT_NO_DEBUG_OUTPUT)
  212. endif()
  213. # set the win32 entry point to avoid terminal popping up
  214. if(WIN32)
  215. MESSAGE("Building for WIN32")
  216. if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
  217. qt_add_executable(openPilotLog WIN32
  218. ${PROJECT_SOURCES}
  219. ${QM_FILES}
  220. ${app_icon_macos}
  221. )
  222. else()
  223. add_executable(openPilotLog
  224. ${PROJECT_SOURCES}
  225. ${QM_FILES}
  226. ${app_icon_macos}
  227. )
  228. endif()
  229. else()
  230. if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
  231. qt_add_executable(openPilotLog
  232. ${PROJECT_SOURCES}
  233. ${QM_FILES}
  234. ${app_icon_macos}
  235. )
  236. else()
  237. add_executable(openPilotLog
  238. ${PROJECT_SOURCES}
  239. ${QM_FILES}
  240. ${app_icon_macos}
  241. )
  242. endif()
  243. endif()
  244. set_target_properties(openPilotLog PROPERTIES
  245. MACOSX_BUNDLE TRUE
  246. )
  247. # The MACOSX_BUNDLE_ICON_FILE variable is added to the Info.plist
  248. # generated by CMake. This variable contains the .icns file name,
  249. # without the path.
  250. set(MACOSX_BUNDLE_ICON_FILE icon_ios.icns)
  251. # And the following tells CMake where to find and install the file itself.
  252. set(app_icon_macos "${CMAKE_CURRENT_SOURCE_DIR}/assets/opl-icons/app/icon_ios.icns")
  253. set_source_files_properties(${app_icon_macos} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
  254. # target_link_libraries(openPilotLog PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Sql Qt${QT_VERSION_MAJOR}::Network OpenSSL::SSL)
  255. target_link_libraries(openPilotLog PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Sql Qt${QT_VERSION_MAJOR}::Network)
  256. install(TARGETS openPilotLog DESTINATION bin)