-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtorc.pro
492 lines (460 loc) · 16.3 KB
/
torc.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
#check QT major version
lessThan(QT_MAJOR_VERSION, 5) {
error("Must build against Qt5")
}
# Environment overrides
# Force use of graphviz libraries. Currently disabled due to leaks.
libgvc = $$(TORC_LIBGVC)
# Force libxml2 check
libxml2 = $$(TORC_LIBXML2)
# Force Pi build due to incorrect Raspbian makespec
pi = $$(TORC_PI)
# OpenMax - disabled by default
openmax =
# ffmpeg
ffmpeg = $$(TORC_FFMPEG)
TEMPLATE = app
CONFIG += thread console
CONFIG -= app_bundle
CONFIG += c++11
TARGET = torc-server
PREFIX = /usr/local
RUNPREFIX = $$PREFIX
target.path = $${PREFIX}/bin
INSTALLS = target
DEFINES += PREFIX=\\\"$${PREFIX}\\\"
DEFINES += RUNPREFIX=\\\"$${RUNPREFIX}\\\"
DEFINES += GIT_VERSION='"\\\"$(shell git describe --always)\\\""'
DEFINES += _GNU_SOURCE
DEFINES += __STDC_LIMIT_MACROS
QT += sql network
QT -= gui
QMAKE_CXXFLAGS += -Wall -Wextra -Weffc++ -Werror
mingw {
DEFINES += WIN32 USING_MINGW WIN32_LEAN_AND_MEAN NOMINMAX
INCLUDEPATH += C:/Qt/Tools/mingw530_32/opt/include
message("Windows MingW build")
}
# explicitly add SSL - this may need more work
macx {
# NB this is a brew workaround
LIBS += -L/usr/local/opt/openssl/lib -lssl
LIBS += -L/usr/local/opt/openssl/lib -lcrypto
INCLUDEPATH += /usr/local/opt/openssl/include
} else:mingw {
LIBS += -LC:/Qt/Tools/mingw530_32/opt/lib -lssl
LIBS += -LC:/Qt/Tools/mingw530_32/opt/lib -lcrypto
} else:win32 {
message("No SSL support")
} else {
CONFIG += link_pkgconfig
PKGCONFIG += openssl
}
# debug builds
#CONFIG += debug
CONFIG(debug, debug|release) {
message("Debug build")
}else {
message("Release build")
}
# libraries
# zlib on windows is too much like hard work
win32 {
message("Zlib support NOT available for compressed html")
} else {
message("Zlib support available for compressed html")
DEFINES += USING_ZLIB
LIBS += -lz
}
!mac:!win32:LIBS += -lrt
QMAKE_CXXFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
DEPENDPATH += ./torc ./torc/http ./torc/upnp ./inputs ./inputs/platforms ./server
DEPENDPATH += ./outputs ./outputs/platforms ./torc/openmax ./controls ./notify
INCLUDEPATH += $$DEPENDPATH
# use graphviz via library or executable?
!isEmpty(libgvc):packagesExist(libgvc) {
DEFINES += USING_GRAPHVIZ_LIBS
CONFIG += link_pkgconfig
PKGCONFIG += libgvc
message("Linking to graphviz libraries for svg generation")
} else {
message("Using external graphviz binary for svg generation (if available)")
}
# translations
translations.path = $${PREFIX}/share/torc/i18n/
translations.files += i18n/*.qm
INSTALLS += translations
# HTML
install.path = $${PREFIX}/share/torc/html/
install.files = html/index.html
install.files += html/torc.xsd
install.files += html/manifest.json
install.files += html/browserconfig.xml
install.files += html/css html/webfonts html/img html/js
INSTALLS += install
# libxml2 for xml validation
!win32 {
packagesExist(libxml-2.0) | !isEmpty(libxml2) {
DEFINES += USING_LIBXML2
HEADERS += torc/torclibxmlvalidator.h
SOURCES += torc/torclibxmlvalidator.cpp
if (isEmpty(libxml2)) {
message("libxml2 available for xml validation")
CONFIG += link_pkgconfig
PKGCONFIG += libxml-2.0
} else {
message("libxml2 available for xml validation (forced)")
LIBS += -lxml2
INCLUDEPATH += $${PREFIX}/include/libxml2
}
} else {
message("No libxml2 for xml validation")
}
}
# xmlpatterns module for xml validation
# xmlpatterns is slow and buggy - disable by default
qtHaveModule(xmlpatterns_XX) {
QT += xmlpatterns
DEFINES += USING_XMLPATTERNS
HEADERS += torc/torcxmlvalidator.h
SOURCES += torc/torcxmlvalidator.cpp
message("QtXmlPatterns available")
}
linux {
# linux power support
qtHaveModule(dbus) {
QT += dbus
HEADERS += torc/platforms/torcpowerunixdbus.h
SOURCES += torc/platforms/torcpowerunixdbus.cpp
DEFINES += USING_QTDBUS
message("QtDBus available for power support")
} else {
message("No QtDBus support for power support")
}
# OpenMax Bellagio (test) NB install components package as well for test components
packagesExist(libomxil-bellagio) {
openmax = true
DEFINES += USING_LIBOMXIL_BELLAGIO
CONFIG += link_pkgconfig
PKGCONFIG += libomxil-bellagio
message("Linking to OpenMax Bellagio library")
}
}
# OS X power support
macx {
QMAKE_OBJECTIVE_CXXFLAGS += $$QMAKE_CXXFLAGS
LIBS += -framework Cocoa -framework IOkit
OBJECTIVE_HEADERS += torc/platforms/torccocoa.h
OBJECTIVE_SOURCES += torc/platforms/torccocoa.mm
HEADERS += torc/platforms/torcosxutils.h
HEADERS += torc/platforms/torcpowerosx.h
HEADERS += torc/platforms/torcrunlooposx.h
SOURCES += torc/platforms/torcosxutils.cpp
SOURCES += torc/platforms/torcpowerosx.cpp
SOURCES += torc/platforms/torcrunlooposx.cpp
}
# Raspberry Pi build
# Qt5 distributed with Raspbian Jessie uses the generic linux-g++ makespec, not linux-rasp-pi-g++
# so force it with an environment variable if necessary (i.e. TORC_PI=1 qmake).
linux-rasp-pi-g++ | !isEmpty(pi) {
LIBS += -lwiringPi
DEFINES += USING_I2C
DEFINES += USING_PIGPIO
HEADERS += outputs/platforms/torci2cpca9685.h
HEADERS += outputs/platforms/torcpigpio.h
HEADERS += outputs/platforms/torcpiswitchoutput.h
HEADERS += outputs/platforms/torcpipwmoutput.h
HEADERS += inputs/platforms/torcpiswitchinput.h
HEADERS += outputs/platforms/torcpicamera.h
SOURCES += outputs/platforms/torci2cpca9685.cpp
SOURCES += outputs/platforms/torcpigpio.cpp
SOURCES += outputs/platforms/torcpiswitchoutput.cpp
SOURCES += outputs/platforms/torcpipwmoutput.cpp
SOURCES += inputs/platforms/torcpiswitchinput.cpp
SOURCES += outputs/platforms/torcpicamera.cpp
openmax = true
LIBS += -L/opt/vc/lib -lbcm_host -lopenmaxil
DEFINES += USING_LIBOPENMAXIL
INCLUDEPATH += /opt/vc/include
INCLUDEPATH += /opt/vc/include/IL
INCLUDEPATH += /opt/vc/include/interface/vcos/pthreads
INCLUDEPATH += /opt/vc/include/interface/vmcs_host/linux
message("Linking to OpenMaxIL library (Raspberry Pi)")
ffmpeg = true
# install with suid permissions on Pi
# this allows access to I2C and GPIO
setpriv.target = setpriv
setpriv.depends = FORCE
setpriv.commands = @echo set privileges for $$target.path/$$TARGET && chmod u+s $$target.path/$$TARGET
QMAKE_EXTRA_TARGETS += setpriv
setpriv.path = .setpriv
INSTALLS += setpriv
message("Building for Raspberry Pi")
}
!isEmpty(ffmpeg) {
DEFINES += USING_FFMPEG
CONFIG += link_pkgconfig
PKGCONFIG += libavformat
PKGCONFIG += libavcodec
PKGCONFIG += libavutil
HEADERS += torc/ffmpeg/torcmuxer.h
HEADERS += outputs/torccamera.h
HEADERS += outputs/torccamerathread.h
HEADERS += outputs/torccameraoutput.h
SOURCES += torc/ffmpeg/torcmuxer.cpp
SOURCES += outputs/torccamera.cpp
SOURCES += outputs/torccamerathread.cpp
SOURCES += outputs/torccameraoutput.cpp
INCLUDEPATH += ./torc/ffmpeg
message("Linking to ffmpeg for camera support")
}
!isEmpty(openmax) {
#HEADERS += torc/openmax/torcomxtest.h
HEADERS += torc/openmax/torcomxcore.h
HEADERS += torc/openmax/torcomxport.h
HEADERS += torc/openmax/torcomxcomponent.h
HEADERS += torc/openmax/torcomxtunnel.h
#SOURCES += torc/openmax/torcomxtest.cpp
SOURCES += torc/openmax/torcomxcore.cpp
SOURCES += torc/openmax/torcomxport.cpp
SOURCES += torc/openmax/torcomxcomponent.cpp
SOURCES += torc/openmax/torcomxtunnel.cpp
}
# Bonjour is not available on windows
win32 {
SOURCES += torc/platforms/torcbonjourwindows.cpp
message("Bonjour NOT available for peer detection")
} else {
linux {
CONFIG += link_pkgconfig
PKGCONFIG += avahi-compat-libdns_sd
}
SOURCES += torc/torcbonjour.cpp
message("Bonjour available for peer detection")
}
HEADERS += torc/torclogging.h
HEADERS += torc/torcloggingdefs.h
HEADERS += torc/torcqthread.h
HEADERS += torc/torcloggingimp.h
HEADERS += torc/torcplist.h
HEADERS += torc/torccompat.h
HEADERS += torc/torcexitcodes.h
HEADERS += torc/torctimer.h
HEADERS += torc/torclocalcontext.h
HEADERS += torc/torcnetworkedcontext.h
HEADERS += torc/torcsqlitedb.h
HEADERS += torc/torcdb.h
HEADERS += torc/torcmaths.h
HEADERS += torc/torcreferencecounted.h
HEADERS += torc/torccoreutils.h
HEADERS += torc/torccommandline.h
HEADERS += torc/torcevent.h
HEADERS += torc/torcobservable.h
HEADERS += torc/torclocaldefs.h
HEADERS += torc/torcpower.h
HEADERS += torc/torcadminthread.h
HEADERS += torc/torclanguage.h
HEADERS += torc/torcnetwork.h
HEADERS += torc/torcnetworkrequest.h
HEADERS += torc/torcsetting.h
HEADERS += torc/torcrpcrequest.h
HEADERS += torc/torcdirectories.h
HEADERS += torc/torcmime.h
HEADERS += torc/torcbonjour.h
HEADERS += torc/torcxmlreader.h
HEADERS += torc/torctime.h
HEADERS += torc/torcuser.h
HEADERS += torc/torcsegmentedringbuffer.h
HEADERS += torc/http/torchttprequest.h
HEADERS += torc/http/torchttpservice.h
HEADERS += torc/http/torchttpservices.h
HEADERS += torc/http/torchttpserver.h
HEADERS += torc/http/torchttpserverlistener.h
HEADERS += torc/http/torchttpservernonce.h
HEADERS += torc/http/torchtmlhandler.h
HEADERS += torc/http/torchtmlstaticcontent.h
HEADERS += torc/http/torchtmldynamiccontent.h
HEADERS += torc/http/torchttphandler.h
HEADERS += torc/http/torchttpreader.h
HEADERS += torc/http/torcwebsocket.h
HEADERS += torc/http/torcwebsocketreader.h
HEADERS += torc/http/torcwebsocketthread.h
HEADERS += torc/http/torcwebsocketpool.h
HEADERS += torc/http/torcwebsockettoken.h
HEADERS += torc/http/torcserialiser.h
HEADERS += torc/http/torcxmlserialiser.h
HEADERS += torc/http/torcjsonserialiser.h
HEADERS += torc/http/torcplistserialiser.h
HEADERS += torc/http/torcplaintextserialiser.h
HEADERS += torc/http/torcbinaryplistserialiser.h
HEADERS += torc/http/torcjsonrpc.h
HEADERS += torc/upnp/torcupnp.h
HEADERS += torc/upnp/torcssdp.h
HEADERS += torc/upnp/torcupnpcontent.h
HEADERS += inputs/torcinput.h
HEADERS += inputs/torcinputs.h
HEADERS += inputs/torcpwminput.h
HEADERS += inputs/torcswitchinput.h
HEADERS += inputs/torcphinput.h
HEADERS += inputs/torcnetworkswitchinput.h
HEADERS += inputs/torcnetworkpwminput.h
HEADERS += inputs/torcnetworktemperatureinput.h
HEADERS += inputs/torcnetworkphinput.h
HEADERS += inputs/torcnetworkbuttoninput.h
HEADERS += inputs/torctemperatureinput.h
HEADERS += inputs/torcsysteminputs.h
HEADERS += inputs/torcsysteminput.h
HEADERS += inputs/torcintegerinput.h
HEADERS += inputs/torcnetworkintegerinput.h
HEADERS += inputs/platforms/torc1wirebus.h
HEADERS += inputs/platforms/torc1wireds18b20.h
HEADERS += outputs/torcoutput.h
HEADERS += outputs/torcoutputs.h
HEADERS += outputs/torcpwmoutput.h
HEADERS += outputs/torcswitchoutput.h
HEADERS += outputs/torcphoutput.h
HEADERS += outputs/torctemperatureoutput.h
HEADERS += outputs/platforms/torci2cbus.h
HEADERS += outputs/torcnetworkpwmoutput.h
HEADERS += outputs/torcnetworkswitchoutput.h
HEADERS += outputs/torcnetworktemperatureoutput.h
HEADERS += outputs/torcnetworkphoutput.h
HEADERS += outputs/torcnetworkbuttonoutput.h
HEADERS += controls/torccontrol.h
HEADERS += controls/torccontrols.h
HEADERS += controls/torclogiccontrol.h
HEADERS += controls/torctimercontrol.h
HEADERS += controls/torctransitioncontrol.h
HEADERS += notify/torcnotify.h
HEADERS += notify/torcnotifier.h
HEADERS += notify/torclognotifier.h
HEADERS += notify/torcpushbulletnotifier.h
HEADERS += notify/torciotlogger.h
HEADERS += notify/torcthingspeaknotifier.h
HEADERS += notify/torciotplotternotifier.h
HEADERS += notify/torcnotification.h
HEADERS += notify/torcsystemnotification.h
HEADERS += notify/torctriggernotification.h
SOURCES += torc/torcloggingimp.cpp
SOURCES += torc/torcplist.cpp
SOURCES += torc/torcqthread.cpp
SOURCES += torc/torclocalcontext.cpp
SOURCES += torc/torcnetworkedcontext.cpp
SOURCES += torc/torctimer.cpp
SOURCES += torc/torcsqlitedb.cpp
SOURCES += torc/torcdb.cpp
SOURCES += torc/torccoreutils.cpp
SOURCES += torc/torcreferencecounted.cpp
SOURCES += torc/torccommandline.cpp
SOURCES += torc/torcevent.cpp
SOURCES += torc/torcobservable.cpp
SOURCES += torc/torcpower.cpp
SOURCES += torc/torcadminthread.cpp
SOURCES += torc/torclanguage.cpp
SOURCES += torc/torcnetwork.cpp
SOURCES += torc/torcnetworkrequest.cpp
SOURCES += torc/torcsetting.cpp
SOURCES += torc/torcrpcrequest.cpp
SOURCES += torc/torcdirectories.cpp
SOURCES += torc/torcmime.cpp
SOURCES += torc/torcxmlreader.cpp
SOURCES += torc/torctime.cpp
SOURCES += torc/torcuser.cpp
SOURCES += torc/torcsegmentedringbuffer.cpp
SOURCES += torc/http/torchttprequest.cpp
SOURCES += torc/http/torchttpserver.cpp
SOURCES += torc/http/torchttpserverlistener.cpp
SOURCES += torc/http/torchttpservernonce.cpp
SOURCES += torc/http/torchtmlhandler.cpp
SOURCES += torc/http/torchtmlstaticcontent.cpp
SOURCES += torc/http/torchtmldynamiccontent.cpp
SOURCES += torc/http/torchttphandler.cpp
SOURCES += torc/http/torchttpreader.cpp
SOURCES += torc/http/torchttpservice.cpp
SOURCES += torc/http/torchttpservices.cpp
SOURCES += torc/http/torcwebsocket.cpp
SOURCES += torc/http/torcwebsocketreader.cpp
SOURCES += torc/http/torcwebsocketthread.cpp
SOURCES += torc/http/torcwebsocketpool.cpp
SOURCES += torc/http/torcwebsockettoken.cpp
SOURCES += torc/http/torcserialiser.cpp
SOURCES += torc/http/torcxmlserialiser.cpp
SOURCES += torc/http/torcjsonserialiser.cpp
SOURCES += torc/http/torcplistserialiser.cpp
SOURCES += torc/http/torcplaintextserialiser.cpp
SOURCES += torc/http/torcbinaryplistserialiser.cpp
SOURCES += torc/http/torcjsonrpc.cpp
SOURCES += torc/upnp/torcupnp.cpp
SOURCES += torc/upnp/torcssdp.cpp
SOURCES += torc/upnp/torcupnpcontent.cpp
SOURCES += inputs/torcinput.cpp
SOURCES += inputs/torcinputs.cpp
SOURCES += inputs/torcpwminput.cpp
SOURCES += inputs/torcphinput.cpp
SOURCES += inputs/torcswitchinput.cpp
SOURCES += inputs/torctemperatureinput.cpp
SOURCES += inputs/torcnetworkswitchinput.cpp
SOURCES += inputs/torcnetworkpwminput.cpp
SOURCES += inputs/torcnetworktemperatureinput.cpp
SOURCES += inputs/torcnetworkphinput.cpp
SOURCES += inputs/torcnetworkbuttoninput.cpp
SOURCES += inputs/torcsysteminputs.cpp
SOURCES += inputs/torcsysteminput.cpp
SOURCES += inputs/torcintegerinput.cpp
SOURCES += inputs/torcnetworkintegerinput.cpp
SOURCES += inputs/platforms/torc1wirebus.cpp
SOURCES += inputs/platforms/torc1wireds18b20.cpp
SOURCES += outputs/torcoutput.cpp
SOURCES += outputs/torcoutputs.cpp
SOURCES += outputs/torcpwmoutput.cpp
SOURCES += outputs/torcswitchoutput.cpp
SOURCES += outputs/torctemperatureoutput.cpp
SOURCES += outputs/torcphoutput.cpp
SOURCES += outputs/platforms/torci2cbus.cpp
SOURCES += outputs/torcnetworkpwmoutput.cpp
SOURCES += outputs/torcnetworkswitchoutput.cpp
SOURCES += outputs/torcnetworktemperatureoutput.cpp
SOURCES += outputs/torcnetworkphoutput.cpp
SOURCES += outputs/torcnetworkbuttonoutput.cpp
SOURCES += controls/torccontrol.cpp
SOURCES += controls/torccontrols.cpp
SOURCES += controls/torclogiccontrol.cpp
SOURCES += controls/torctimercontrol.cpp
SOURCES += controls/torctransitioncontrol.cpp
SOURCES += notify/torcnotify.cpp
SOURCES += notify/torcnotifier.cpp
SOURCES += notify/torclognotifier.cpp
SOURCES += notify/torciotlogger.cpp
SOURCES += notify/torcpushbulletnotifier.cpp
SOURCES += notify/torciotplotternotifier.cpp
SOURCES += notify/torcthingspeaknotifier.cpp
SOURCES += notify/torcnotification.cpp
SOURCES += notify/torcsystemnotification.cpp
SOURCES += notify/torctriggernotification.cpp
HEADERS += server/torccentral.h
HEADERS += server/torcdevice.h
HEADERS += server/torcdevicehandler.h
HEADERS += server/torcxsdtest.h
SOURCES += server/main.cpp
SOURCES += server/torccentral.cpp
SOURCES += server/torcdevice.cpp
SOURCES += server/torcdevicehandler.cpp
SOURCES += server/torcxsdtest.cpp
test {
message("Building tests")
DEFINES += TORC_TEST
QMAKE_CXXFLAGS -= -O2
QMAKE_CXXFLAGS += --coverage
LIBS += --coverage
QT += testlib
TARGET = torc-tests
target.path = ./
INSTALLS = target
SOURCES -= server/main.cpp
SOURCES += test/main.cpp
HEADERS += test/testserialisers.h
HEADERS += test/testtorclocalcontext.h
SOURCES += test/testserialisers.cpp
SOURCES += test/testtorclocalcontext.cpp
}
QMAKE_CLEAN += $(TARGET)