-
Notifications
You must be signed in to change notification settings - Fork 8
/
camcops.pro
1567 lines (1498 loc) · 52.2 KB
/
camcops.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
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright (C) 2012, University of Cambridge, Department of Psychiatry.
# Created by Rudolf Cardinal (rnc1001@cam.ac.uk).
#
# This file is part of CamCOPS.
#
# CamCOPS 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.
#
# CamCOPS 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 CamCOPS. If not, see <https://www.gnu.org/licenses/>.
# http://doc.qt.io/qt-5/qmake-project-files.html
# http://doc.qt.io/qt-5/qmake-variable-reference.html
message("+++ CamCOPS qmake starting.")
# =============================================================================
# Prerequisites: environment variables
# =============================================================================
# Need environment variable CAMCOPS_QT6_BASE_DIR
# Put something like this in your ~/.profile:
# export CAMCOPS_QT6_BASE_DIR="/home/rudolf/dev/qt_local_build"
# This file is read by qmake.
# Use $$(...) to read an environment variable at the time of qmake.
# Use $(...) to read an environment variable at the time of make.
# Use $$... or $${...} to read a Qt project file variable.
# See
# - http://doc.qt.io/qt-4.8/qmake-advanced-usage.html#variables
# - http://doc.qt.io/qt-5/qmake-test-function-reference.html
# Here, we copy an environment variable to a Qt project file variable:
# QT_BASE_DIR = $(CAMCOPS_QT6_BASE_DIR) # value at time of make
QT_BASE_DIR = $$(CAMCOPS_QT6_BASE_DIR) # value at time of qmake ("now")
isEmpty(QT_BASE_DIR) {
error("Environment variable CAMCOPS_QT6_BASE_DIR is undefined")
}
message("From environment variable CAMCOPS_QT6_BASE_DIR, using custom Qt/library base directory: $${QT_BASE_DIR}")
message("... Qt version: $$[QT_VERSION]")
message("... Qt is installed in: $$[QT_INSTALL_PREFIX]")
message("... Qt resources can be found in the following locations:")
message("... Documentation: $$[QT_INSTALL_DOCS]")
message("... Header files: $$[QT_INSTALL_HEADERS]")
message("... Libraries: $$[QT_INSTALL_LIBS]")
message("... Binary files (executables): $$[QT_INSTALL_BINS]")
message("... Plugins: $$[QT_INSTALL_PLUGINS]")
message("... Data files: $$[QT_INSTALL_DATA]")
message("... Translation files: $$[QT_INSTALL_TRANSLATIONS]")
message("... Settings: $$[QT_INSTALL_CONFIGURATION]")
message("... Examples: $$[QT_INSTALL_EXAMPLES]")
# AVOID # CAMCOPS_SOURCE_ROOT = ${PWD} # at time of make
CAMCOPS_SOURCE_ROOT = $${PWD} # at time of qmake ("now")
message("Expecting CamCOPS source root at: $${CAMCOPS_SOURCE_ROOT}")
# message("QMAKESPEC: $${QMAKESPEC}")
# message("QMAKE_PLATFORM: $${QMAKE_PLATFORM}")
message("... QT_ARCH: $${QT_ARCH}")
# =============================================================================
# Parts of Qt
# =============================================================================
# SQLite/Android and OpenSSL/anything requires a custom Qt build.
# ALSO TRY:
# qmake -query # for the qmake of the Qt build you're using
# http://doc.qt.io/qt-5/qtmultimedia-index.html
# http://wiki.qt.io/Qt_5.5.0_Multimedia_Backends
# http://doc.qt.io/qt-4.8/qmake-variable-reference.html#qt
# http://doc.qt.io/qt-5/qtmodules.html
QT += core # included by default; QtCore module
QT += gui # included by default; QtGui module
QT += multimedia # or: undefined reference to QMedia*::*
QT += multimediawidgets
QT += network # required to #include <QtNetwork/...>
QT += opengl
QT += openglwidgets
QT += printsupport # for QCustomPlot
QT += quick # for QML, e.g. for camera
QT += quickwidgets # for QQuickWidget
QT += sql # required to #include <QSqlDatabase>
QT += statemachine
QT += svg # required to #include <QGraphicsSvgItem> or <QSvgRenderer>
QT += svgwidgets
# QT += webkit # for QWebView -- no, not used
# QT += webkitwidgets # for QWebView -- no, not used
QT += widgets # required to #include <QApplication>
# message("QT = $${QT}")
# message("QTPLUGIN = $${QTPLUGIN}")
# http://stackoverflow.com/questions/20351155/how-can-i-enable-ssl-in-qt-windows-application
# http://stackoverflow.com/questions/18663331/how-to-check-the-selected-version-of-qt-in-a-pro-file
# =============================================================================
# Overall configuration
# =============================================================================
# CONFIG += debug
# ... no, use the QtCreator debug/release settings, which adds
# e.g. "CONFIG+=debug CONFIG+=qml_debug" to the call to qmake
CONFIG += mobility
CONFIG += c++11
# For SQLCipher (see its README.md):
# http://stackoverflow.com/questions/16244040/is-the-qt-defines-doing-the-same-thing-as-define-in-c
DEFINES += SQLITE_HAS_CODEC
DEFINES += SQLITE_TEMP_STORE=2
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# Fail to compile if you use deprecated APIs.
DEFINES += QT_DISABLE_DEPRECATED_UP_TO=0x060500
MOBILITY =
# PKGCONFIG += openssl
# ... http://stackoverflow.com/questions/14681012/how-to-include-openssl-in-a-qt-project
# ... but no effect? Not mentioned in variable reference (above).
# ... ah, here's the reference:
# http://doc.qt.io/qt-5/qmake-project-files.html
# LIBS += -lssl
# ... not working either? Doesn't complain, but ldd still shows that system libssl.so is in use
# =============================================================================
# Compiler and linker flags
# =============================================================================
gcc | clang {
COMPILER_VERSION = $$system($$QMAKE_CXX " -dumpversion")
COMPILER_MAJOR_VERSION = $$str_member($$COMPILER_VERSION)
}
# Warning become errors
gcc {
# GCC
message("Compiler is GCC")
QMAKE_CXXFLAGS += -Werror # warnings become errors
}
msvc {
# Microsoft Visual C++
message("Compiler is Microsoft Visual C++")
QMAKE_CXXFLAGS += /W3
# ... /W4 is the highest level of warnings bar "/Wall"
# ... but we get "D9025: overriding '/W4' with '/W3'"
QMAKE_CXXFLAGS += /WX # treat warnings as errors
# QMAKE_CXXFLAGS += /showIncludes # if you think the wrong ones are being included!
}
clang {
message("Compiler is clang")
QMAKE_CXXFLAGS += -Werror # warnings become errors
}
# Until we use a version of Qt that can cope, disable "-Werror=deprecated-copy".
# In general, note "-Werrmsg" to enable and "-Wno-errmsg" to disable:
# https://stackoverflow.com/questions/925179/selectively-remove-warning-message-gcc
# (This problem arose on 2020-06-29 with Ubuntu 20.04 which brought gcc 9.3.0.)
# 2021-02-05: also true of clang v10.0.0.
if (gcc | clang):!ios:!android:!macx {
!lessThan(COMPILER_MAJOR_VERSION, 9) {
QMAKE_CXXFLAGS += -Wno-deprecated-copy
}
}
# Later versions of clang on iOS *do* support (no-)deprecated-copy but the order
# of warning flags seems to be important and removing !ios above doesn't work
# QMAKE_CXXFLAGS_WARN_ON defaults to -Wall -W and our overrides need to come
# after that
if (ios | macx) {
QMAKE_CFLAGS_WARN_ON += -Wno-deprecated-copy
QMAKE_CXXFLAGS_WARN_ON += -Wno-deprecated-copy
}
# In release mode, optimize heavily:
gcc {
QMAKE_CXXFLAGS_RELEASE -= -O
QMAKE_CXXFLAGS_RELEASE -= -O1
QMAKE_CXXFLAGS_RELEASE -= -O2
QMAKE_CXXFLAGS_RELEASE += -O3 # optimize heavily
}
msvc {
QMAKE_CXXFLAGS_RELEASE -= /O1 # /O1: minimum size
QMAKE_CXXFLAGS_RELEASE += /O2 # /O2: maximum speed
# We also get "LNK4098: defaultlib 'LIBCMT' conflicts with use of other
# libs; use /NODEFAULTLIB:library" but this may be because the /MD, /MT,
# or /LD setting conflicts.
# /MD: multithread-specific and DLL-specific version of the runtime library
# /MT: multithread, static version of the runtime library [fails; LIBCMT conflicts...]
# /LD: creates a DLL
QMAKE_CXXFLAGS_RELEASE += /MD
}
# For compilers that support it, make the visibility hidden
# Note: there may be linker warnings relating to access to Qt functions, but
# they're only warnings.
gcc {
# http://gcc.gnu.org/wiki/Visibility
QMAKE_CXXFLAGS += -fvisibility=hidden
}
# But WARNING: this will also hide main(), which isn't a problem in Linux/
# Windows executables, but is a major problem for Android, where the Qt Java
# application wends its way to C++ then calls main() from libcamcops.so. The
# end result is an instant crash on startup. So main() must be marked for
# symbol export. [Understood/fixed 2019-06-20.]
# QMAKE_LFLAGS += --verbose # make the linker verbose
android {
QMAKE_RESOURCE_FLAGS += "-compress-algo zlib"
}
# =============================================================================
# Build targets
# =============================================================================
TARGET = camcops
TEMPLATE = app
# =============================================================================
# Paths
# =============================================================================
# See build_qt.py for how these are built (or not built) as required.
INCLUDEPATH += "$${QT_BASE_DIR}/eigen/eigen-3.4.0" # from which: <Eigen/...>
# INCLUDEPATH += "$${QT_BASE_DIR}/armadillo/armadillo-7.950.0/include" # from which: <armadillo>
# INCLUDEPATH += "$${QT_BASE_DIR}/armadillo/armadillo-7.950.0/include/armadillo_bits"
# INCLUDEPATH += "$${QT_BASE_DIR}/boost/boost_1_64_0" # from which: <boost/...>
# INCLUDEPATH += "$${QT_BASE_DIR}/src/mlpack/src" # from which: <mlpack/...>
# =============================================================================
# OS-specific options
# =============================================================================
# https://wiki.qt.io/Technical_FAQ#How_can_I_detect_in_the_.pro_file_if_I_am_compiling_for_a_32_bit_or_a_64_bit_platform.3F
OPENSSL_VERSION = 1.1.1s
# ... see build_qt.py or changelog.rst for chronology
# -----------------------------------------------------------------------------
# Architecture
# -----------------------------------------------------------------------------
OBJ_EXT = ".o" # unless otherwise set
# Set OS-specific variables
# Operating system tests include "linux", "unix", "macx", "android", "windows",
# "ios".
-
linux : !android {
# -------------------------------------------------------------------------
# LINUX -- and not Android Linux!
# -------------------------------------------------------------------------
STATIC_LIB_EXT = ".a"
DYNAMIC_LIB_EXT = ".so"
CAMCOPS_QT_LINKAGE = "static"
# CAMCOPS_QT_LINKAGE = "dynamic"
CAMCOPS_OPENSSL_LINKAGE = "static"
# https://stackoverflow.com/questions/33117822
# https://stackoverflow.com/questions/356666
contains(QT_ARCH, x86_64) {
message("Building for Linux/x86_64")
CAMCOPS_ARCH_TAG = "linux_x86_64"
} else { # will be "i386"
message("Building for Linux/x86_32")
CAMCOPS_ARCH_TAG = "linux_x86_32"
}
}
android {
# -------------------------------------------------------------------------
# ANDROID
# -------------------------------------------------------------------------
STATIC_LIB_EXT = ".a"
DYNAMIC_LIB_EXT = ".so"
CAMCOPS_QT_LINKAGE = "dynamic"
# CAMCOPS_OPENSSL_LINKAGE = "static"
CAMCOPS_OPENSSL_LINKAGE = "dynamic"
contains(ANDROID_TARGET_ARCH, x86) {
message("Building for Android/x86 (e.g. Android emulator)")
CAMCOPS_ARCH_TAG = "android_x86"
}
contains(ANDROID_TARGET_ARCH, armeabi-v7a) {
message("Building for Android/ARMv7 32-bit architecture")
CAMCOPS_ARCH_TAG = "android_armv7"
}
contains(ANDROID_TARGET_ARCH, arm64-v8a) {
message("Building for Android/ARMv8 64-bit architecture")
CAMCOPS_ARCH_TAG = "android_armv8_64"
}
# http://doc.qt.io/qt-5/deployment-android.html#android-specific-qmake-variables
ANDROID_PACKAGE_SOURCE_DIR = "$${CAMCOPS_SOURCE_ROOT}/android"
message("ANDROID_PACKAGE_SOURCE_DIR: $${ANDROID_PACKAGE_SOURCE_DIR}")
# ... contains things like AndroidManifest.xml
message("Environment variable ANDROID_NDK_ROOT (should be set by Qt Creator): $$(ANDROID_NDK_ROOT)")
# ... https://bugreports.qt.io/browse/QTCREATORBUG-15240
}
windows {
# -------------------------------------------------------------------------
# WINDOWS
# -------------------------------------------------------------------------
STATIC_LIB_EXT = ".lib"
DYNAMIC_LIB_EXT = ".dll"
OBJ_EXT = ".obj"
CAMCOPS_QT_LINKAGE = "static"
CAMCOPS_OPENSSL_LINKAGE = "static"
# https://stackoverflow.com/questions/26373143
# https://stackoverflow.com/questions/33117822
# https://stackoverflow.com/questions/356666
contains(QT_ARCH, x86_64) {
message("Building for Windows/x86_64 architecture")
CAMCOPS_ARCH_TAG = "windows_x86_64"
} else {
message("Building for Windows/x86_32 architecture")
CAMCOPS_ARCH_TAG = "windows_x86_32"
}
RC_FILE = windows/camcops.rc
}
macx {
# -------------------------------------------------------------------------
# MacOS (formerly OS X)
# -------------------------------------------------------------------------
STATIC_LIB_EXT = ".a"
DYNAMIC_LIB_EXT = ".dylib"
CAMCOPS_QT_LINKAGE = "static"
CAMCOPS_OPENSSL_LINKAGE = "static"
contains(QT_ARCH, x86_64) {
message("Building for MacOS/x86_64 architecture")
CAMCOPS_ARCH_TAG = "macos_x86_64"
} else {
message("Building for MacOS/x86_32 architecture")
CAMCOPS_ARCH_TAG = "macos_x86_32"
}
}
ios {
# -------------------------------------------------------------------------
# iOS
# -------------------------------------------------------------------------
STATIC_LIB_EXT = ".a"
DYNAMIC_LIB_EXT = ".dylib"
CAMCOPS_QT_LINKAGE = "static"
CAMCOPS_OPENSSL_LINKAGE = "static"
# Both iphoneos and iphonesimulator are set ?!
CONFIG(iphoneos, iphoneos|iphonesimulator) {
message("Building for iPhone OS")
contains(QT_ARCH, arm64) {
message("Building for iOS/ARM v8 64-bit architecture")
CAMCOPS_ARCH_TAG = "ios_armv8_64"
} else {
message("Building for iOS/ARM v7 (32-bit) architecture")
CAMCOPS_ARCH_TAG = "ios_armv7"
}
}
CONFIG(iphonesimulator, iphoneos|iphonesimulator) {
message("Building for iPhone Simulator")
CAMCOPS_ARCH_TAG = "ios_x86_64"
}
disable_warning.name = "GCC_WARN_64_TO_32_BIT_CONVERSION"
disable_warning.value = "No"
QMAKE_MAC_XCODE_SETTINGS += disable_warning
QMAKE_TARGET_BUNDLE_PREFIX = "uk.ac.cam.psychiatry"
QMAKE_BUNDLE = "camcops"
QMAKE_INFO_PLIST = $${CAMCOPS_SOURCE_ROOT}/ios/Info.plist
QMAKE_IOS_LAUNCH_SCREEN = $${CAMCOPS_SOURCE_ROOT}/ios/LaunchScreen.storyboard
QMAKE_ASSET_CATALOGS = $${CAMCOPS_SOURCE_ROOT}/ios/Images.xcassets
QMAKE_ASSET_CATALOGS_APP_ICON = "AppIcon"
}
isEmpty(CAMCOPS_ARCH_TAG) {
error("Unknown architecture; don't know how to build CamCOPS")
}
# -----------------------------------------------------------------------------
# Linkage method
# -----------------------------------------------------------------------------
# To have the linker show its working:
# LIBS += "-Wl,--verbose"
equals(CAMCOPS_QT_LINKAGE, "static") { # http://doc.qt.io/qt-5/qmake-test-function-reference.html
message("Using static linkage from CamCOPS to Qt")
CONFIG += static
} else:equals(CAMCOPS_QT_LINKAGE, "dynamic") {
message("Using dynamic linkage from CamCOPS to Qt")
} else {
error("Linkage method from CamCOPS to Qt not specified")
}
equals(CAMCOPS_OPENSSL_LINKAGE, "static") {
message("Using static linkage from CamCOPS to OpenSSL")
} else:equals(CAMCOPS_OPENSSL_LINKAGE, "dynamic") {
message("Using dynamic linkage from CamCOPS to OpenSSL")
} else {
error("Linkage method from CamCOPS to OpenSSL not specified")
}
# Quick tutorial on linking, since I seem to need it:
#
# FILE TYPES
#
# - Standard Linux file types [5, 6]:
# .o object file
# .a archive (= collection of one or more object files)
# .so shared object (approx. equiv. to Windows DLL)
#
# COMPILER AND LINKER
#
# - g++ is the C++ compiler from the Gnu Compiler Collection but also calls the
# linker [1]. Use "g++ --version" to find the version; currently I have
# 5.4.0.
#
# - qmake will call g++, which will call GNU's ld (the linker).
#
# - ld parameters include
# -L<path> (as per "man g++") or -L <path> (as per "man ld")
# -l<library>
#
# - When you specify "-lxyz", the linker looks for "libxyz.a", in standard
# system directories plus any you specify with -L [2].
# "Normally the files found this way are library files—archive files whose
# members are object files. The linker handles an archive file by scanning
# through it for members which define symbols that have so far been
# referenced but not defined. But if the file that is found is an ordinary
# object file, it is linked in the usual fashion. The only difference
# between using an -l option and specifying a file name is that -l surrounds
# library with ‘lib’ and ‘.a’ and searches several directories."
#
# - There is also the "-l:filename" object, which skips the "lib" and ".a"
# parts [3].
#
# INFORMATION ON OBJECT/LIBRARY/EXECUTABLES
#
# - ldd prints the shared objects (shared libraries) required by a program or
# shared object (so use it for executables and .so files).
#
# - An alternative is
# objdump -p TARGET | grep NEEDED # or omit the grep for more info
# ... objdump works for .so, .a, and executables.
#
# - You can also use
# objdump -t TARGET
# to view its symbols.
# For example, you might find that a linked version of camcops not only
# requires libcrypto.so.1.1, but that it contains symbols present in
# libcrypto, such as EVP_aes_256_cfb, if we add a specific libcrypto.a to the
# linker... so something is requiring the dynamic library even as we're
# trying to link statically (despite configuring Qt with -openssl-linked).
#
# - Show files in an archive (.a) [4]:
# ar -t libxyz.a
#
# APPLIED TO CAMCOPS
#
# - If you have the linker show its working with
# -Wl,--verbose
# then you can also see it finding libcrypto.so during the link process, but
# then the executable not finding it when it runs, e.g.:
#
# link:
# $ make
# attempt to open /home/rudolf/dev/qt_local_build/openssl_linux_x86_64_build/openssl-1.1.0g/libcrypto.so succeeded
# -lcrypto (/home/rudolf/dev/qt_local_build/openssl_linux_x86_64_build/openssl-1.1.0g/libcrypto.so)
# run:
# $ ./camcops
# ./camcops: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
# run with manual library path:
# $ LD_LIBRARY_PATH=/home/rudolf/dev/qt_local_build/openssl_linux_x86_64_build/openssl-1.1.0g ./camcops
# ... runs.
#
# REFERENCES
#
# [1] https://stackoverflow.com/questions/172587/what-is-the-difference-between-g-and-gcc
# [2] https://gcc.gnu.org/onlinedocs/gcc-5.5.0/gcc/Link-Options.html#Link-Options
# [3] https://stackoverflow.com/questions/6578484/telling-gcc-directly-to-link-a-library-statically
# [4] http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html
# [5] https://stackoverflow.com/questions/9688200/difference-between-shared-objects-so-static-libraries-a-and-dlls-so
# [6] https://en.wikipedia.org/wiki/Ar_(Unix)
# -----------------------------------------------------------------------------
# OpenSSL
# -----------------------------------------------------------------------------
OPENSSL_SUBDIR = openssl-$${OPENSSL_VERSION}
OPENSSL_DIR = "$${QT_BASE_DIR}/openssl_$${CAMCOPS_ARCH_TAG}_build/$${OPENSSL_SUBDIR}"
message("Using OpenSSL version $$OPENSSL_VERSION from $${OPENSSL_DIR}")
INCLUDEPATH += "$${OPENSSL_DIR}/include"
equals(CAMCOPS_OPENSSL_LINKAGE, "static") {
LIBS += "-L$${OPENSSL_DIR}" # path; shouldn't be necessary for static linkage! Residual problem.
LIBS += "$${OPENSSL_DIR}/libcrypto$${STATIC_LIB_EXT}" # raw filename, not -l
LIBS += "$${OPENSSL_DIR}/libssl$${STATIC_LIB_EXT}" # raw filename, not -l
} else {
LIBS += "-L$${OPENSSL_DIR}" # path
LIBS += "-lcrypto"
LIBS += "-lssl"
}
# Regardless of how *CamCOPS* talks to OpenSSL, under Android *Qt* talks to
# it dynamically:
ANDROID_EXTRA_LIBS += "$${OPENSSL_DIR}/libcrypto$${DYNAMIC_LIB_EXT}" # needed for Qt
ANDROID_EXTRA_LIBS += "$${OPENSSL_DIR}/libssl$${DYNAMIC_LIB_EXT}"
# ... must start "lib" and end ".so", otherwise Qt complains.
# -----------------------------------------------------------------------------
# SQLCipher
# -----------------------------------------------------------------------------
SQLCIPHER_DIR = "$${QT_BASE_DIR}/sqlcipher_$${CAMCOPS_ARCH_TAG}"
message("Using SQLCipher from $${SQLCIPHER_DIR}")
INCLUDEPATH += "$${SQLCIPHER_DIR}" # from which: <sqlcipher/sqlite3.h>
LIBS += "$${SQLCIPHER_DIR}/sqlcipher/sqlite3$${OBJ_EXT}" # add .o file
# ... if that causes the error "multiple definition of 'sqlite3_free'", etc.,
# then Qt is inappropriately linking in SQLite as well.
# -----------------------------------------------------------------------------
# All set up
# -----------------------------------------------------------------------------
message("QMAKE_CFLAGS=$${QMAKE_CFLAGS}")
message("QMAKE_CXXFLAGS=$${QMAKE_CXXFLAGS}")
message("QMAKE_RESOURCE_FLAGS=$${QMAKE_RESOURCE_FLAGS}")
message("INCLUDEPATH=$${INCLUDEPATH}")
message("LIBS=$${LIBS}")
message("... qmake will add more to INCLUDEPATH and LIBS; see Makefile")
# ... view the Makefile at the end; qmake will have added others
# ... and run "ldd camcops" to view dynamic library dependencies
android {
message("ANDROID_EXTRA_LIBS=$${ANDROID_EXTRA_LIBS}")
}
# =============================================================================
# Resources and source files
# =============================================================================
RESOURCES += \
camcops.qrc
SOURCES += \
common/appstrings.cpp \
common/cssconst.cpp \
common/dbconst.cpp \
common/dpi.cpp \
common/globals.cpp \
common/platform.cpp \
common/textconst.cpp \
common/uiconst.cpp \
common/urlconst.cpp \
common/varconst.cpp \
common/widgetconst.cpp \
core/camcopsapp.cpp \
core/networkmanager.cpp \
crypto/cryptofunc.cpp \
crypto/secureqbytearray.cpp \
crypto/secureqstring.cpp \
db/ancillaryfunc.cpp \
db/blobfieldref.cpp \
db/databasemanager.cpp \
db/databaseobject.cpp \
db/databaseworkerthread.cpp \
db/dbfunc.cpp \
db/dbnestabletransaction.cpp \
db/dbtransaction.cpp \
db/dumpsql.cpp \
db/field.cpp \
db/fieldcreationplan.cpp \
db/fieldref.cpp \
db/queryresult.cpp \
db/sqlargs.cpp \
db/sqlcachedresult.cpp \
db/sqlcipherdriver.cpp \
db/sqlcipherhelpers.cpp \
db/sqlcipherresult.cpp \
db/sqlitepragmainfofield.cpp \
db/threadedqueryrequest.cpp \
db/whereconditions.cpp \
db/whichdb.cpp \
dbobjects/allowedservertable.cpp \
dbobjects/blob.cpp \
dbobjects/extrastring.cpp \
dbobjects/idnumdescription.cpp \
dbobjects/patient.cpp \
dbobjects/patientidnum.cpp \
dbobjects/patientidnumsorter.cpp \
dbobjects/patientsorter.cpp \
dbobjects/storedvar.cpp \
diagnosis/diagnosissortfiltermodel.cpp \
diagnosis/diagnosticcode.cpp \
diagnosis/diagnosticcodeset.cpp \
diagnosis/flatproxymodel.cpp \
diagnosis/icd10.cpp \
diagnosis/icd9cm.cpp \
dialogs/dangerousconfirmationdialog.cpp \
dialogs/debugdialog.cpp \
dialogs/logbox.cpp \
dialogs/logmessagebox.cpp \
dialogs/modedialog.cpp \
dialogs/nvpchoicedialog.cpp \
dialogs/pagepickerdialog.cpp \
dialogs/passwordchangedialog.cpp \
dialogs/passwordentrydialog.cpp \
dialogs/patientregistrationdialog.cpp \
dialogs/progressbox.cpp \
dialogs/scrollmessagebox.cpp \
dialogs/soundtestdialog.cpp \
dialogs/waitbox.cpp \
graphics/buttonconfig.cpp \
graphics/geometry.cpp \
graphics/graphicsfunc.cpp \
graphics/graphicspixmapitemwithopacity.cpp \
graphics/linesegment.cpp \
graphics/paintertranslaterotatecontext.cpp \
graphics/penbrush.cpp \
graphics/textconfig.cpp \
layouts/boxlayouthfw.cpp \
layouts/flowlayouthfw.cpp \
layouts/gridlayouthfw.cpp \
layouts/hboxlayouthfw.cpp \
layouts/qtlayouthelpers.cpp \
layouts/vboxlayouthfw.cpp \
layouts/widgetitemhfw.cpp \
lib/comparers.cpp \
lib/containers.cpp \
lib/convert.cpp \
lib/css.cpp \
lib/datetime.cpp \
lib/debugfunc.cpp \
lib/filefunc.cpp \
lib/flagguard.cpp \
lib/idpolicy.cpp \
lib/errorfunc.cpp \
lib/layoutdumper.cpp \
lib/margins.cpp \
lib/nhs.cpp \
lib/numericfunc.cpp \
lib/openglfunc.cpp \
lib/reentrydepthguard.cpp \
lib/roman.cpp \
lib/sizehelpers.cpp \
lib/slowguiguard.cpp \
lib/soundfunc.cpp \
lib/stringfunc.cpp \
lib/timerfunc.cpp \
lib/uifunc.cpp \
lib/version.cpp \
lib/widgetfunc.cpp \
main.cpp \
maths/ccrandom.cpp \
maths/countingcontainer.cpp \
maths/dqrls.cpp \
maths/eigenfunc.cpp \
maths/endian.cpp \
maths/glm.cpp \
maths/linkfunctionfamily.cpp \
maths/logisticdescriptives.cpp \
maths/logisticregression.cpp \
maths/mathfunc.cpp \
maths/mlpackfunc.cpp \
maths/statsfunc.cpp \
menu/addictionmenu.cpp \
menu/affectivemenu.cpp \
menu/alltasksmenu.cpp \
menu/anonymousmenu.cpp \
menu/catatoniaepsemenu.cpp \
menu/choosepatientmenu.cpp \
menu/clinicalmenu.cpp \
menu/clinicalsetsmenu.cpp \
menu/cognitivemenu.cpp \
menu/eatingdisordersmenu.cpp \
menu/executivemenu.cpp \
menu/globalmenu.cpp \
menu/helpmenu.cpp \
menu/mainmenu.cpp \
menu/patientsummarymenu.cpp \
menu/personalitymenu.cpp \
menu/physicalillnessmenu.cpp \
menu/psychosismenu.cpp \
menu/researchmenu.cpp \
menu/researchsetsmenu.cpp \
menu/serviceevaluationmenu.cpp \
menu/setmenucpftadrd.cpp \
menu/setmenucpftadulteatingdisorders.cpp \
menu/setmenucpftcovid.cpp \
menu/setmenucpftperinatal.cpp \
menu/setmenucpftpsychooncology.cpp \
menu/setmenudeakin.cpp \
menu/setmenufromlp.cpp \
menu/setmenufromperinatal.cpp \
menu/setmenukhandakerinsight.cpp \
menu/setmenukhandakermojo.cpp \
menu/setmenulynalliam.cpp \
menu/setmenuobrien.cpp \
menu/settingsmenu.cpp \
menu/singletaskmenu.cpp \
menu/singleuseradvancedmenu.cpp \
menu/singleusermenu.cpp \
menu/singleuseroptionsmenu.cpp \
menu/testmenu.cpp \
menu/whiskertestmenu.cpp \
menu/widgettestmenu.cpp \
menulib/choosepatientmenuitem.cpp \
menulib/fontsizeanddpiwindow.cpp \
menulib/fontsizewindow.cpp \
menulib/htmlinfowindow.cpp \
menulib/htmlmenuitem.cpp \
menulib/menuheader.cpp \
menulib/menuitem.cpp \
menulib/menuproxy.cpp \
menulib/menuwindow.cpp \
menulib/serversettingswindow.cpp \
menulib/taskchainmenuitem.cpp \
menulib/taskmenuitem.cpp \
menulib/taskscheduleitemmenuitem.cpp \
menulib/urlmenuitem.cpp \
qcustomplot/qcustomplot.cpp \
qobjects/debugeventwatcher.cpp \
qobjects/emailvalidator.cpp \
qobjects/flickcharm.cpp \
qobjects/focuswatcher.cpp \
qobjects/keypresswatcher.cpp \
qobjects/nhsnumbervalidator.cpp \
qobjects/proquintvalidator.cpp \
qobjects/shootabug.cpp \
qobjects/showwatcher.cpp \
qobjects/sizewatcher.cpp \
qobjects/slownonguifunctioncaller.cpp \
qobjects/strictdoublevalidator.cpp \
qobjects/strictint64validator.cpp \
qobjects/strictintvalidator.cpp \
qobjects/strictuint64validator.cpp \
qobjects/stylenofocusrect.cpp \
qobjects/threadworker.cpp \
qobjects/urlhandler.cpp \
qobjects/urlvalidator.cpp \
questionnairelib/commonoptions.cpp \
questionnairelib/dynamicquestionnaire.cpp \
questionnairelib/mcqfunc.cpp \
questionnairelib/mcqgridsubtitle.cpp \
questionnairelib/namevalueoptions.cpp \
questionnairelib/namevaluepair.cpp \
questionnairelib/pagepickeritem.cpp \
questionnairelib/quaudioplayer.cpp \
questionnairelib/qubackground.cpp \
questionnairelib/quboolean.cpp \
questionnairelib/qubutton.cpp \
questionnairelib/qucanvas.cpp \
questionnairelib/qucountdown.cpp \
questionnairelib/qudatetime.cpp \
questionnairelib/qudiagnosticcode.cpp \
questionnairelib/quelement.cpp \
questionnairelib/questionnaire.cpp \
questionnairelib/questionnairefunc.cpp \
questionnairelib/questionnaireheader.cpp \
questionnairelib/questionwithonefield.cpp \
questionnairelib/questionwithtwofields.cpp \
questionnairelib/quflowcontainer.cpp \
questionnairelib/qugridcell.cpp \
questionnairelib/qugridcontainer.cpp \
questionnairelib/quheading.cpp \
questionnairelib/quheight.cpp \
questionnairelib/quhorizontalcontainer.cpp \
questionnairelib/quhorizontalline.cpp \
questionnairelib/quimage.cpp \
questionnairelib/qulineedit.cpp \
questionnairelib/qulineeditdouble.cpp \
questionnairelib/qulineeditemail.cpp \
questionnairelib/qulineeditint64.cpp \
questionnairelib/qulineeditinteger.cpp \
questionnairelib/qulineeditnhsnumber.cpp \
questionnairelib/qulineedituint64.cpp \
questionnairelib/qumass.cpp \
questionnairelib/qumcq.cpp \
questionnairelib/qumcqgrid.cpp \
questionnairelib/qumcqgriddouble.cpp \
questionnairelib/qumcqgriddoublesignaller.cpp \
questionnairelib/qumcqgridsignaller.cpp \
questionnairelib/qumcqgridsingleboolean.cpp \
questionnairelib/qumcqgridsinglebooleansignaller.cpp \
questionnairelib/qumeasurement.cpp \
questionnairelib/qumultipleresponse.cpp \
questionnairelib/qupage.cpp \
questionnairelib/quphoto.cpp \
questionnairelib/qupickerinline.cpp \
questionnairelib/qupickerpopup.cpp \
questionnairelib/qusequencecontainerbase.cpp \
questionnairelib/quslider.cpp \
questionnairelib/quspacer.cpp \
questionnairelib/quspinboxdouble.cpp \
questionnairelib/quspinboxinteger.cpp \
questionnairelib/qutext.cpp \
questionnairelib/qutextedit.cpp \
questionnairelib/quthermometer.cpp \
questionnairelib/quthermometeritem.cpp \
questionnairelib/quunitselector.cpp \
questionnairelib/quverticalcontainer.cpp \
questionnairelib/quwaist.cpp \
questionnairelib/quzoomcontainer.cpp \
taskchains/cpftadulteatingdisorderscoiinanchain.cpp \
taskchains/cpftadulteatingdisorderss3clinicalchain.cpp \
taskchains/khandakermojochain.cpp \
tasklib/inittasks.cpp \
tasklib/task.cpp \
tasklib/taskchain.cpp \
tasklib/taskfactory.cpp \
tasklib/taskproxy.cpp \
tasklib/taskregistrar.cpp \
tasklib/taskschedule.cpp \
tasklib/taskscheduleitem.cpp \
tasklib/taskscheduleitemeditor.cpp \
tasklib/tasksorter.cpp \
tasks/ace3.cpp \
tasks/acefamily.cpp \
tasks/aims.cpp \
tasks/apeqcpftperinatal.cpp \
tasks/apeqpt.cpp \
tasks/asdas.cpp \
tasks/audit.cpp \
tasks/auditc.cpp \
tasks/badls.cpp \
tasks/basdai.cpp \
tasks/bdi.cpp \
tasks/bmi.cpp \
tasks/bprs.cpp \
tasks/bprse.cpp \
tasks/cage.cpp \
tasks/cape42.cpp \
tasks/caps.cpp \
tasks/cardinalexpdetthreshold.cpp \
tasks/cardinalexpectationdetection.cpp \
tasks/cbir.cpp \
tasks/cecaq3.cpp \
tasks/cesd.cpp \
tasks/cesdr.cpp \
tasks/cgi.cpp \
tasks/cgii.cpp \
tasks/cgisch.cpp \
tasks/chit.cpp \
tasks/cia.cpp \
tasks/cisr.cpp \
tasks/ciwa.cpp \
tasks/contactlog.cpp \
tasks/copebrief.cpp \
tasks/core10.cpp \
tasks/cpftcovidmedical.cpp \
tasks/cpftlpsdischarge.cpp \
tasks/cpftlpsreferral.cpp \
tasks/cpftlpsresetresponseclock.cpp \
tasks/cpftresearchpreferences.cpp \
tasks/dad.cpp \
tasks/das28.cpp \
tasks/dast.cpp \
tasks/deakins1healthreview.cpp \
tasks/demoquestionnaire.cpp \
tasks/demqol.cpp \
tasks/demqolproxy.cpp \
tasks/diagnosisicd10.cpp \
tasks/diagnosisicd9cm.cpp \
tasks/distressthermometer.cpp \
tasks/edeq.cpp \
tasks/elixhauserci.cpp \
tasks/epds.cpp \
tasks/eq5d5l.cpp \
tasks/esspri.cpp \
tasks/factg.cpp \
tasks/fast.cpp \
tasks/fft.cpp \
tasks/frs.cpp \
tasks/gad7.cpp \
tasks/gaf.cpp \
tasks/gbogpc.cpp \
tasks/gbogras.cpp \
tasks/gbogres.cpp \
tasks/gds15.cpp \
tasks/gmcpq.cpp \
tasks/hads.cpp \
tasks/hadsrespondent.cpp \
tasks/hama.cpp \
tasks/hamd.cpp \
tasks/hamd7.cpp \
tasks/honos.cpp \
tasks/honos65.cpp \
tasks/honosca.cpp \
tasks/icd10depressive.cpp \
tasks/icd10manic.cpp \
tasks/icd10mixed.cpp \
tasks/icd10schizophrenia.cpp \
tasks/icd10schizotypal.cpp \
tasks/icd10specpd.cpp \
tasks/ided3d.cpp \
tasks/iesr.cpp \
tasks/ifs.cpp \
tasks/irac.cpp \
tasks/isaaq10.cpp \
tasks/isaaqed.cpp \
tasks/khandakerinsightmedical.cpp \
tasks/khandakermojomedical.cpp \
tasks/khandakermojomedicationtherapy.cpp \
tasks/khandakermojosociodemographics.cpp \
tasks/lynalliamlife.cpp \
tasks/lynalliammedical.cpp \
tasks/maas.cpp \
tasks/mast.cpp \
tasks/mdsupdrs.cpp \
tasks/mfi20.cpp \
tasks/miniace.cpp \
tasks/moca.cpp \
tasks/nart.cpp \
tasks/npiq.cpp \
tasks/ors.cpp \
tasks/panss.cpp \
tasks/paradise24.cpp \
tasks/patientsatisfaction.cpp \
tasks/pbq.cpp \
tasks/pcl5.cpp \
tasks/pclc.cpp \
tasks/pclm.cpp \
tasks/pcls.cpp \
tasks/pdss.cpp \
tasks/perinatalpoem.cpp \
tasks/photo.cpp \
tasks/photosequence.cpp \
tasks/phq15.cpp \
tasks/phq8.cpp \
tasks/phq9.cpp \
tasks/progressnote.cpp \
tasks/pswq.cpp \
tasks/psychiatricclerking.cpp \
tasks/qolbasic.cpp \
tasks/qolsg.cpp \
tasks/rand36.cpp \
tasks/rapid3.cpp \
tasks/referrersatisfactiongen.cpp \
tasks/referrersatisfactionspec.cpp \
tasks/sfmpq2.cpp \
tasks/shaps.cpp \
tasks/slums.cpp \
tasks/smast.cpp \
tasks/srs.cpp \
tasks/suppsp.cpp \
tasks/swemwbs.cpp \
tasks/wemwbs.cpp \
tasks/wsas.cpp \
tasks/ybocs.cpp \
tasks/ybocssc.cpp \
tasks/zbi12.cpp \
taskxtra/cardinalexpdetcommon.cpp \
taskxtra/cardinalexpdetrating.cpp \
taskxtra/cardinalexpdetthresholdtrial.cpp \
taskxtra/cardinalexpdettrial.cpp \
taskxtra/cardinalexpdettrialgroupspec.cpp \
taskxtra/diagnosisicd10item.cpp \
taskxtra/diagnosisicd9cmitem.cpp \
taskxtra/diagnosisitembase.cpp \
taskxtra/diagnosistaskbase.cpp \
taskxtra/gbocommon.cpp \
taskxtra/ided3dexemplars.cpp \
taskxtra/ided3dstage.cpp \
taskxtra/ided3dtrial.cpp \
taskxtra/isaaqcommon.cpp \
taskxtra/khandakermojomedicationitem.cpp \
taskxtra/khandakermojotherapyitem.cpp \
taskxtra/kirbyrewardpair.cpp \
taskxtra/kirbytrial.cpp \
taskxtra/pclcommon.cpp \
taskxtra/photosequencephoto.cpp \
taskxtra/satisfactioncommon.cpp \
version/camcopsversion.cpp \
whisker/whiskerapi.cpp \
whisker/whiskercallbackdefinition.cpp \
whisker/whiskercallbackhandler.cpp \
whisker/whiskerconnectionstate.cpp \
whisker/whiskerconstants.cpp \
whisker/whiskerdisplaycachewrapper.cpp \
whisker/whiskerinboundmessage.cpp \
whisker/whiskermanager.cpp \
whisker/whiskeroutboundcommand.cpp \
whisker/whiskerworker.cpp \
widgets/adjustablepie.cpp \
widgets/aspectratiopixmap.cpp \
widgets/basewidget.cpp \
widgets/booleanwidget.cpp \