Mercurial > public > ostc_companion
comparison CMakeLists.txt @ 9:971b9fd4cd30
Linux cares about upper / lower cases => fixed file name
| author | Ideenmodellierer |
|---|---|
| date | Mon, 12 Jan 2026 13:52:28 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 8:21ce6187d32e | 9:971b9fd4cd30 |
|---|---|
| 1 cmake_minimum_required(VERSION 3.21) | |
| 2 | |
| 3 project(OSTCCompanion VERSION 1.0 LANGUAGES CXX C) | |
| 4 | |
| 5 # ---------------------------------------- | |
| 6 # C++ Standard | |
| 7 # ---------------------------------------- | |
| 8 set(CMAKE_CXX_STANDARD 17) | |
| 9 set(CMAKE_CXX_STANDARD_REQUIRED ON) | |
| 10 set(CMAKE_AUTOMOC ON) | |
| 11 set(CMAKE_AUTORCC ON) | |
| 12 set(CMAKE_AUTOUIC ON) | |
| 13 | |
| 14 # ---------------------------------------- | |
| 15 # Qt6 Modules | |
| 16 # ---------------------------------------- | |
| 17 find_package(Qt6 REQUIRED COMPONENTS | |
| 18 Core | |
| 19 Gui | |
| 20 Widgets | |
| 21 Network | |
| 22 Svg | |
| 23 Xml | |
| 24 SerialPort | |
| 25 LinguistTools | |
| 26 ) | |
| 27 | |
| 28 | |
| 29 # ---------------------------------------- | |
| 30 # Sources, Header, UI and Ressources | |
| 31 # ---------------------------------------- | |
| 32 set(SOURCES | |
| 33 main.cpp | |
| 34 AES/rijndael.cpp | |
| 35 editlogdialog.cpp | |
| 36 Utils/Exception.cpp | |
| 37 Utils/Log.cpp | |
| 38 Utils/LogAppender.cpp | |
| 39 Utils/LogConsole.cpp | |
| 40 Utils/LogFile.cpp | |
| 41 Utils/ProgressEvent.cpp | |
| 42 MainWindow.cpp | |
| 43 Serial.cpp | |
| 44 HexFile.cpp | |
| 45 SettingsDialog.cpp | |
| 46 HardwareOperations.cpp | |
| 47 OSTCFrogOperations.cpp | |
| 48 OSTCSportOperations.cpp | |
| 49 OSTC2cOperations.cpp | |
| 50 OSTC2Operations.cpp | |
| 51 OSTC3Operations.cpp | |
| 52 OSTC3pOperations.cpp | |
| 53 OSTC4Operations.cpp | |
| 54 OSTC_CR_Operations.cpp | |
| 55 ) | |
| 56 | |
| 57 set(HEADERS | |
| 58 AES/rijndael.h | |
| 59 AES/Adler16.h | |
| 60 Utils/Exception.h | |
| 61 Utils/Log.h | |
| 62 Utils/LogAppender.h | |
| 63 Utils/LogConsole.h | |
| 64 Utils/LogFile.h | |
| 65 Utils/ProgressEvent.h | |
| 66 MainWindow.h | |
| 67 Serial.h | |
| 68 HexFile.h | |
| 69 SettingsDialog.h | |
| 70 HardwareOperations.h | |
| 71 OSTCFrogOperations.h | |
| 72 OSTCSportOperations.h | |
| 73 OSTC2cOperations.h | |
| 74 OSTC2Operations.h | |
| 75 OSTC3Operations.h | |
| 76 OSTC3pOperations.h | |
| 77 OSTC4Operations.h | |
| 78 OSTC_CR_Operations.h | |
| 79 editlogdialog.h | |
| 80 crcmodel.h | |
| 81 ) | |
| 82 | |
| 83 set(UIS | |
| 84 LogEditor.ui | |
| 85 MainWindow.ui | |
| 86 Settings.ui | |
| 87 ) | |
| 88 | |
| 89 set(RESOURCES | |
| 90 Resources.qrc | |
| 91 icon.rc | |
| 92 ) | |
| 93 | |
| 94 set(TRANSLATIONS | |
| 95 Translations/companion_DE.ts | |
| 96 Translations/companion_FR.ts | |
| 97 Translations/companion_ES.ts | |
| 98 Translations/companion_IT.ts | |
| 99 Translations/companion_RU.ts | |
| 100 ) | |
| 101 | |
| 102 set(app_icon_resource_windows "${CMAKE_CURRENT_SOURCE_DIR}/icon.rc") | |
| 103 | |
| 104 | |
| 105 add_library(crcmodel STATIC | |
| 106 crcmodel.c | |
| 107 ) | |
| 108 set_source_files_properties(crcmodel.c | |
| 109 PROPERTIES | |
| 110 LANGUAGE C | |
| 111 ) | |
| 112 target_include_directories(crcmodel PUBLIC | |
| 113 ${CMAKE_CURRENT_SOURCE_DIR} | |
| 114 ) | |
| 115 # ---------------------------------------- | |
| 116 # Executable erstellen | |
| 117 # ---------------------------------------- | |
| 118 qt_add_executable(${PROJECT_NAME} | |
| 119 ${SOURCES} | |
| 120 ${HEADERS} | |
| 121 ${UIS} | |
| 122 ${RESOURCES} | |
| 123 Utils/Export.h | |
| 124 ${app_icon_resource_windows} | |
| 125 ostc45_icon.cpp | |
| 126 ostc45_icon.h | |
| 127 crc_wrapper.h | |
| 128 crc_wrapper.cpp | |
| 129 ) | |
| 130 | |
| 131 target_include_directories(${PROJECT_NAME} PRIVATE | |
| 132 ${CMAKE_CURRENT_SOURCE_DIR} # Root | |
| 133 ${CMAKE_CURRENT_SOURCE_DIR}/Utils | |
| 134 ${CMAKE_CURRENT_SOURCE_DIR}/AES | |
| 135 ) | |
| 136 | |
| 137 # ---------------------------------------- | |
| 138 # Qt Libraries verlinken | |
| 139 # ---------------------------------------- | |
| 140 target_link_libraries(${PROJECT_NAME} | |
| 141 PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Network Qt6::Svg Qt6::Xml Qt6::SerialPort crcmodel | |
| 142 ) | |
| 143 | |
| 144 # ---------------------------------------- | |
| 145 # Plattform-spezifische Anpassungen | |
| 146 # ---------------------------------------- | |
| 147 if(WIN32) | |
| 148 target_compile_definitions(${PROJECT_NAME} PRIVATE _CRT_SECURE_NO_WARNINGS=1 BUILDING_OSTC_COMPANION) | |
| 149 elseif(APPLE) | |
| 150 target_compile_options(${PROJECT_NAME} PRIVATE -std=c++17 -Wno-inconsistent-missing-override) | |
| 151 elseif(UNIX) | |
| 152 target_compile_options(${PROJECT_NAME} PRIVATE -std=c++17) | |
| 153 set_target_properties(${PROJECT_NAME} PROPERTIES | |
| 154 BUILD_RPATH "\$ORIGIN/lib" | |
| 155 ) | |
| 156 endif() | |
| 157 | |
| 158 # ---------------------------------------- | |
| 159 # Debug/Release-Builds | |
| 160 # ---------------------------------------- | |
| 161 if(CMAKE_BUILD_TYPE MATCHES Debug) | |
| 162 target_compile_definitions(${PROJECT_NAME} PRIVATE DEBUG=1) | |
| 163 endif() | |
| 164 | |
| 165 # ---------------------------------------- | |
| 166 # Version aus Datei einlesen (optional) | |
| 167 # ---------------------------------------- | |
| 168 file(STRINGS "${CMAKE_SOURCE_DIR}/VERSION.txt" VERSION_CONTENT) | |
| 169 string(REGEX MATCH "MAJOR=([0-9]+)" _ ${VERSION_CONTENT}) | |
| 170 set(MAJOR_VERSION ${CMAKE_MATCH_1}) | |
| 171 string(REGEX MATCH "MINOR=([0-9]+)" _ ${VERSION_CONTENT}) | |
| 172 set(MINOR_VERSION ${CMAKE_MATCH_1}) | |
| 173 string(REGEX MATCH "PATCH=([0-9]+)" _ ${VERSION_CONTENT}) | |
| 174 set(PATCH_VERSION ${CMAKE_MATCH_1}) | |
| 175 string(REGEX MATCH "BETA=([0-9]+)" _ ${VERSION_CONTENT}) | |
| 176 set(BETA_VERSION ${CMAKE_MATCH_1}) | |
| 177 | |
| 178 | |
| 179 message("MAJOR_VERSION = '${MAJOR_VERSION}'") | |
| 180 | |
| 181 target_compile_definitions(${PROJECT_NAME} PRIVATE | |
| 182 MAJOR_VERSION=${MAJOR_VERSION} | |
| 183 MINOR_VERSION=${MINOR_VERSION} | |
| 184 PATCH_VERSION=${PATCH_VERSION} | |
| 185 BETA_VERSION=${BETA_VERSION} | |
| 186 ) | |
| 187 | |
| 188 # Show folder in Qt Creator | |
| 189 file(GLOB ICON_FILES "${CMAKE_SOURCE_DIR}/Images/*") | |
| 190 add_custom_target(Resources ALL SOURCES ${ICON_FILES}) | |
| 191 | |
| 192 | |
| 193 qt6_add_translation(QM_FILES ${TRANSLATIONS}) | |
| 194 | |
| 195 if(CMAKE_BUILD_TYPE MATCHES Release) | |
| 196 target_compile_definitions(${PROJECT_NAME} PRIVATE DEBUG=1) | |
| 197 | |
| 198 message("Build release and installer") | |
| 199 | |
| 200 set(CPACK_IFW_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/Images/inst_OSTC_Companion.ico") | |
| 201 | |
| 202 install(FILES ${CMAKE_SOURCE_DIR}/Images/app_OSTC_Companion.ico | |
| 203 DESTINATION . # relativ zum Package root | |
| 204 COMPONENT Core) | |
| 205 | |
| 206 install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin COMPONENT Core) | |
| 207 | |
| 208 qt_generate_deploy_app_script( | |
| 209 TARGET ${PROJECT_NAME} | |
| 210 OUTPUT_SCRIPT deploy_script | |
| 211 NO_UNSUPPORTED_PLATFORM_ERROR | |
| 212 ) | |
| 213 | |
| 214 install(SCRIPT ${deploy_script} | |
| 215 COMPONENT Core) | |
| 216 | |
| 217 # CPack IFW Konfiguration | |
| 218 set(CPACK_GENERATOR "IFW") | |
| 219 set(CPACK_IFW_ROOT "D:/Programme/QT/Tools/QtInstallerFramework/4.10") | |
| 220 set(CPACK_PACKAGE_VERSION_MAJOR "3") | |
| 221 set(CPACK_PACKAGE_VERSION_MINOR "3") | |
| 222 set(CPACK_PACKAGE_NAME "${PROJECT_NAME}") | |
| 223 set(CPACK_PACKAGE_VENDOR "Heinrichs Weikamp") | |
| 224 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OSTC Companion Application") | |
| 225 set (CPACK_IFW_PACKAGE_NAME "${PROJECT_NAME} 3.3.1") | |
| 226 set (CPACK_IFW_PACKAGE_TITLE "${PROJECT_NAME} Installer") | |
| 227 set (CPACK_IFW_PACKAGE_PUBLISHER "Heinrichs Weikamp") | |
| 228 set (CPACK_IFW_PACKAGE_WIZARD_STYLE "Modern") | |
| 229 set (CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST OFF) | |
| 230 | |
| 231 set (CPACK_IFW_PACKAGE_START_MENU_DIRECTORY "OSTC-Tools") | |
| 232 | |
| 233 include(CPack) | |
| 234 include(CPackIFW) | |
| 235 | |
| 236 # Hauptkomponente | |
| 237 cpack_add_component(Core | |
| 238 DISPLAY_NAME "OSTC Companion" | |
| 239 DESCRIPTION "OSTC maintenance application" | |
| 240 REQUIRED | |
| 241 ) | |
| 242 | |
| 243 cpack_ifw_configure_component(Core ESSENTIAL FORCED_INSTALLATION) | |
| 244 endif() | |
| 245 | |
| 246 | |
| 247 |
