forked from YIO-Remote/remote-software
-
Notifications
You must be signed in to change notification settings - Fork 0
/
remote.pro
543 lines (490 loc) Β· 19.6 KB
/
remote.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
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
###############################################################################
#
# Copyright (C) 2019-2020 Markus Zehnder <[email protected]>
# Copyright (C) 2018-2019 Marton Borzak <[email protected]>
#
# This file is part of the YIO-Remote software project.
#
# YIO-Remote software is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# YIO-Remote software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with YIO-Remote software. If not, see <https://www.gnu.org/licenses/>.
#
# SPDX-License-Identifier: GPL-3.0-or-later
#############################################################################/
QT += qml quick websockets quickcontrols2 bluetooth
CONFIG += c++17 disable-desktop
#disable qtquickcompiler for QML debugging!
CONFIG += qtquickcompiler
DEFINES += QT_DEPRECATED_WARNINGS
DEFINES += QT_MESSAGELOGCONTEXT
# === Version and build information ===========================================
# If built in Buildroot use custom package version, otherwise Git
isEmpty(YIO_BUILD_VERSION) {
GIT_VERSION = "$$system(git describe --match "v[0-9]*" --tags HEAD --always)"
GIT_HASH = "$$system(git log -1 --format="%H")"
GIT_BRANCH = "$$system(git rev-parse --abbrev-ref HEAD)"
} else {
GIT_VERSION = $$YIO_BUILD_VERSION
contains(GIT_VERSION, "^v?(0|[1-9]\d*)\..*") {
# (simplified) version string = regular release
GIT_HASH = ""
GIT_BRANCH = "master"
} else {
# git hash as version = custom build
GIT_HASH = $$YIO_BUILD_VERSION
GIT_BRANCH = ""
}
}
REMOTE_VERSION = $$replace(GIT_VERSION, v, "")
DEFINES += APP_VERSION=\\\"$$REMOTE_VERSION\\\"
# build timestamp
win32 {
# not the same format as on Unix systems, but good enough...
BUILDDATE=$$system(date /t)
} else {
BUILDDATE=$$system(date +"%Y-%m-%dT%H:%M:%S")
}
# =============================================================================
CONFIG(debug, debug|release) {
DEBUG_BUILD = true
} else {
DEBUG_BUILD = false
}
QMAKE_SUBSTITUTES += version.txt.in
# === Load integration interface library ======================================
# Workaround for 'lupdate remote.pro' bug when using variables for including a .pri file:
# "Project ERROR: COPIES entry extraData defines no .path"
# This only happens if the variable is assigned more then once, even in an else block!
# WHY is lupdate integration such a major pain?
INTG_LIB_PATH = $$(YIO_SRC)
isEmpty(INTG_LIB_PATH) {
INTG_LIB_PATH = $$clean_path($$PWD/../integrations.library)
message("Environment variables YIO_SRC not defined! Using '$$INTG_LIB_PATH' for integrations.library project.")
# === Integration interface library: all plugin headers and shared data models
! include($$clean_path($$PWD/../integrations.library/yio-interfaces.pri)) {
error( "Couldn't find the yio-interfaces.pri file!" )
}
! include($$clean_path($$PWD/../integrations.library/yio-model-mediaplayer.pri)) {
error( "Couldn't find the yio-model-mediaplayer.pri file!" )
}
! include($$clean_path($$PWD/../integrations.library/yio-model-weather.pri)) {
error( "Couldn't find the yio-model-weather.pri file!" )
}
# === QMake helper functions for output path based on platform & compiler
! include($$clean_path($$PWD/../integrations.library/qmake-destination-path.pri)) {
error( "Couldn't find the qmake-destination-path.pri file!" )
}
} else {
INTG_LIB_PATH = $$(YIO_SRC)/integrations.library
message("YIO_SRC is set: using '$$INTG_LIB_PATH' for integrations.library project.")
! include($$(YIO_SRC)/integrations.library/yio-interfaces.pri) {
error( "Couldn't find the yio-interfaces.pri file!" )
}
! include($$(YIO_SRC)/integrations.library/yio-model-mediaplayer.pri) {
error( "Couldn't find the yio-model-mediaplayer.pri file!" )
}
! include($$(YIO_SRC)/integrations.library/yio-model-weather.pri) {
error( "Couldn't find the yio-model-weather.pri file!" )
}
! include($$(YIO_SRC)/integrations.library/qmake-destination-path.pri) {
error( "Couldn't find the qmake-destination-path.pri file!" )
}
}
# verify integrations.library version
unix {
INTG_GIT_VERSION = "$$system(cd $$INTG_LIB_PATH && git describe --match "v[0-9]*" --tags HEAD --always)"
} else {
# sorry, no priority...
INTG_GIT_VERSION = "?"
}
DEFINES += INTG_LIB_VERSION=\\\"$$INTG_GIT_VERSION\\\"
# =============================================================================
HEADERS += \
components/media_player/sources/utils_mediaplayer.h \
sources/bluetooth.h \
sources/commandlinehandler.h \
sources/config.h \
sources/configutil.h \
sources/entities/climate.h \
sources/entities/entities_supported.h \
sources/entities/remote.h \
sources/entities/switch.h \
sources/entities/weather.h \
sources/environment.h \
sources/factoryreset.h \
sources/filedownload.h \
sources/fileio.h \
sources/hardware/batterycharger.h \
sources/hardware/batteryfuelgauge.h \
sources/hardware/buttonhandler.h \
sources/hardware/hardwarefactory_default.h \
sources/hardware/mock/batterycharger_mock.h \
sources/hardware/mock/batteryfuelgauge_mock.h \
sources/hardware/displaycontrol.h \
sources/hardware/mock/displaycontrol_mock.h \
sources/hardware/gesturesensor.h \
sources/hardware/mock/gesturesensor_mock.h \
sources/hardware/hapticmotor.h \
sources/hardware/mock/hapticmotor_mock.h \
sources/hardware/mock/interrupthandler_mock.h \
sources/hardware/lightsensor.h \
sources/hardware/mock/lightsensor_mock.h \
sources/hardware/mock/sysinfo_mock.h \
sources/hardware/proximitysensor.h \
sources/hardware/mock/proximitysensor_mock.h \
sources/hardware/sysinfo.h \
sources/integrations/integrations.h \
sources/integrations/integrationsinterface.h \
sources/jsonfile.h \
sources/launcher.h \
sources/logger.h \
sources/logging.h \
sources/softwareupdate.h \
sources/standbycontrol.h \
sources/translation.h \
sources/hardware/device.h \
sources/hardware/touchdetect.h \
sources/hardware/hardwarefactory.h \
sources/hardware/hw_config.h \
sources/hardware/interrupthandler.h \
sources/hardware/systemservice.h \
sources/hardware/mock/systemservice_mock.h \
sources/hardware/systemservice_name.h \
sources/hardware/webserver_control.h \
sources/hardware/mock/webserver_mock.h \
sources/hardware/wifi_control.h \
sources/hardware/mock/wifi_mock.h \
sources/hardware/wifi_network.h \
sources/hardware/wifi_security.h \
sources/hardware/wifi_signal.h \
sources/hardware/wifi_status.h \
sources/entities/entities.h \
sources/entities/entity.h \
sources/entities/light.h \
sources/entities/blind.h \
sources/notifications.h \
sources/entities/mediaplayer.h \
sources/utils.h \
sources/yioapi.h
SOURCES += \
components/media_player/sources/utils_mediaplayer.cpp \
sources/bluetooth.cpp \
sources/commandlinehandler.cpp \
sources/config.cpp \
sources/configutil.cpp \
sources/entities/climate.cpp \
sources/entities/remote.cpp \
sources/entities/switch.cpp \
sources/entities/weather.cpp \
sources/environment.cpp \
sources/factoryreset.cpp \
sources/filedownload.cpp \
sources/hardware/buttonhandler.cpp \
sources/hardware/device.cpp \
sources/hardware/hardwarefactory_default.cpp \
sources/hardware/touchdetect.cpp \
sources/integrations/integrations.cpp \
sources/logger.cpp \
sources/logging.cpp \
sources/main.cpp \
sources/jsonfile.cpp \
sources/launcher.cpp \
sources/hardware/hardwarefactory.cpp \
sources/hardware/systemservice.cpp \
sources/hardware/mock/systemservice_mock.cpp \
sources/hardware/webserver_control.cpp \
sources/hardware/mock/webserver_mock.cpp \
sources/hardware/wifi_control.cpp \
sources/hardware/mock/wifi_mock.cpp \
sources/entities/entities.cpp \
sources/entities/entity.cpp \
sources/entities/light.cpp \
sources/entities/blind.cpp \
sources/notifications.cpp \
sources/entities/mediaplayer.cpp \
sources/softwareupdate.cpp \
sources/standbycontrol.cpp \
sources/translation.cpp \
sources/utils.cpp \
sources/yioapi.cpp
RESOURCES += qml.qrc \
images.qrc \
keyboard.qrc \
translations.qrc
# === platform specific devices =======================================
linux {
USE_WPA_SUPPLICANT = y
# TODO simplify defines
equals(USE_WPA_SUPPLICANT, y): {
DEFINES += CONFIG_WPA_SUPPLICANT \
CONFIG_CTRL_IFACE=1 \
CONFIG_CTRL_IFACE_UNIX=1
INCLUDEPATH += wpa_supplicant/src wpa_supplicant/src/utils
HEADERS += \
sources/hardware/linux/wifi_wpasupplicant.h
SOURCES += \
sources/hardware/linux/wifi_wpasupplicant.cpp \
wpa_supplicant/src/common/wpa_ctrl.c \
wpa_supplicant/src/utils/os_unix.c
}
HEADERS += \
sources/hardware/linux/hw_factory_linux.h \
sources/hardware/linux/sysinfo_linux.h \
sources/hardware/linux/systemd.h \
sources/hardware/linux/webserver_lighttpd.h \
sources/hardware/linux/wifi_shellscripts.h
SOURCES += \
sources/hardware/linux/hw_factory_linux.cpp \
sources/hardware/linux/sysinfo_linux.cpp \
sources/hardware/linux/systemd.cpp \
sources/hardware/linux/webserver_lighttpd.cpp \
sources/hardware/linux/wifi_shellscripts.cpp
equals(QT_ARCH, arm): {
HEADERS += \
sources/hardware/linux/arm/hw_factory_yio.h \
sources/hardware/linux/arm/apds9960.h \
sources/hardware/linux/arm/apds9960gesture.h \
sources/hardware/linux/arm/apds9960light.h \
sources/hardware/linux/arm/apds9960proximity.h \
sources/hardware/linux/arm/batterycharger_yio.h \
sources/hardware/linux/arm/bq27441.h \
sources/hardware/linux/arm/displaycontrol_yio.h \
sources/hardware/linux/arm/drv2605.h \
sources/hardware/linux/arm/mcp23017_interrupt.h \
sources/hardware/linux/arm/mcp23017_handler.h
SOURCES += \
sources/hardware/linux/arm/hw_factory_yio.cpp \
sources/hardware/linux/arm/apds9960.cpp \
sources/hardware/linux/arm/apds9960light.cpp \
sources/hardware/linux/arm/apds9960proximity.cpp \
sources/hardware/linux/arm/batterycharger_yio.cpp \
sources/hardware/linux/arm/bq27441.cpp \
sources/hardware/linux/arm/displaycontrol_yio.cpp \
sources/hardware/linux/arm/drv2605.cpp \
sources/hardware/linux/arm/mcp23017_interrupt.cpp
}
# needed for std::filesystem
LIBS += -lstdc++fs
}
# Android specific files (empty template for now)
android {
HEADERS += \
sources/hardware/android/hw_factory_android.h
SOURCES += \
sources/hardware/android/hw_factory_android.cpp
}
# macOS specific files
macx {
HEADERS += \
sources/hardware/macos/hw_factory_mac.h \
sources/hardware/macos/smc.h \
sources/hardware/macos/sysinfo_mac.h
SOURCES += \
sources/hardware/macos/hw_factory_mac.cpp \
sources/hardware/macos/smc.c \
sources/hardware/macos/sysinfo_mac.cpp
}
# Windows specific files
win32 {
DEFINES += "WINVER=0x0600"
DEFINES += "_WIN32_WINNT=0x0600"
HEADERS += \
sources/hardware/windows/hw_factory_win.h \
sources/hardware/windows/sysinfo_win.h
SOURCES += \
sources/hardware/windows/hw_factory_win.cpp \
sources/hardware/windows/sysinfo_win.cpp
}
# === start TRANSLATION section =======================================
lupdate_only{
SOURCES += $$OTHER_FILES
OTHER_FILES += main.qml \
MainContainer.qml \
basic_ui/*.qml \
basic_ui/pages/*.qml \
basic_ui/settings/*.qml \
setup/*.qml \
components/light/ui/*.qml \
components/blind/ui/*.qml \
components/media_player/ui/*.qml \
components/weather/ui/*.qml \
components/remote/ui/*.qml \
components/media_player/ui/*.qml \
components/climate/ui/*.qml
}
TRANSLATIONS = translations/bg_BG.ts \
translations/ca_ES.ts \
translations/cs_CZ.ts \
translations/da_DK.ts \
translations/de_DE.ts \
translations/de_CH.ts \
translations/el_GR.ts \
translations/en_US.ts \
translations/es_ES.ts \
translations/et_EE.ts \
translations/fi_FI.ts \
translations/fr_FR.ts \
translations/ga_IE.ts \
translations/hr_HR.ts \
translations/hu_HU.ts \
translations/is_IS.ts \
translations/it_IT.ts \
translations/lt_LT.ts \
translations/lv_LV.ts \
translations/mt_MT.ts \
translations/nl_NL.ts \
translations/no_NO.ts \
translations/pl_PL.ts \
translations/pt_BR.ts \
translations/pt_PT.ts \
translations/ro_RO.ts \
translations/ru_BY.ts \
translations/ru_MD.ts \
translations/ru_RU.ts \
translations/ru_UA.ts \
translations/sk_SK.ts \
translations/sl_SI.ts \
translations/sv_SE.ts \
translations/zh_CN.ts \
translations/zh_TW.ts
#QMAKE_LUPDATE & _LRELEASE vars are set in qmake-destiation-path.pri
!isEmpty(QMAKE_LUPDATE):exists("$$QMAKE_LUPDATE") {
message("Using Qt linguist tools: '$$QMAKE_LUPDATE', '$$QMAKE_LRELEASE'")
command = $$QMAKE_LUPDATE remote.pro
system($$command) | error("Failed to run: $$command")
command = $$QMAKE_LRELEASE remote.pro
system($$command) | error("Failed to run: $$command")
} else {
warning("Qt linguist cmd line tools lupdate / lrelease not found: translations will NOT be compiled and build will most likely fail due to missing .qm files!")
}
# === end TRANSLATION section =========================================
# include zeroconf
include(qtzeroconf/qtzeroconf.pri)
DEFINES += QZEROCONF_STATIC
# Wiringpi config, only on raspberry pi
equals(QT_ARCH, arm): {
message(Cross compiling for arm system: including Wiringpi config on RPi)
# FIXME hard coded directory path!
INCLUDEPATH += /home/yio/projects/yio/remote-os/rpi0/output/host/linux/arm-buildroot-linux-gnueabihf/sysroot/usr/include
LIBS += -L"/home/yio/projects/yio/remote-os/rpi0/output/target/usr/lib"
LIBS += -lwiringPi
}
# include valijson
include(3rdparty/valijson.pri)
# Configure destination path. DESTDIR is set in qmake-destination-path.pri
OBJECTS_DIR = $$PWD/build/$$DESTINATION_PATH/obj
MOC_DIR = $$PWD/build/$$DESTINATION_PATH/moc
RCC_DIR = $$PWD/build/$$DESTINATION_PATH/qrc
UI_DIR = $$PWD/build/$$DESTINATION_PATH/ui
# Default rules for deployment.
# This enables RPi device deployment in Qt Creator
qnx: target.path = /tmp/$${TARGET}/bin
else: linux: target.path = /opt/$${TARGET}/bin # A different target path is used on purpose to leave the installed app untouched
# Wildcards or directories just don't work: One has to know the magic $$files() command!
targetConfig.files = *.json
targetConfig.path = $$target.path
targetFonts.files = $$files($$PWD/fonts/*.*)
targetFonts.path = $$target.path/fonts
targetIcons.files = $$files($$PWD/icons/*.*)
targetIcons.path = $$target.path/icons
# The integration projects have to store the binary plugin in the destination folder.
# Note: restart Qt Creator if it doesn't pick up new plugins!
targetPlugins.files = $$files($$DESTDIR/plugins/*.*)
targetPlugins.path = $$target.path/plugins
!isEmpty(target.path): INSTALLS += target
!isEmpty(target.path): INSTALLS += targetConfig
!isEmpty(target.path): INSTALLS += targetFonts
!isEmpty(target.path): INSTALLS += targetIcons
!isEmpty(target.path): INSTALLS += targetPlugins
win32 {
CONFIG += file_copies
COPIES += extraData
extraData.files = $$PWD/config.json $$PWD/config-schema.json $$PWD/hardware.json $$PWD/hardware-schema.json $$PWD/translations.json $$PWD/locale.json
extraData.path = $$DESTDIR
#copy fonts
COPIES += fonts
fonts.files = $$files($$PWD/fonts/*.*)
fonts.path = $$DESTDIR/fonts
#copy icons
COPIES += icons
icons.files = $$files($$PWD/icons/*.*)
icons.path = $$DESTDIR/icons
#plugins are already stored in DESTDIR by the integration projects
# TODO Windows application icon
#RC_ICONS = icons/windows.ico
} else:linux {
CONFIG += file_copies
COPIES += extraData
extraData.files = $$PWD/config.json $$PWD/config-schema.json $$PWD/hardware.json $$PWD/hardware-schema.json $$PWD/translations.json $$PWD/locale.json
extraData.path = $$DESTDIR
#copy fonts
COPIES += fonts
fonts.files = $$files($$PWD/fonts/*.*)
fonts.path = $$DESTDIR/fonts
#copy icons
COPIES += icons
icons.files = $$files($$PWD/icons/*.*)
icons.path = $$DESTDIR/icons
#plugins are already stored in DESTDIR by the integration projects
# create deployment archive for RPi image build only
# usage: make install_tarball
equals(QT_ARCH, arm): {
tarball.path = $$DESTDIR_BIN
message( Storing tarball in $$tarball.path/$${TARGET}-$${platform_path}_$${processor_path}_$${build_path}.tar )
tarball.extra = mkdir -p $$tarball.path; tar -cvf $$tarball.path/$${TARGET}-$${platform_path}_$${processor_path}_$${build_path}.tar -C $$DESTDIR .
INSTALLS += tarball
}
} else:macx {
APP_QML_FILES.files = $$PWD/config.json $$PWD/config-schema.json $$PWD/hardware.json $$PWD/hardware-schema.json $$PWD/translations.json $$PWD/locale.json
APP_QML_FILES.path = Contents/Resources
QMAKE_BUNDLE_DATA += APP_QML_FILES
# re-package plugin files into app bundle
INTEGRATIONS.files = $$files($$DESTDIR/plugins/*.*)
INTEGRATIONS.path = Contents/Resources/plugins
QMAKE_BUNDLE_DATA += INTEGRATIONS
#copy fonts
FONTS.files = $$files($$PWD/fonts/*.*)
FONTS.path = Contents/Resources/fonts
QMAKE_BUNDLE_DATA += FONTS
#copy icons
ICONS.files = $$files($$PWD/icons/*.*)
ICONS.path = Contents/Resources/icons
QMAKE_BUNDLE_DATA += ICONS
# TODO macOS application icon
#ICON=icons/macos.icns
} else {
error(unknown platform! Platform must be configured in remote.pro project file)
}
DISTFILES += \
components/ButtonBase.qml \
components/FpsItem.qml \
components/media_player/ui/ChildModel.qml \
components/media_player/ui/Shared.qml \
components/media_player/ui/model.qml \
components/remote/ui/ir/Button.qml \
components/remote/ui/ir/Card.qml \
components/remote/ui/ir/CardButtons.qml \
components/remote/ui/ir/CardButtonsCustom.qml \
components/remote/ui/ir/CardButtonsFunction.qml \
components/remote/ui/ir/CardButtonsTransport.qml \
components/remote/ui/ir/CardChannels.qml \
components/remote/ui/ir/IconButton.qml \
config.json \
config-schema.json \
dependencies.cfg \
hardware.json \
hardware-schema.json \
license-template.txt \
locale.json \
translations.json \
version.txt.in \
README.md