-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
169 lines (146 loc) · 6.19 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
cmake_minimum_required(VERSION 3.20)
project(memory VERSION 1.0.3 LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE})
if(APPLE)
set(APPLICATION_DIR_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PROJECT_NAME}.app/Contents/MacOS)
else()
set(APPLICATION_DIR_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
endif()
include_directories(./src)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Quick Svg Multimedia Network)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick Svg Multimedia Network)
qt_add_big_resources(QRC_RESOURCES qml.qrc)
list(APPEND QRC_RESOURCES qml.qrc)
set_property(SOURCE qml.qrc PROPERTY SKIP_AUTORCC ON)
add_definitions(-DPASSWORD="${PASSWORD}")
add_definitions(-DVERSION="${PROJECT_VERSION}")
add_definitions(-DINFOURL="${memorydata_url}")
message("password: ${PASSWORD}")
message("version: ${PROJECT_VERSION}")
message("info url: ${memorydata_url}")
set(PROJECT_SOURCES
${QRC_RESOURCES}
main.cpp
src/timelinereader.h src/timelinereader.cpp
src/studentreader.h src/studentreader.cpp
src/teacherfilereader.h src/teacherfilereader.cpp
src/maintool.h src/maintool.cpp
src/activityhelper.h src/activityhelper.cpp
src/imageprovider.h src/imageprovider.cpp
src/base.h src/base.cpp
src/encodethread.h src/encodethread.cpp
src/direncoder.h src/direncoder.cpp
src/direncodemanager.h src/direncodemanager.cpp
src/database.h src/database.cpp
src/memoryapplication.h src/memoryapplication.cpp
src/databaseinitializer.h src/databaseinitializer.cpp
src/downloader.h src/downloader.cpp
src/downloadmanager.h src/downloadmanager.cpp
src/datamanagerhelper.h src/datamanagerhelper.cpp
src/filelistreader.h src/filelistreader.cpp
src/profilepictureupdater.h src/profilepictureupdater.cpp
src/bigfiledownloader.h src/bigfiledownloader.cpp
src/activityupdater.h src/activityupdater.cpp
src/uploader.h src/uploader.cpp
src/packer.h src/packer.cpp
src/uploadpreviewimageprovider.h src/uploadpreviewimageprovider.cpp
src/dataupdatehelper.h src/dataupdatehelper.cpp
src/commandrunner.h src/commandrunner.cpp
src/firstframepicker.h src/firstframepicker.cpp
)
if(WIN32)
list(APPEND PROJECT_SOURCES win32_logo.rc)
list(APPEND PROJECT_SOURCES src/app_dump.h)
endif()
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(${PROJECT_NAME}
MANUAL_FINALIZATION
${PROJECT_SOURCES}
)
else()
add_executable(${PROJECT_NAME}
${PROJECT_SOURCES}
)
endif()
target_compile_definitions(${PROJECT_NAME}
PRIVATE
QT_MESSAGELOGCONTEXT
)
target_include_directories(${PROJECT_NAME} PRIVATE ${Qt6Core_PRIVATE_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Quick
Qt${QT_VERSION_MAJOR}::Multimedia
Qt${QT_VERSION_MAJOR}::Network
Qt${QT_VERSION_MAJOR}::Svg
)
if(${QT_VERSION} VERSION_LESS 6.1.0)
set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.${PROJECT_NAME})
endif()
set_target_properties(${PROJECT_NAME} PROPERTIES
${BUNDLE_ID_OPTION}
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)
include(GNUInstallDirs)
install(TARGETS ${PROJECT_NAME}
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(QT_VERSION_MAJOR EQUAL 6)
qt_import_qml_plugins(${PROJECT_NAME})
qt_finalize_executable(${PROJECT_NAME})
endif()
if (APPLE)
find_program(QT_DEPLOY_QT NAMES macdeployqt6)
add_custom_target(Script-DeployRelease
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/dist
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_SOURCE_DIR}/dist
COMMAND ${QT_DEPLOY_QT} ${CMAKE_SOURCE_DIR}/dist/${PROJECT_NAME}.app -verbose=1 -qmldir=${CMAKE_CURRENT_LIST_DIR}/qml -dmg
COMMENT "MacOS Deploying Qt Dependencies After Build........."
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endif()
if (WIN32)
find_program(QT_DEPLOY_QT NAMES windeployqt6)
add_custom_target(Script-DeployRelease
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/dist
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_SOURCE_DIR}/dist
COMMAND ${QT_DEPLOY_QT} ${CMAKE_SOURCE_DIR}/dist/${PROJECT_NAME}.exe --no-translations --compiler-runtime --release -qmldir=${CMAKE_CURRENT_LIST_DIR}/qml
COMMENT "Windows Deploying Qt Dependencies After Build........."
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endif()
if (APPLE)
find_program(QT_DEPLOY_QT NAMES macdeployqt6)
add_custom_target(Script-DeployDebug
COMMAND ${QT_DEPLOY_QT} ${CMAKE_SOURCE_DIR}/bin/Debug/${PROJECT_NAME}.app -verbose=1 -qmldir=${CMAKE_CURRENT_LIST_DIR} -dmg
COMMENT "MacOS Deploying Qt Dependencies After Build........."
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endif()
if (WIN32)
find_program(QT_DEPLOY_QT NAMES windeployqt6)
add_custom_target(Script-DeployDebug
COMMAND ${QT_DEPLOY_QT} ${CMAKE_SOURCE_DIR}/bin/Debug/${PROJECT_NAME}.exe --no-translations --compiler-runtime -qmldir=${CMAKE_CURRENT_LIST_DIR}/qml
COMMENT "Windows Deploying Qt Dependencies After Build........."
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endif()
add_custom_target(CLEANALL
COMMAND cmake --build ./ --config ${CMAKE_BUILD_TYPE} --target clean --
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/bin
)
configure_file(
${CMAKE_SOURCE_DIR}/setupscript.iss.in
${CMAKE_SOURCE_DIR}/installer/setupscript.iss
)