2
0

CMakeLists.txt 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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 17)
  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 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. # Widgets
  47. src/gui/widgets/tailswidget.h
  48. src/gui/widgets/tailswidget.cpp
  49. src/gui/widgets/aircraftwidget.ui
  50. src/gui/widgets/airportwidget.h
  51. src/gui/widgets/airportwidget.cpp
  52. src/gui/widgets/airportwidget.ui
  53. src/gui/widgets/backupwidget.h
  54. src/gui/widgets/backupwidget.cpp
  55. src/gui/widgets/backupwidget.ui
  56. src/gui/widgets/debugwidget.h
  57. src/gui/widgets/debugwidget.cpp
  58. src/gui/widgets/debugwidget.ui
  59. src/gui/widgets/homewidget.h
  60. src/gui/widgets/homewidget.cpp
  61. src/gui/widgets/homewidget.ui
  62. src/gui/widgets/logbookwidget.h
  63. src/gui/widgets/logbookwidget.cpp
  64. src/gui/widgets/logbookwidget.ui
  65. src/gui/widgets/pilotswidget.h
  66. src/gui/widgets/pilotswidget.cpp
  67. src/gui/widgets/pilotswidget.ui
  68. src/gui/widgets/settingswidget.h
  69. src/gui/widgets/settingswidget.cpp
  70. src/gui/widgets/settingswidget.ui
  71. src/gui/widgets/totalswidget.h
  72. src/gui/widgets/totalswidget.cpp
  73. src/gui/widgets/totalswidget.ui
  74. # Verification
  75. src/gui/verification/validationstate.h
  76. src/gui/verification/userinput.h
  77. src/gui/verification/userinput.cpp
  78. src/gui/verification/timeinput.h
  79. src/gui/verification/timeinput.cpp
  80. src/gui/verification/airportinput.h
  81. src/gui/verification/airportinput.cpp
  82. src/gui/verification/pilotinput.h
  83. src/gui/verification/pilotinput.cpp
  84. src/gui/verification/completerprovider.h
  85. src/gui/verification/completerprovider.cpp
  86. src/gui/verification/tailinput.h
  87. src/gui/verification/tailinput.cpp
  88. # Classes
  89. src/classes/style.h
  90. src/classes/style.cpp
  91. src/classes/paths.h
  92. src/classes/paths.cpp
  93. src/classes/downloadhelper.h
  94. src/classes/downloadhelper.cpp
  95. src/classes/runguard.h
  96. src/classes/runguard.cpp
  97. src/classes/settings.h
  98. src/classes/settings.cpp
  99. src/classes/translator.h
  100. src/classes/translator.cpp
  101. src/classes/jsonhelper.h
  102. src/classes/jsonhelper.cpp
  103. src/classes/md5sum.h
  104. src/classes/md5sum.cpp
  105. src/classes/time.h
  106. src/classes/time.cpp
  107. # Database Entries
  108. src/database/flightentry.h
  109. src/database/flightentry.cpp
  110. src/database/aircraftentry.h
  111. src/database/aircraftentry.cpp
  112. src/database/tailentry.h
  113. src/database/tailentry.cpp
  114. src/database/airportentry.h
  115. src/database/airportentry.cpp
  116. src/database/pilotentry.h
  117. src/database/pilotentry.cpp
  118. src/database/simulatorentry.h
  119. src/database/simulatorentry.cpp
  120. src/database/currencyentry.h
  121. src/database/currencyentry.cpp
  122. src/database/previousexperienceentry.h
  123. src/database/previousexperienceentry.cpp
  124. # Namespaces
  125. src/functions/calc.h
  126. src/functions/calc.cpp
  127. src/functions/log.h
  128. src/functions/log.cpp
  129. src/functions/readcsv.h
  130. src/functions/statistics.h
  131. src/functions/statistics.cpp
  132. src/functions/datetime.h
  133. src/functions/datetime.cpp
  134. # Database
  135. src/database/database.h
  136. src/database/database.cpp
  137. src/database/row.h
  138. src/database/row.cpp
  139. src/database/dbsummary.h
  140. src/database/dbsummary.cpp
  141. src/database/databasecache.h
  142. src/database/databasecache.cpp
  143. # Ressources
  144. assets/icons.qrc
  145. assets/database/templates.qrc
  146. assets/themes/stylesheets/breeze/breeze.qrc
  147. assets/themes/stylesheets/qdarkstyle/qdarkstyle.qrc
  148. # Testing / Debug
  149. src/testing/importCrewlounge/importcrewlounge.h
  150. src/testing/importCrewlounge/importcrewlounge.cpp
  151. src/testing/importCrewlounge/processpilots.h
  152. src/testing/importCrewlounge/processpilots.cpp
  153. src/testing/importCrewlounge/processaircraft.h
  154. src/testing/importCrewlounge/processaircraft.cpp
  155. src/testing/importCrewlounge/processflights.h
  156. src/testing/importCrewlounge/processflights.cpp
  157. src/testing/atimer.h
  158. src/testing/atimer.cpp
  159. src/testing/randomgenerator.h
  160. src/testing/randomgenerator.cpp
  161. )
  162. # This is currently a bit buggy, see
  163. # https://bugreports.qt.io/browse/QTBUG-41736
  164. # https://bugreports.qt.io/browse/QTBUG-76410
  165. # Before working on the translations themselves, check for updates and consider not updating for
  166. # every build due to danger of loss of translations...
  167. #if (Qt5Widgets_FOUND)
  168. # if (Qt5Widgets_VERSION VERSION_LESS 5.15.0)
  169. # message("Translations are available for Qt5 version >= 5.15")
  170. # else()
  171. # message("Qt > 5.15 detected. Enabling translations.")
  172. # set(TS_FILES
  173. # l10n/openpilotlog_en.ts
  174. # l10n/openpilotlog_de.ts
  175. # l10n/openpilotlog_es.ts
  176. # )
  177. # set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "l10n")
  178. # qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
  179. # endif(Qt5Widgets_VERSION VERSION_LESS 5.15.0)
  180. #endif(Qt5Widgets_FOUND)
  181. # Disable Debug output for Release Build
  182. if(CMAKE_BUILD_TYPE STREQUAL "Debug")
  183. message("Build type: Debug")
  184. elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
  185. message("Build type: Release")
  186. add_definitions(-DQT_NO_DEBUG_OUTPUT)
  187. endif()
  188. # set the win32 entry point to avoid terminal popping up
  189. if(WIN32)
  190. MESSAGE("Building for WIN32")
  191. if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
  192. qt_add_executable(openPilotLog WIN32
  193. ${PROJECT_SOURCES}
  194. ${QM_FILES}
  195. ${app_icon_macos}
  196. )
  197. else()
  198. add_executable(openPilotLog
  199. ${PROJECT_SOURCES}
  200. ${QM_FILES}
  201. ${app_icon_macos}
  202. )
  203. endif()
  204. else()
  205. if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
  206. qt_add_executable(openPilotLog
  207. ${PROJECT_SOURCES}
  208. ${QM_FILES}
  209. ${app_icon_macos}
  210. )
  211. else()
  212. add_executable(openPilotLog
  213. ${PROJECT_SOURCES}
  214. ${QM_FILES}
  215. ${app_icon_macos}
  216. )
  217. endif()
  218. endif()
  219. set_target_properties(openPilotLog PROPERTIES
  220. MACOSX_BUNDLE TRUE
  221. )
  222. # The MACOSX_BUNDLE_ICON_FILE variable is added to the Info.plist
  223. # generated by CMake. This variable contains the .icns file name,
  224. # without the path.
  225. set(MACOSX_BUNDLE_ICON_FILE icon_ios.icns)
  226. # And the following tells CMake where to find and install the file itself.
  227. set(app_icon_macos "${CMAKE_CURRENT_SOURCE_DIR}/assets/opl-icons/app/icon_ios.icns")
  228. set_source_files_properties(${app_icon_macos} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
  229. # target_link_libraries(openPilotLog PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Sql Qt${QT_VERSION_MAJOR}::Network OpenSSL::SSL)
  230. target_link_libraries(openPilotLog PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Sql Qt${QT_VERSION_MAJOR}::Network)
  231. install(TARGETS openPilotLog DESTINATION bin)