-
Notifications
You must be signed in to change notification settings - Fork 6
/
Theengs.pro
320 lines (261 loc) · 11.2 KB
/
Theengs.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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
TARGET = Theengs
VERSION = 1.4.1
DEFINES+= APP_NAME=\\\"$$TARGET\\\"
DEFINES+= APP_VERSION=\\\"$$VERSION\\\"
CONFIG += c++17
QT += core bluetooth sql
QT += qml quick quickcontrols2 svg widgets charts
QT += mqtt
# Validate Qt version
!versionAtLeast(QT_VERSION, 6.6) : error("You need at least Qt version 6.6 for $${TARGET}")
# Project features #############################################################
# Use Qt Quick compiler
ios | android { CONFIG += qtquickcompiler }
win32 { DEFINES += _USE_MATH_DEFINES }
# Force patched Qt Connectivity for Android Bluetooth background daemon
android { DEFINES += QT_CONNECTIVITY_PATCHED }
# MobileUI and MobileSharing for mobile OS
include(src/thirdparty/MobileUI/MobileUI.pri)
include(src/thirdparty/MobileSharing/MobileSharing.pri)
# SingleApplication for desktop OS
include(src/thirdparty/SingleApplication/SingleApplication.pri)
DEFINES += QAPPLICATION_CLASS=QApplication
# Various utils
CONFIG += UTILS_DOCK_ENABLED
CONFIG += UTILS_NOTIFICATIONS_ENABLED
include(src/thirdparty/AppUtils/AppUtils.pri)
# Theengs submodule
ios | macx { DEFINES += NO_MAC_ADDR }
SOURCES += $${PWD}/src/thirdparty/TheengsDecoder/src/decoder.cpp
INCLUDEPATH += $${PWD}/src/thirdparty/TheengsDecoder/src/
INCLUDEPATH += $${PWD}/src/thirdparty/TheengsDecoder/src/arduino_json/src/
# Uncomment to enable virtual devices # AND REBUILD
#DEFINES += DEBUG_FAKE_DEVICES
# Project files ################################################################
SOURCES += src/main.cpp \
src/SettingsManager.cpp \
src/DatabaseManager.cpp \
src/MenubarManager.cpp \
src/SystrayManager.cpp \
src/NotificationManager.cpp \
src/AndroidService.cpp \
src/MqttManager.cpp \
src/DeviceManager.cpp \
src/DeviceManager_advertisement.cpp \
src/DeviceManager_nearby.cpp \
src/DeviceManager_theengs.cpp \
src/DeviceFilter.cpp \
src/device.cpp \
src/device_infos.cpp \
src/device_sensor.cpp \
src/device_plantsensor.cpp \
src/device_thermometer.cpp \
src/device_environmental.cpp \
src/devices/device_flowercare.cpp \
src/devices/device_flowercare_tuya.cpp \
src/devices/device_ropot.cpp \
src/devices/device_hygrotemp_cgd1.cpp \
src/devices/device_hygrotemp_cgdk2.cpp \
src/devices/device_hygrotemp_cgg1.cpp \
src/devices/device_hygrotemp_cgp1w.cpp \
src/devices/device_hygrotemp_clock.cpp \
src/devices/device_hygrotemp_square.cpp \
src/devices/device_hygrotemp_lywsdcgq.cpp \
src/devices/device_thermobeacon.cpp \
src/devices/device_jqjcy01ym.cpp \
src/device_theengs.cpp \
src/devices/device_theengs_generic.cpp \
src/devices/device_theengs_beacons.cpp \
src/devices/device_theengs_motionsensors.cpp \
src/devices/device_theengs_probes.cpp \
src/devices/device_theengs_scales.cpp \
src/devices/device_theengs_thermometers.cpp \
src/TempPresetManager.cpp \
src/TempPreset.cpp \
src/thirdparty/RC4/rc4.cpp
HEADERS += src/SettingsManager.h \
src/DatabaseManager.h \
src/MenubarManager.h \
src/SystrayManager.h \
src/NotificationManager.h \
src/AndroidService.h \
src/MqttManager.h \
src/DeviceManager.h \
src/DeviceFilter.h \
src/device.h \
src/device_firmwares.h \
src/device_utils.h \
src/device_utils_theengs.h \
src/device_infos.h \
src/device_sensor.h \
src/device_plantsensor.h \
src/device_thermometer.h \
src/device_environmental.h \
src/devices/device_flowercare.h \
src/devices/device_flowercare_tuya.h \
src/devices/device_ropot.h \
src/devices/device_hygrotemp_cgd1.h \
src/devices/device_hygrotemp_cgdk2.h \
src/devices/device_hygrotemp_cgg1.h \
src/devices/device_hygrotemp_cgp1w.h \
src/devices/device_hygrotemp_clock.h \
src/devices/device_hygrotemp_square.h \
src/devices/device_hygrotemp_lywsdcgq.h \
src/devices/device_thermobeacon.h \
src/devices/device_jqjcy01ym.h \
src/device_theengs.h \
src/devices/device_theengs_generic.h \
src/devices/device_theengs_beacons.h \
src/devices/device_theengs_motionsensors.h \
src/devices/device_theengs_probes.h \
src/devices/device_theengs_scales.h \
src/devices/device_theengs_thermometers.h \
src/TempPresetManager.h \
src/TempPreset.h \
src/thirdparty/RC4/rc4.h
INCLUDEPATH += src/ src/thirdparty/
RESOURCES += qml/qml.qrc \
qml/components.qrc \
assets/assets.qrc \
assets/devices.qrc
OTHER_FILES += README.md \
deploy_linux.sh \
deploy_macos.sh \
deploy_windows.sh \
contribs/contribs_builder.py \
.github/workflows/builds_desktop.yml \
.github/workflows/builds_mobile.yml \
.github/workflows/flatpak.yml \
.gitignore
lupdate_only {
SOURCES += qml/*.qml qml/*.js \
qml/components/*.qml qml/components_generic/*.qml qml/components_js/*.js
}
# Dependencies #################################################################
ARCH = "x86_64"
linux { PLATFORM = "linux" }
macx { PLATFORM = "macOS" }
win32 { PLATFORM = "windows" }
android { # ANDROID_TARGET_ARCH available: x86 x86_64 armeabi-v7a arm64-v8a
PLATFORM = "android"
equals(ANDROID_TARGET_ARCH, "x86") { ARCH = "x86" }
equals(ANDROID_TARGET_ARCH, "x86_64") { ARCH = "x86_64" }
equals(ANDROID_TARGET_ARCH, "armeabi-v7a") { ARCH = "armv7" }
equals(ANDROID_TARGET_ARCH, "arm64-v8a") { ARCH = "armv8" }
}
ios { # QMAKE_APPLE_DEVICE_ARCHS available: armv7 arm64
PLATFORM = "iOS"
ARCH = "armv8" # can be simulator, armv7 and armv8
QMAKE_APPLE_DEVICE_ARCHS = "arm64" # force 'arm64'
}
CONTRIBS_DIR = $${PWD}/contribs/env/$${PLATFORM}_$${ARCH}/usr
INCLUDEPATH += $${CONTRIBS_DIR}/include/
QMAKE_LIBDIR += $${CONTRIBS_DIR}/lib/
QMAKE_RPATHDIR += $${CONTRIBS_DIR}/lib/
# Build settings ###############################################################
DEFINES += QT_DEPRECATED_WARNINGS
CONFIG(release, debug|release) : DEFINES += NDEBUG QT_NO_DEBUG QT_NO_DEBUG_OUTPUT
# Build artifacts ##############################################################
OBJECTS_DIR = build/$${QT_ARCH}/
MOC_DIR = build/$${QT_ARCH}/
RCC_DIR = build/$${QT_ARCH}/
UI_DIR = build/$${QT_ARCH}/
DESTDIR = bin/
################################################################################
# Application deployment and installation steps
linux:!android {
TARGET = $$lower($${TARGET})
# Automatic application packaging # Needs linuxdeployqt installed
#system(linuxdeployqt $${OUT_PWD}/$${DESTDIR}/ -qmldir=qml/)
# Application packaging # Needs linuxdeployqt installed
#deploy.commands = $${OUT_PWD}/$${DESTDIR}/ -qmldir=qml/
#install.depends = deploy
#QMAKE_EXTRA_TARGETS += install deploy
# Installation steps
isEmpty(PREFIX) { PREFIX = /usr/local }
target_app.files += $${OUT_PWD}/$${DESTDIR}/$$lower($${TARGET})
target_app.path = $${PREFIX}/bin/
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
target_icon_appimage.files += $${OUT_PWD}/assets/linux/$$lower($${TARGET}).svg
target_icon_appimage.path = $${PREFIX}/share/pixmaps/
target_icon_flatpak.files += $${OUT_PWD}/assets/linux/$$lower($${TARGET}).svg
target_icon_flatpak.path = $${PREFIX}/share/icons/hicolor/scalable/apps/
INSTALLS += target_app target_appentry target_appdata target_icon_appimage target_icon_flatpak
# Clean appdir/ and bin/ directories
#QMAKE_CLEAN += $${OUT_PWD}/$${DESTDIR}/$$lower($${TARGET})
#QMAKE_CLEAN += $${OUT_PWD}/appdir/
}
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
}
macx {
# Bundle name
QMAKE_TARGET_BUNDLE_PREFIX = com.theengs
QMAKE_BUNDLE = app
# OS
ICON = $${PWD}/assets/macos/theengs.icns
# 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 architecture(s)
QMAKE_APPLE_DEVICE_ARCHS = x86_64 arm64
# Target OS
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.15
}
android {
# ANDROID_TARGET_ARCH: [x86_64, armeabi-v7a, arm64-v8a]
#message("ANDROID_TARGET_ARCH: $$ANDROID_TARGET_ARCH")
# Bundle name
QMAKE_TARGET_BUNDLE_PREFIX = com.theengs
QMAKE_BUNDLE = app
ANDROID_PACKAGE_SOURCE_DIR = $${PWD}/assets/android
OTHER_FILES += $${PWD}/assets/android/src/com/theengs/app/TheengsBootServiceBroadcastReceiver.java \
$${PWD}/assets/android/src/com/theengs/app/TheengsAndroidService.java \
$${PWD}/assets/android/src/com/theengs/app/TheengsAndroidNotifier.java \
$${PWD}/assets/android/src/com/theengs/utils/QGpsUtils.java \
$${PWD}/assets/android/src/com/theengs/utils/QShareUtils.java \
$${PWD}/assets/android/src/com/theengs/utils/QSharePathResolver.java
DISTFILES += $${PWD}/assets/android/AndroidManifest.xml \
$${PWD}/assets/android/gradle.properties \
$${PWD}/assets/android/build.gradle
include($${PWD}/contribs/env/android_openssl-master/openssl.pri)
}
ios {
#QMAKE_IOS_DEPLOYMENT_TARGET = 11.0
#message("QMAKE_IOS_DEPLOYMENT_TARGET: $$QMAKE_IOS_DEPLOYMENT_TARGET")
CONFIG += no_autoqmake
# Bundle name
QMAKE_TARGET_BUNDLE_PREFIX = com.theengs
QMAKE_BUNDLE = app
# OS infos
QMAKE_INFO_PLIST = $${PWD}/assets/ios/Info.plist
QMAKE_APPLE_TARGETED_DEVICE_FAMILY = 1,2 # 1: iPhone / 2: iPad / 1,2: Universal
# OS icons
QMAKE_ASSET_CATALOGS_APP_ICON = "AppIcon"
QMAKE_ASSET_CATALOGS = $${PWD}/assets/ios/Images.xcassets
# iOS launch screen
AppLaunchScreen.files += $${PWD}/assets/ios/AppLaunchScreen.storyboard
QMAKE_BUNDLE_DATA += AppLaunchScreen
# iOS developer settings
exists($${PWD}/assets/ios/ios_signature.pri) {
# Must contain values for:
# QMAKE_DEVELOPMENT_TEAM
# QMAKE_PROVISIONING_PROFILE
include($${PWD}/assets/ios/ios_signature.pri)
}
}