-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
OffloadBuddy.pro
292 lines (233 loc) · 9.18 KB
/
OffloadBuddy.pro
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
TARGET = OffloadBuddy
VERSION = 0.12
DEFINES+= APP_NAME=\\\"$$TARGET\\\"
DEFINES+= APP_VERSION=\\\"$$VERSION\\\"
CONFIG += c++17
QT += core qml quickcontrols2 svg
QT += multimedia charts
QT += location
# Validate Qt version
!versionAtLeast(QT_VERSION, 6.5) : error("You need at least Qt version 6.5 for $${TARGET}")
# Project features #############################################################
unix { DEFINES += ENABLE_LIBMTP }
#DEFINES += ENABLE_GSTREAMER
DEFINES += ENABLE_FFMPEG
#DEFINES += ENABLE_LIBCPUID
DEFINES += ENABLE_MINIVIDEO
DEFINES += ENABLE_LIBEXIF
#DEFINES += ENABLE_EXIV2
DEFINES += ENABLE_QTLOCATION
# Use contribs (otherwise use system libs)
win32 | ios | android { DEFINES += USE_CONTRIBS }
# Project modules ##############################################################
# App utils
CONFIG += UTILS_DOCK_ENABLED
include(src/thirdparty/AppUtils/AppUtils.pri)
# SingleApplication for desktop OS
DEFINES += QAPPLICATION_CLASS=QApplication
include(src/thirdparty/SingleApplication/SingleApplication.pri)
# Zip extraction
include(src/thirdparty/miniz/miniz.pri)
# EGM96 altitude correction
include(src/thirdparty/EGM96/EGM96.pri)
# Fast thumbnailer for photo and video
include(src/thirdparty/MediaThumbnailer/MediaThumbnailer.pri)
# Project files ################################################################
SOURCES += src/main.cpp \
src/SettingsManager.cpp \
src/FirmwareManager.cpp \
src/JobManager.cpp \
src/JobWorkerFFmpeg.cpp \
src/JobWorkerThread.cpp \
src/JobWorkerASync.cpp \
src/StorageManager.cpp \
src/MediaDirectory.cpp \
src/MediaLibrary.cpp \
src/DeviceScanner.cpp \
src/DeviceManager.cpp \
src/Device.cpp \
src/DeviceStorage.cpp \
src/DeviceCapabilities.cpp \
src/FileScanner.cpp \
src/ItemImage.cpp \
src/Job.cpp \
src/Shot.cpp \
src/ShotTelemetry.cpp \
src/ShotModel.cpp \
src/ShotFilter.cpp \
src/ShotProvider.cpp \
src/GenericFileModel.cpp \
src/GoProFileModel.cpp \
src/Insta360FileModel.cpp \
src/GpmfBuffer.cpp \
src/GpmfKLV.cpp \
src/GpmfTags.cpp \
src/GeoCoding.cpp
HEADERS += src/SettingsManager.h \
src/FirmwareManager.h \
src/JobManager.h \
src/Job.h \
src/JobUtils.h \
src/JobWorkerFFmpeg.h \
src/JobWorkerThread.h \
src/JobWorkerASync.h \
src/StorageManager.h \
src/StorageUtils.h \
src/MediaDirectory.h \
src/MediaLibrary.h \
src/MediaUtils.h \
src/DeviceScanner.h \
src/DeviceManager.h \
src/Device.h \
src/DeviceStorage.h \
src/DeviceCapabilities.h \
src/DeviceUtils.h \
src/FileScanner.h \
src/ItemImage.h \
src/Shot.h \
src/ShotUtils.h \
src/ShotModel.h \
src/ShotFilter.h \
src/ShotProvider.h \
src/GenericFileModel.h \
src/GoProFileModel.h \
src/Insta360FileModel.h \
src/GpmfBuffer.h \
src/GpmfKLV.h \
src/GpmfTags.h \
src/GeoCoding.h
RESOURCES += assets/cameras.qrc assets/gfx.qrc assets/icons.qrc
RESOURCES += qml/ComponentLibrary/ComponentLibrary.qrc
RESOURCES += qml/qml.qrc i18n/i18n.qrc \
OTHER_FILES += .gitignore \
.github/workflows/builds_desktop.yml \
.github/workflows/flatpak.yml \
contribs/contribs_builder.py \
deploy_linux.sh \
deploy_macos.sh \
deploy_windows.sh \
README.md
#TRANSLATIONS = i18n/offloadbuddy_en.ts
lupdate_only { SOURCES += qml/*.qml qml/*.js qml/components/*.qml }
# Dependencies #################################################################
contains(DEFINES, USE_CONTRIBS) {
ARCH = "x86_64"
linux { PLATFORM = "linux" }
win32 { PLATFORM = "windows" }
macx {
PLATFORM = "macOS"
ARCH = "x86_64"
QMAKE_APPLE_DEVICE_ARCHS = x86_64
#ARCH = "unified"
#QMAKE_APPLE_DEVICE_ARCHS = x86_64 arm64
}
CONTRIBS_DIR = $${PWD}/contribs/env/$${PLATFORM}_$${ARCH}/usr
INCLUDEPATH += $${CONTRIBS_DIR}/include/
QMAKE_LIBDIR += $${CONTRIBS_DIR}/lib/
QMAKE_RPATHDIR += $${CONTRIBS_DIR}/lib/
LIBS += -L$${CONTRIBS_DIR}/lib/
contains(DEFINES, ENABLE_LIBCPUID) { LIBS += -lcpuid }
contains(DEFINES, ENABLE_LIBMTP) { LIBS += -lusb-1.0 -lmtp }
contains(DEFINES, ENABLE_LIBEXIF) { LIBS += -lexif }
contains(DEFINES, ENABLE_EXIV2) { LIBS += -lexiv2 }
contains(DEFINES, ENABLE_MINIVIDEO) { LIBS += -lminivideo }
linux {
CONFIG += link_pkgconfig
contains(DEFINES, ENABLE_FFMPEG) { PKGCONFIG += libavformat libavcodec libswscale libswresample libavutil }
INCLUDEPATH += /usr/include/
} else {
contains(DEFINES, ENABLE_FFMPEG) { LIBS += -lavformat -lavcodec -lswscale -lswresample -lavutil }
}
} else {
!unix { warning("Building $${TARGET} without contribs on windows is untested...") }
CONFIG += link_pkgconfig
macx { PKG_CONFIG = /usr/local/bin/pkg-config } # use pkg-config from brew
macx { INCLUDEPATH += /usr/local/include/ }
contains(DEFINES, ENABLE_LIBCPUID) { PKGCONFIG += libcpuid }
contains(DEFINES, ENABLE_LIBMTP) { PKGCONFIG += libusb-1.0 libmtp }
contains(DEFINES, ENABLE_LIBEXIF) { PKGCONFIG += libexif }
contains(DEFINES, ENABLE_EXIV2) { PKGCONFIG += exiv2 }
contains(DEFINES, ENABLE_MINIVIDEO) { PKGCONFIG += libminivideo }
contains(DEFINES, ENABLE_FFMPEG) { PKGCONFIG += libavformat libavcodec libswscale libswresample libavutil }
}
# Build settings ###############################################################
unix {
# Enables AddressSanitizer
#QMAKE_CXXFLAGS += -fsanitize=address,undefined
#QMAKE_LFLAGS += -fsanitize=address,undefined
#QMAKE_CXXFLAGS += -Wno-nullability-completeness -fno-omit-frame-pointer
}
win32 { DEFINES += _USE_MATH_DEFINES }
DEFINES += QT_DEPRECATED_WARNINGS
CONFIG(release, debug|release) : DEFINES += NDEBUG QT_NO_DEBUG QT_NO_DEBUG_OUTPUT
# Build artifacts ##############################################################
OBJECTS_DIR = build/
MOC_DIR = build/
RCC_DIR = build/
UI_DIR = build/
DESTDIR = bin/
################################################################################
# Application deployment and installation steps
linux:!android {
TARGET = $$lower($${TARGET})
# Application packaging # Needs linuxdeployqt installed
#deploy.commands = $${OUT_PWD}/$${DESTDIR}/ -qmldir=qml/
#install.depends = deploy
#QMAKE_EXTRA_TARGETS += install deploy
# Installation
isEmpty(PREFIX) { PREFIX = /usr/local }
target_app.files += $${OUT_PWD}/$${DESTDIR}/$$lower($${TARGET})
target_app.path = $${PREFIX}/bin/
target_icon.files += $${OUT_PWD}/assets/linux/$$lower($${TARGET}).svg
target_icon.path = $${PREFIX}/share/pixmaps/
target_appentry.files += $${OUT_PWD}/assets/linux/$$lower($${TARGET}).desktop
target_appentry.path = $${PREFIX}/share/applications
target_appdata.files += $${OUT_PWD}/assets/linux/$$lower($${TARGET}).appdata.xml
target_appdata.path = $${PREFIX}/share/appdata
INSTALLS += target_app target_icon target_appentry target_appdata
# Clean appdir/ and bin/ directories
#QMAKE_CLEAN += $${OUT_PWD}/$${DESTDIR}/$$lower($${TARGET})
#QMAKE_CLEAN += $${OUT_PWD}/appdir/
}
macx {
# Bundle name
QMAKE_TARGET_BUNDLE_PREFIX = com.emeric
QMAKE_BUNDLE = offloadbuddy
CONFIG += app_bundle
# OS icon
ICON = $${PWD}/assets/macos/$$lower($${TARGET}).icns
#QMAKE_ASSET_CATALOGS = $${PWD}/assets/macos/Images.xcassets
#QMAKE_ASSET_CATALOGS_APP_ICON = "AppIcon"
# OS infos
#QMAKE_INFO_PLIST = $${PWD}/assets/macos/Info.plist
# OS entitlement (sandbox and stuff)
ENTITLEMENTS.name = CODE_SIGN_ENTITLEMENTS
ENTITLEMENTS.value = $${PWD}/assets/macos/$$lower($${TARGET}).entitlements
QMAKE_MAC_XCODE_SETTINGS += ENTITLEMENTS
# Target OS
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.15
#======== Automatic bundle packaging
# Deploy step (app bundle packaging)
deploy.commands = macdeployqt $${OUT_PWD}/$${DESTDIR}/$${TARGET}.app -qmldir=qml/ -appstore-compliant
install.depends = deploy
QMAKE_EXTRA_TARGETS += install deploy
# Installation step (note: app bundle packaging)
isEmpty(PREFIX) { PREFIX = /usr/local }
target.files += $${OUT_PWD}/${DESTDIR}/${TARGET}.app
target.path = $$(HOME)/Applications
INSTALLS += target
# Clean step
QMAKE_DISTCLEAN += -r $${OUT_PWD}/${DESTDIR}/${TARGET}.app
}
win32 {
# OS icon
RC_ICONS = $${PWD}/assets/windows/$$lower($${TARGET}).ico
# Deploy step
deploy.commands = $$quote(windeployqt $${OUT_PWD}/$${DESTDIR}/ --qmldir qml/)
install.depends = deploy
QMAKE_EXTRA_TARGETS += install deploy
# Installation step
# TODO?
# Clean step
# TODO
}