|
| 1 | +cmake_minimum_required(VERSION 3.14) |
| 2 | + |
| 3 | +get_filename_component(ProjectId ${CMAKE_CURRENT_LIST_DIR} NAME) |
| 4 | +string(REPLACE " " "_" ProjectId ${ProjectId}) |
| 5 | +project(${ProjectId} CXX) |
| 6 | + |
| 7 | +set(CMAKE_INCLUDE_CURRENT_DIR ON) |
| 8 | + |
| 9 | +set(CMAKE_AUTOUIC ON) |
| 10 | +set(CMAKE_AUTOMOC ON) |
| 11 | +set(CMAKE_AUTORCC ON) |
| 12 | + |
| 13 | +set(CMAKE_CXX_STANDARD 11) |
| 14 | +set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 15 | + |
| 16 | +# QtCreator supports the following variables for Android, which are identical to qmake Android variables. |
| 17 | +# Check https://doc.qt.io/qt/deployment-android.html for more information. |
| 18 | +# They need to be set before the find_package(...) calls below. |
| 19 | + |
| 20 | +#if(ANDROID) |
| 21 | +# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") |
| 22 | +# if (ANDROID_ABI STREQUAL "armeabi-v7a") |
| 23 | +# set(ANDROID_EXTRA_LIBS |
| 24 | +# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so |
| 25 | +# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so) |
| 26 | +# endif() |
| 27 | +#endif() |
| 28 | + |
| 29 | +# - - - For static plugins |
| 30 | +#set("OpenCV_DIR" "E:/libs/opencv-4.5.3/release/x86/vc16/staticlib") # Win32 |
| 31 | +#set("exiv2_DIR" "E:/libs/exiv2-0.27.4/release/lib/cmake/exiv2") # Win32 |
| 32 | +#find_package(OpenCV REQUIRED) |
| 33 | +#find_package(exiv2 REQUIRED CONFIG NAMES exiv2) |
| 34 | +# - - - |
| 35 | + |
| 36 | +find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Quick QmlImportScanner Widgets Concurrent Sql Multimedia REQUIRED) |
| 37 | +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Quick QmlImportScanner Widgets Concurrent Sql Multimedia REQUIRED) |
| 38 | + |
| 39 | +set(PROJECT_SOURCES |
| 40 | + |
| 41 | + src/main.cpp |
| 42 | + data/data.qrc |
| 43 | + icons/icons.qrc |
| 44 | + qml/qml.qrc |
| 45 | + |
| 46 | + src/options.h |
| 47 | + src/settings.h |
| 48 | + src/support.h |
| 49 | + src/qmlcontroller.h |
| 50 | + src/qmlcontroller.cpp |
| 51 | + src/logger.h |
| 52 | + src/logger.cpp |
| 53 | + src/loaderclass.h |
| 54 | + src/loaderclass.cpp |
| 55 | + src/applicationinfo.h |
| 56 | + src/applicationinfo.cpp |
| 57 | + src/iconitem.h |
| 58 | + src/iconmodel.h |
| 59 | + src/iconmodel.cpp |
| 60 | + |
| 61 | + src/plugins/baseplugin.h |
| 62 | + src/plugins/exivplugin.h |
| 63 | + src/plugins/exivplugin.cpp |
| 64 | + src/plugins/visionplugin.h |
| 65 | + src/plugins/visionplugin.cpp |
| 66 | + src/plugins/pluginloader.h |
| 67 | + src/plugins/pluginloader.cpp |
| 68 | + src/plugins/pluginitem.h |
| 69 | + src/plugins/pluginmodel.h |
| 70 | + src/plugins/pluginmodel.cpp |
| 71 | + |
| 72 | + src/filehandler/basehandler.h |
| 73 | + src/filehandler/basehandler.cpp |
| 74 | + src/filehandler/confighandler.h |
| 75 | + src/filehandler/confighandler.cpp |
| 76 | + src/filehandler/folderfiltermodel.h |
| 77 | + src/filehandler/folderfiltermodel.cpp |
| 78 | + src/filehandler/folderhandler.h |
| 79 | + src/filehandler/folderhandler.cpp |
| 80 | + src/filehandler/folderitem.h |
| 81 | + src/filehandler/foldermodel.h |
| 82 | + src/filehandler/foldermodel.cpp |
| 83 | + |
| 84 | + src/listhandler/listhandler.h |
| 85 | + src/listhandler/listhandler.cpp |
| 86 | + src/listhandler/listsort.h |
| 87 | + src/listhandler/listsort.cpp |
| 88 | + src/listhandler/imageprovider.h |
| 89 | + src/listhandler/imageprovider.cpp |
| 90 | + |
| 91 | + src/listhandler/basefile/basefile.h |
| 92 | + src/listhandler/basefile/basefile.cpp |
| 93 | + src/listhandler/basefile/imagefile.h |
| 94 | + src/listhandler/basefile/imagefile.cpp |
| 95 | + src/listhandler/basefile/videofile.h |
| 96 | + src/listhandler/basefile/videofile.cpp |
| 97 | + |
| 98 | + src/listhandler/command/commandlist.h |
| 99 | + src/listhandler/command/commandlist.cpp |
| 100 | + src/listhandler/command/commanddata.h |
| 101 | + src/listhandler/command/basecommand.h |
| 102 | + src/listhandler/command/basecommand.cpp |
| 103 | + src/listhandler/command/commanditem.h |
| 104 | + src/listhandler/command/commandmodel.h |
| 105 | + src/listhandler/command/commandmodel.cpp |
| 106 | + src/listhandler/command/copycommand.h |
| 107 | + src/listhandler/command/copycommand.cpp |
| 108 | + src/listhandler/command/favoritecommand.h |
| 109 | + src/listhandler/command/favoritecommand.cpp |
| 110 | + src/listhandler/command/movecommand.h |
| 111 | + src/listhandler/command/movecommand.cpp |
| 112 | + |
| 113 | + src/listhandler/models/fileitem.h |
| 114 | + src/listhandler/models/filemodel.h |
| 115 | + src/listhandler/models/filemodel.cpp |
| 116 | + src/listhandler/models/listmodels.h |
| 117 | + src/listhandler/models/imagemodel.h |
| 118 | + src/listhandler/models/imagemodel.cpp |
| 119 | + src/listhandler/models/labelmodel.h |
| 120 | + src/listhandler/models/labelmodel.cpp |
| 121 | + |
| 122 | + src/listhandler/compare/comparelist.h |
| 123 | + src/listhandler/compare/comparelist.cpp |
| 124 | + src/listhandler/compare/tablemodel.h |
| 125 | + src/listhandler/compare/tablemodel.cpp |
| 126 | + |
| 127 | + src/listhandler/database/database.h |
| 128 | + src/listhandler/database/database.cpp |
| 129 | + src/listhandler/database/sqlhandler.h |
| 130 | + src/listhandler/database/sqlhandler.cpp |
| 131 | + src/listhandler/database/headeritem.h |
| 132 | + src/listhandler/database/headermodel.h |
| 133 | + src/listhandler/database/headermodel.cpp |
| 134 | + ) |
| 135 | + |
| 136 | +include_directories(src) # Avoids long headers (sorry) |
| 137 | + |
| 138 | +if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) |
| 139 | + qt_add_executable(${CMAKE_PROJECT_NAME} |
| 140 | + ${PROJECT_SOURCES} |
| 141 | + ) |
| 142 | +else() |
| 143 | + if(ANDROID) |
| 144 | + add_library(${CMAKE_PROJECT_NAME} SHARED |
| 145 | + ${PROJECT_SOURCES} |
| 146 | + ) |
| 147 | + else() |
| 148 | + add_executable(${CMAKE_PROJECT_NAME} |
| 149 | + ${PROJECT_SOURCES} |
| 150 | + ) |
| 151 | + endif() |
| 152 | +endif() |
| 153 | + |
| 154 | +target_compile_definitions(${CMAKE_PROJECT_NAME} |
| 155 | + PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>) |
| 156 | + |
| 157 | +target_link_libraries(${CMAKE_PROJECT_NAME} |
| 158 | + PRIVATE Qt${QT_VERSION_MAJOR}::Core |
| 159 | + Qt${QT_VERSION_MAJOR}::Quick |
| 160 | + Qt${QT_VERSION_MAJOR}::Widgets |
| 161 | + Qt${QT_VERSION_MAJOR}::Concurrent |
| 162 | + Qt${QT_VERSION_MAJOR}::Sql |
| 163 | + Qt${QT_VERSION_MAJOR}::Multimedia) |
| 164 | + |
| 165 | +# - - - For static build |
| 166 | +#set(CMAKE_CXX_FLAGS_RELEASE "/MT") |
| 167 | +#qt5_import_qml_plugins(${CMAKE_PROJECT_NAME}) |
| 168 | +#target_link_libraries(${CMAKE_PROJECT_NAME} |
| 169 | +# PRIVATE Qt${QT_VERSION_MAJOR}::Core |
| 170 | +# Qt${QT_VERSION_MAJOR}::Quick |
| 171 | +# Qt${QT_VERSION_MAJOR}::Widgets |
| 172 | +# Qt${QT_VERSION_MAJOR}::Concurrent |
| 173 | +# Qt${QT_VERSION_MAJOR}::Sql |
| 174 | +# Qt${QT_VERSION_MAJOR}::Multimedia |
| 175 | +# ${CMAKE_BINARY_DIR}/plugins/opencv_plugin.lib |
| 176 | +# ${OpenCV_LIBS} |
| 177 | +# ${CMAKE_BINARY_DIR}/plugins/exiv2_plugin.lib |
| 178 | +# exiv2lib |
| 179 | +# "E:/libs/exiv2-0.27.4/release/lib/exiv2-xmp.lib" |
| 180 | +# "E:/libs/exiv2-0.27.4/release/lib/libexpat.lib" |
| 181 | +# "E:/libs/exiv2-0.27.4/release/lib/zlibstatic.lib") |
0 commit comments