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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
|
cmake_minimum_required (VERSION 3.12 FATAL_ERROR)
if (APPLE)
#
# The following variables define the portability and compatability attributes of the Mac macOS build
# they are choosen with care and should not be changed without good cause.
#
# Among other things these options are chosen to match the portability and compatability options of the
# Qt framework dylibs which can be checked as follows:
#
# otool -l <binary> | grep -A3 LC_VERSION_MIN_MACOSX
#
if (NOT CMAKE_OSX_SYSROOT)
execute_process (COMMAND xcrun --show-sdk-path
OUTPUT_VARIABLE _SDK_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE)
set (CMAKE_OSX_SYSROOT ${_SDK_PATH} CACHE STRING "Path to macOS SDK")
endif ()
# CI and release builds pass this explicitly. For local macOS builds, choose
# the default deployment target from the target architecture.
if (NOT CMAKE_OSX_DEPLOYMENT_TARGET)
if (DEFINED ENV{MACOSX_DEPLOYMENT_TARGET} AND NOT "$ENV{MACOSX_DEPLOYMENT_TARGET}" STREQUAL "")
set (_WSJTX_MACOS_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}")
else ()
set (_WSJTX_MACOS_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
if (NOT _WSJTX_MACOS_ARCHITECTURES)
execute_process (COMMAND uname -m
OUTPUT_VARIABLE _WSJTX_MACOS_ARCHITECTURES
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif ()
if (_WSJTX_MACOS_ARCHITECTURES MATCHES "(^|;)arm64($|;)")
set (_WSJTX_MACOS_DEPLOYMENT_TARGET 11.0)
else ()
set (_WSJTX_MACOS_DEPLOYMENT_TARGET 10.13)
endif ()
endif ()
set (CMAKE_OSX_DEPLOYMENT_TARGET "${_WSJTX_MACOS_DEPLOYMENT_TARGET}"
CACHE STRING "Earliest macOS version supported by the target architecture")
endif ()
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs")
endif (APPLE)
if(APPLE)
add_compile_definitions(FORTRAN_APPLE)
endif()
#
# CMake policies
#
if (POLICY CMP0020)
cmake_policy (SET CMP0020 NEW) # link to Qt winmain on Windows
endif ()
if (POLICY CMP0043)
cmake_policy (SET CMP0043 NEW) # ignore COMPILE_DEFINITIONS_<CONFIG>
endif ()
if (POLICY CMP0048)
cmake_policy (SET CMP0048 NEW) # clear PROJECT_Version_* variables if not set in project() command
endif ()
if (POLICY CMP0063)
cmake_policy (SET CMP0063 NEW) # honour visibility properties for all library types
endif ()
if (POLICY CMP0071)
cmake_policy (SET CMP0071 NEW) # run automoc and autouic on generated sources
endif ()
if (POLICY CMP0075)
cmake_policy (SET CMP0075 NEW) # honour CMAKE_REQUIRED_LIBRARIES in config checks
endif ()
include ("${CMAKE_CURRENT_LIST_DIR}/CMake/Modules/read_release_state.cmake")
set (wsjt_release_state_file "${CMAKE_CURRENT_LIST_DIR}/release-state.txt")
wsjt_read_release_state (
"${wsjt_release_state_file}"
WSJT_SOURCE_VERSION
WSJT_SOURCE_RELEASE_CHANNEL
WSJT_SOURCE_PRERELEASE_NUMBER
WSJT_ARCHIVE_SOURCE_REVISION)
set_property (DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${wsjt_release_state_file}")
project (wsjtx
VERSION ${WSJT_SOURCE_VERSION}.0
LANGUAGES C CXX Fortran
)
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (CMAKE_CXX_EXTENSIONS ON)
set (PROJECT_DESCRIPTION "WSJT-X: Digital Modes for Weak Signal Communications in Amateur Radio")
set (CMAKE_PROJECT_DESCRIPTION ${PROJECT_DESCRIPTION})
set (CMAKE_AUTOMOC OFF)
set (CMAKE_AUTOUIC OFF)
set (CMAKE_AUTORCC OFF)
function (wsjt_enable_qt_automoc target)
set_target_properties (${target} PROPERTIES AUTOMOC ON)
endfunction ()
# Align windres with the active MinGW gcc to prevent MSYS path mangling
if(MINGW)
# Derive windres.exe from the C compiler's directory (Qt MinGW toolchain)
get_filename_component(_CC_DIR "${CMAKE_C_COMPILER}" DIRECTORY)
find_program(WINDRES_EXECUTABLE NAMES windres.exe windres PATHS "${_CC_DIR}" NO_DEFAULT_PATH)
if(NOT WINDRES_EXECUTABLE)
# Fallback to normal PATH if not found beside gcc
find_program(WINDRES_EXECUTABLE NAMES windres.exe windres)
endif()
if(NOT WINDRES_EXECUTABLE)
message(FATAL_ERROR "windres not found; ensure MinGW bin dir is on PATH")
endif()
# Use MinGW windres directly; feed it forward-slash paths; avoid bash and MSYS gcc
set(CMAKE_RC_COMPILER "${WINDRES_EXECUTABLE}")
set(CMAKE_RC_COMPILE_OBJECT
"<CMAKE_COMMAND> -E env MSYS2_ARG_CONV_EXCL='*' \"<CMAKE_RC_COMPILER>\" -O coff <DEFINES> <INCLUDES> <FLAGS> \"<SOURCE>\" \"<OBJECT>\""
)
endif()
#
# Local CMake modules and support files
#
set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake/Modules ${CMAKE_MODULE_PATH})
set (PROJECT_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
if (NOT PROJECT_ARCHITECTURE)
# This is supposed to happen already on Windows
if (CMAKE_SIZEOF_VOID_P MATCHES 8)
set (PROJECT_ARCHITECTURE "x64")
else ()
set (PROJECT_ARCHITECTURE "$ENV{PROCESSOR_ARCHITECTURE}")
endif ()
endif ()
message (STATUS "******************************************************")
message (STATUS "Building for for: ${CMAKE_SYSTEM_NAME}-${PROJECT_ARCHITECTURE}")
message (STATUS "******************************************************")
include (set_build_type)
wsjt_set_release_channel_cache ("${WSJT_SOURCE_RELEASE_CHANNEL}" "${WSJT_SOURCE_PRERELEASE_NUMBER}")
set_build_type ()
set (wsjtx_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}${BUILD_TYPE_REVISION}")
set (wsjtx_PACKAGE_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}${BUILD_TYPE_PACKAGE_REVISION}")
#
# project information
#
set (PROJECT_BUNDLE_NAME "WSJT-X")
set (PROJECT_VENDOR "WSJT Development Group")
set (PROJECT_CONTACT "jtaylor@princeton.edu")
set (PROJECT_COPYRIGHT "Copyright (C) 2001-2026 by Joe Taylor, K1JT")
set (PROJECT_HOMEPAGE https://wsjtx.github.io/wsjtx/)
set (PROJECT_MANUAL wsjtx-main)
set (PROJECT_ONLINE_MANUAL_URL https://wsjtx.github.io/wsjtx/guide-full.html)
set (PROJECT_SAMPLES_URL https://wsjtx.github.io/wsjtx/)
# make sure that the default configuration is a RELEASE
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE RELEASE CACHE STRING
"Choose the type of build, options are: None Debug Release."
FORCE)
endif (NOT CMAKE_BUILD_TYPE)
if (CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]")
set (is_debug_build 1)
endif ()
# Uncomment locally to catch uses of Qt APIs deprecated through 5.15.
#add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050F00)
#
# Options & features
#
# Some of these directly effect compilation by being defined in
# wsjtx_config.h.in which makes them available to the C/C++
# pre-processor.
#
include (CMakeDependentOption)
# Allow the developer to select if Dynamic or Static libraries are built
OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
# Set the LIB_TYPE variable to STATIC
SET (LIB_TYPE STATIC)
wsjt_set_source_default_cache (WSJT_SOURCE_REVISION "${WSJT_ARCHIVE_SOURCE_REVISION}" "Source revision associated with this build")
if (WSJT_SOURCE_REVISION)
string (LENGTH "${WSJT_SOURCE_REVISION}" _WSJT_SOURCE_REVISION_LENGTH)
if (NOT WSJT_SOURCE_REVISION MATCHES "^[0-9a-fA-F]+$"
OR (NOT _WSJT_SOURCE_REVISION_LENGTH EQUAL 40
AND NOT _WSJT_SOURCE_REVISION_LENGTH EQUAL 64))
message (FATAL_ERROR "WSJT_SOURCE_REVISION must be a full Git object ID")
endif ()
string (TOLOWER "${WSJT_SOURCE_REVISION}" WSJT_SOURCE_REVISION)
endif ()
if (BUILD_SHARED_LIBS)
# User wants to build Dynamic Libraries, so change the LIB_TYPE variable to CMake keyword 'SHARED'
set (LIB_TYPE SHARED)
endif (BUILD_SHARED_LIBS)
option (UPDATE_TRANSLATIONS "Update source translation translations/*.ts
files (WARNING: make clean will delete the source .ts files! Danger!)")
option (WSJT_SHARED_RUNTIME "Debugging option that allows running from a shared Cloud directory.")
option (WSJT_QDEBUG_TO_FILE "Redirect Qt debuging messages to a trace file.")
option (WSJT_TRACE_CAT "Debugging option that turns on CAT diagnostics.")
option (WSJT_TRACE_CAT_POLLS "Debugging option that turns on CAT diagnostics during polling.")
option (WSJT_SOFT_KEYING "Apply a ramp to CW keying envelope to reduce transients." ON)
option (WSJT_SKIP_MANPAGES "Skip *nix manpage generation.")
option (WSJT_GENERATE_DOCS "Generate documentation files." ON)
option (WSJT_RIG_NONE_CAN_SPLIT "Allow split operation with \"None\" as rig.")
option (WSJT_TRACE_UDP "Debugging option that turns on UDP message protocol diagnostics.")
option (WSJT_BUILD_UTILS "Build simulators and code demonstrators." ON)
option (WSJT_FOX_OTP "Enable Fox OTP Verification Messages." ON)
option (WSJT_SKIP_BUNDLE_FIXUP "Skip install-time bundle dependency fixup." OFF)
option (WSJT_MACOS_INSTALL_TIME_FIXUP
"Run legacy install-time BundleUtilities fixup for macOS bundles." OFF)
option (WSJT_SKIP_QMAP "Skip building QMAP." OFF)
option (WSJT_ENABLE_TESTS "Enable developer tests." ON)
option (WSJT_ENABLE_GUI_SMOKE_TESTS
"Register GUI-driven smoke tests with CTest." OFF)
option (WSJT_ENABLE_ASAN_UBSAN "Instrument in-tree code with AddressSanitizer and UndefinedBehaviorSanitizer." OFF)
option (WSJT_ENABLE_TSAN "Instrument in-tree code with ThreadSanitizer." OFF)
option (WSJT_BUILD_JT9STREAM "Build the Qt-free streaming decoder jt9stream alongside jt9 (uses the jt9a stub)." ON)
set (WSJT_FORTRAN_LIBRARY_VARIANTS "AUTO" CACHE STRING
"Fortran library variants to build: AUTO, BOTH, OPENMP_ONLY, or NON_OPENMP_ONLY.")
set_property (CACHE WSJT_FORTRAN_LIBRARY_VARIANTS PROPERTY STRINGS
AUTO BOTH OPENMP_ONLY NON_OPENMP_ONLY)
CMAKE_DEPENDENT_OPTION (WSJT_QDEBUG_IN_RELEASE "Leave Qt debugging statements in Release configuration." OFF
"NOT is_debug_build" OFF)
CMAKE_DEPENDENT_OPTION (WSJT_ENABLE_EXPERIMENTAL_FEATURES "Enable features not fully ready for public releases." ON
is_debug_build OFF)
CMAKE_DEPENDENT_OPTION (WSJT_CREATE_WINMAIN
"The wsjtx target is normally built as GUI executable with a WinMain entry point on Windows,
if you want a console application instead then set this option to OFF.
If you just want to see the debug output from the application then the easiest way is to
attach a debugger which will then receive the console output inside its console." ON
"WIN32" OFF)
#
# install locations
#
if (APPLE)
set (CMAKE_INSTALL_BINDIR ${CMAKE_PROJECT_NAME}.app/Contents/MacOS)
set (CMAKE_INSTALL_DATAROOTDIR ${CMAKE_PROJECT_NAME}.app/Contents/Resources)
endif ()
include (GNUInstallDirs)
set (WSJT_DATA_DESTINATION "${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}")
set (PLUGIN_DESTINATION ${CMAKE_INSTALL_LIBDIR}/plugins)
set (QT_CONF_DESTINATION ${CMAKE_INSTALL_BINDIR})
if (WIN32)
set (PLUGIN_DESTINATION plugins)
elseif (APPLE)
set (PLUGIN_DESTINATION ${CMAKE_INSTALL_BINDIR}/../PlugIns)
set (QT_CONF_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR})
endif ()
set (WSJT_PLUGIN_DESTINATION ${PLUGIN_DESTINATION} CACHE PATH "Path for plugins")
set (WSJT_QT_CONF_DESTINATION ${QT_CONF_DESTINATION} CACHE PATH "Path for the qt.conf file")
if (WSJT_FOX_OTP)
set (wsjt_fox_CXXSRCS
)
message (STATUS "Including Fox verification code feature")
endif ()
if (WSJT_ENABLE_TESTS)
enable_testing ()
message (STATUS "Including tests")
endif()
# Fresh build trees have no timing history. Give stable tests taking roughly
# 10 seconds or longer a representative COST so parallel CTest runs start them
# early; relative ordering matters more than an exact duration.
if (WSJT_ENABLE_TSAN)
# A CTest ENVIRONMENT assignment replaces the inherited TSAN_OPTIONS. Build
# complete per-family suppression files from the cross-cutting baseline so
# scoped tests retain the same TSan controls and classified Hamlib/Boost
# suppressions as the rest of the suite.
set (wsjt_tsan_suppression_directory
"${CMAKE_BINARY_DIR}/tsan-suppressions")
file (MAKE_DIRECTORY "${wsjt_tsan_suppression_directory}")
file (READ "${CMAKE_SOURCE_DIR}/tests/sanitizers/tsan.supp"
wsjt_tsan_base_suppressions)
foreach (wsjt_tsan_scope IN ITEMS fortran network gui)
file (READ
"${CMAKE_SOURCE_DIR}/tests/sanitizers/tsan-${wsjt_tsan_scope}.supp"
wsjt_tsan_scope_suppressions)
file (GENERATE
OUTPUT "${wsjt_tsan_suppression_directory}/tsan-${wsjt_tsan_scope}.supp"
CONTENT "${wsjt_tsan_base_suppressions}\n${wsjt_tsan_scope_suppressions}")
set (wsjt_tsan_${wsjt_tsan_scope}_options
"halt_on_error=0:second_deadlock_stack=1:suppressions=${wsjt_tsan_suppression_directory}/tsan-${wsjt_tsan_scope}.supp")
endforeach ()
endif ()
include (CMake/Sources.cmake)
#
# decide on platform specifc packing and fixing up
#
if (APPLE)
set (WSJTX_BUNDLE_VERSION ${wsjtx_VERSION})
# make sure CMAKE_INSTALL_PREFIX ends in /
string (LENGTH "${CMAKE_INSTALL_PREFIX}" LEN)
math (EXPR LEN "${LEN} -1" )
string (SUBSTRING "${CMAKE_INSTALL_PREFIX}" ${LEN} 1 ENDCH)
if (NOT "${ENDCH}" STREQUAL "/")
set (CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/")
endif ()
endif (APPLE)
include (CMake/Dependencies.cmake)
include (CMake/CompilerFlags.cmake)
# project definitions
add_definitions (-DQT5 -DCMAKE_BUILD -DBIGSYM=1 -DBOOST_ALL_DYN_LINK)
if (CMAKE_HOST_UNIX)
add_definitions (-DUNIX)
elseif (CMAKE_HOST_WIN32)
add_definitions (-DWIN32)
endif ()
#
# sub-directories
#
if (EXISTS ${CMAKE_SOURCE_DIR}/samples AND IS_DIRECTORY ${CMAKE_SOURCE_DIR}/samples)
add_subdirectory (samples)
endif ()
if (WSJT_GENERATE_DOCS)
add_subdirectory (doc)
endif (WSJT_GENERATE_DOCS)
set (WSJT_OPENMP_FORTRAN_AVAILABLE FALSE)
set (WSJT_OPENMP_FORTRAN_FLAGS "")
# C/C++ OpenMP and Fortran OpenMP can resolve to different runtimes,
# especially on macOS where Apple Clang and GNU Fortran are mixed.
if (OpenMP_Fortran_FOUND)
set (WSJT_OPENMP_FORTRAN_AVAILABLE TRUE)
set (WSJT_OPENMP_FORTRAN_FLAGS "${OpenMP_Fortran_FLAGS}")
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
set (WSJT_OPENMP_FORTRAN_AVAILABLE TRUE)
set (WSJT_OPENMP_FORTRAN_FLAGS "-fopenmp")
endif ()
string (TOUPPER "${WSJT_FORTRAN_LIBRARY_VARIANTS}" WSJT_FORTRAN_LIBRARY_VARIANTS)
if (NOT WSJT_FORTRAN_LIBRARY_VARIANTS MATCHES "^(AUTO|BOTH|OPENMP_ONLY|NON_OPENMP_ONLY)$")
message (FATAL_ERROR
"WSJT_FORTRAN_LIBRARY_VARIANTS must be AUTO, BOTH, OPENMP_ONLY, or NON_OPENMP_ONLY")
endif ()
set (WSJT_EFFECTIVE_FORTRAN_LIBRARY_VARIANTS ${WSJT_FORTRAN_LIBRARY_VARIANTS})
if (WSJT_EFFECTIVE_FORTRAN_LIBRARY_VARIANTS STREQUAL "AUTO")
if (APPLE)
set (WSJT_EFFECTIVE_FORTRAN_LIBRARY_VARIANTS BOTH)
elseif (WSJT_OPENMP_FORTRAN_AVAILABLE)
set (WSJT_EFFECTIVE_FORTRAN_LIBRARY_VARIANTS BOTH)
else ()
set (WSJT_EFFECTIVE_FORTRAN_LIBRARY_VARIANTS NON_OPENMP_ONLY)
endif ()
endif ()
if (APPLE AND WSJT_EFFECTIVE_FORTRAN_LIBRARY_VARIANTS STREQUAL "OPENMP_ONLY")
# The macOS app links the non-OpenMP Fortran library while jt9 carries
# the GNU OpenMP runtime separately, so OPENMP_ONLY would change the
# runtime boundary that keeps Apple Clang libomp out of the bundle.
message (FATAL_ERROR "WSJT_FORTRAN_LIBRARY_VARIANTS=OPENMP_ONLY is not supported on macOS")
endif ()
if (WSJT_EFFECTIVE_FORTRAN_LIBRARY_VARIANTS MATCHES "^(BOTH|OPENMP_ONLY)$"
AND NOT WSJT_OPENMP_FORTRAN_AVAILABLE)
message (FATAL_ERROR
"WSJT_FORTRAN_LIBRARY_VARIANTS=${WSJT_FORTRAN_LIBRARY_VARIANTS} requires OpenMP support")
endif ()
set (WSJT_BUILD_FORTRAN_NON_OPENMP FALSE)
set (WSJT_BUILD_FORTRAN_OPENMP FALSE)
if (WSJT_EFFECTIVE_FORTRAN_LIBRARY_VARIANTS MATCHES "^(BOTH|NON_OPENMP_ONLY)$")
set (WSJT_BUILD_FORTRAN_NON_OPENMP TRUE)
endif ()
if (WSJT_EFFECTIVE_FORTRAN_LIBRARY_VARIANTS MATCHES "^(BOTH|OPENMP_ONLY)$")
set (WSJT_BUILD_FORTRAN_OPENMP TRUE)
endif ()
# The concrete Fortran library that non-app consumers (utilities, qmap_impl,
# m65impl, tests) should link. These consumers use the non-OpenMP library when
# it exists and the OpenMP one only when it is the single variant built.
# Consumers link the wsjt_fort_common interface target (created once both
# libraries exist) rather than naming this.
set (WSJT_COMMON_FORT_TARGET wsjt_fort)
if (WSJT_EFFECTIVE_FORTRAN_LIBRARY_VARIANTS STREQUAL "OPENMP_ONLY")
set (WSJT_COMMON_FORT_TARGET wsjt_fort_omp)
endif ()
message (STATUS "Fortran library variants: requested=${WSJT_FORTRAN_LIBRARY_VARIANTS}, effective=${WSJT_EFFECTIVE_FORTRAN_LIBRARY_VARIANTS}")
message (STATUS "Common Fortran target: ${WSJT_COMMON_FORT_TARGET}")
message (STATUS "QMAP: skip=${WSJT_SKIP_QMAP}")
# Internal usage requirements for targets whose own Fortran sources contain
# OpenMP directives. Static libraries keep the runtime dependency link-
# transitive without exporting the compile option to their consumers.
if (WSJT_OPENMP_FORTRAN_AVAILABLE)
add_library (wsjt_fortran_openmp INTERFACE)
if (TARGET OpenMP::OpenMP_Fortran AND NOT APPLE)
target_link_libraries (wsjt_fortran_openmp
INTERFACE OpenMP::OpenMP_Fortran)
elseif (WSJT_OPENMP_FORTRAN_FLAGS)
target_compile_options (wsjt_fortran_openmp INTERFACE
$<$<COMPILE_LANGUAGE:Fortran>:${WSJT_OPENMP_FORTRAN_FLAGS}>)
if (APPLE)
target_link_libraries (wsjt_fortran_openmp INTERFACE
"${WSJT_MACOS_LIBGOMP_LIBRARY}")
else ()
target_link_libraries (wsjt_fortran_openmp INTERFACE
${WSJT_OPENMP_FORTRAN_FLAGS})
endif ()
endif ()
endif ()
# build a library of package functionality (without and optionally with OpenMP support)
add_library (wsjt_cxx STATIC ${wsjt_CSRCS} ${wsjt_CXXSRCS})
target_link_libraries (wsjt_cxx Boost::log_setup ${LIBM_LIBRARIES})
if (UNIX)
include (CheckCXXSymbolExists)
check_cxx_symbol_exists (shm_open "sys/mman.h" WSJT_SHM_OPEN_IN_LIBC)
if (NOT WSJT_SHM_OPEN_IN_LIBC)
include (CheckLibraryExists)
check_library_exists (rt shm_open "" WSJT_SHM_OPEN_IN_LIBRT)
if (NOT WSJT_SHM_OPEN_IN_LIBRT)
message (FATAL_ERROR "POSIX shared memory requires shm_open in libc or librt")
endif ()
target_link_libraries (wsjt_cxx rt)
endif ()
endif ()
# build Fortran library routines without and optionally with OpenMP support
if (WSJT_BUILD_FORTRAN_NON_OPENMP)
set (WSJT_FORTRAN_MODULE_DIR ${CMAKE_BINARY_DIR}/fortran_modules)
file (MAKE_DIRECTORY ${WSJT_FORTRAN_MODULE_DIR})
add_library (wsjt_fort STATIC ${wsjt_FSRCS})
set_target_properties (wsjt_fort
PROPERTIES
Fortran_MODULE_DIRECTORY ${WSJT_FORTRAN_MODULE_DIR}
)
target_include_directories (wsjt_fort INTERFACE
$<BUILD_INTERFACE:${WSJT_FORTRAN_MODULE_DIR}>
)
target_link_libraries (wsjt_fort PUBLIC wsjt_cxx ${FFTW3_LIBRARIES})
endif ()
if (WSJT_BUILD_FORTRAN_OPENMP)
set (WSJT_FORTRAN_OPENMP_MODULE_DIR ${CMAKE_BINARY_DIR}/fortran_modules_omp)
file (MAKE_DIRECTORY ${WSJT_FORTRAN_OPENMP_MODULE_DIR})
add_library (wsjt_fort_omp STATIC ${wsjt_FSRCS})
set_target_properties (wsjt_fort_omp
PROPERTIES
Fortran_MODULE_DIRECTORY ${WSJT_FORTRAN_OPENMP_MODULE_DIR}
)
target_include_directories (wsjt_fort_omp INTERFACE
$<BUILD_INTERFACE:${WSJT_FORTRAN_OPENMP_MODULE_DIR}>
)
target_link_libraries (wsjt_fort_omp
PUBLIC wsjt_cxx ${FFTW3_LIBRARIES}
PRIVATE wsjt_fortran_openmp)
endif ()
# Naming a missing target in target_link_libraries does not fail at configure
# time — CMake passes -l<name> to the linker and the failure surfaces later as
# a cryptic link error. Fail loudly here instead, naming the cause.
if (NOT TARGET wsjt_fort AND NOT TARGET wsjt_fort_omp)
message (FATAL_ERROR
"No Fortran variant was built (WSJT_FORTRAN_LIBRARY_VARIANTS='${WSJT_FORTRAN_LIBRARY_VARIANTS}', "
"effective='${WSJT_EFFECTIVE_FORTRAN_LIBRARY_VARIANTS}'). This is an internal build "
"configuration error.")
endif ()
if (NOT TARGET ${WSJT_COMMON_FORT_TARGET})
message (FATAL_ERROR
"Selected common Fortran target '${WSJT_COMMON_FORT_TARGET}' was not built. "
"This is an internal build configuration error.")
endif ()
# Interface target for non-app consumers. The concrete Fortran archive carries
# its module path plus the C/C++ helper archive it calls into, preserving static
# link order without every consumer repeating wsjt_cxx.
add_library (wsjt_fort_common INTERFACE)
target_link_libraries (wsjt_fort_common INTERFACE ${WSJT_COMMON_FORT_TARGET})
function (wsjt_link_common_fortran tgt)
target_link_libraries (${tgt} PUBLIC wsjt_fort_common)
endfunction ()
function (wsjt_add_simulator_usage_test tgt usage_pattern)
if (WSJT_ENABLE_TESTS)
string (TOLOWER "${tgt}" test_target)
add_test (
NAME test_${test_target}_usage
COMMAND $<TARGET_FILE:${tgt}>
)
set_tests_properties (test_${test_target}_usage PROPERTIES
PASS_REGULAR_EXPRESSION "${usage_pattern}"
TIMEOUT 10
)
endif ()
endfunction ()
# Link the OpenMP Fortran variant onto an app target (jt9, wsjtx).
# Per-app stack/heap sizing stays at the call site.
function (wsjt_link_fortran_openmp tgt)
target_link_libraries (${tgt} wsjt_fort_omp)
set_target_properties (${tgt} PROPERTIES
Fortran_MODULE_DIRECTORY ${WSJT_FORTRAN_OPENMP_MODULE_DIR})
endfunction ()
if (WSJT_ENABLE_TESTS AND EXISTS ${CMAKE_SOURCE_DIR}/tests AND IS_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_subdirectory (tests)
endif ()
include (CMake/Utils.cmake)
add_executable (fmtave lib/fmtave.f90)
add_executable (fcal lib/fcal.f90)
add_executable (fmeasure lib/fmeasure.f90)
# build the wsprd WSPR mode decoder driver
generate_version_info (wsprd_VERSION_RESOURCES
NAME wsprd
BUNDLE ${PROJECT_BUNDLE_NAME}
ICON ${WSJTX_ICON_FILE}
FILE_DESCRIPTION "WSPR mode decoder"
)
# message(STATUS "RC compiler: ${CMAKE_RC_COMPILER}")
# message(STATUS "RC rule: ${CMAKE_RC_COMPILE_OBJECT}")
# message(STATUS "wsprd_VERSION_RESOURCES: ${wsprd_VERSION_RESOURCES}")
add_executable(wsprd
${wsprd_CSRCS}
lib/indexx.f90
lib/wsprd/osdwspr.f90
)
if(WIN32)
# Attach the generated rc file; the RC rule above will compile it
target_sources(wsprd PRIVATE ${wsprd_VERSION_RESOURCES})
endif()
target_include_directories (wsprd PRIVATE ${FFTW3_INCLUDE_DIRS})
target_link_libraries (wsprd ${FFTW3_LIBRARIES} ${LIBM_LIBRARIES})
include_directories (${CMAKE_CURRENT_BINARY_DIR})
# As moc files are generated in the binary dir, tell CMake to always
# look for includes there:
set (CMAKE_INCLUDE_CURRENT_DIR ON)
#
# source navigation
#
include (CMake/SourceNavigation.cmake)
# Qt i18n - always include the country generic if any regional variant is included
set (LANGUAGES
ca # Catalan
da # Danish
de # German
en # English (we need this to stop
# translation loaders loading the
# second preference UI languge, it
# doesn't need to be populated)
en_GB # English UK
es # Spanish
hu # Hungarian
it # Italian
ja # Japanese
#no # Norwegian
pl # Polish
#pt # Portuguese
ru # Russian
#sv # Swedish
uk # Ukrainian
zh # Chinese
zh_TW # Chinese traditional
)
foreach (lang_ ${LANGUAGES})
file (TO_NATIVE_PATH ${CMAKE_SOURCE_DIR}/translations/wsjtx_${lang_}.ts ts_)
list (APPEND TS_FILES ${ts_})
set (qt_translations_ "${QT_TRANSLATIONS_DIR}/qtbase_${lang_}.qm")
if (EXISTS "${qt_translations_}")
add_custom_command (
OUTPUT "${CMAKE_BINARY_DIR}/qt_${lang_}.qm"
COMMAND ${LCONVERT_EXECUTABLE} -o "${CMAKE_BINARY_DIR}/qt_${lang_}.qm" ${qt_translations_}
COMMENT "Building required Qt translations for language ${lang_}"
)
list (APPEND QM_FILES "${CMAKE_BINARY_DIR}/qt_${lang_}.qm")
endif ()
endforeach ()
if (UPDATE_TRANSLATIONS)
message (STATUS "UPDATE_TRANSLATIONS option is set.")
qt5_create_translation (
QM_FILES ${wsjt_qt_UISRCS} ${wsjtx_UISRCS} ${wsjt_qt_CXXSRCS} ${wsjtx_CXXSRCS}
${TS_FILES}
OPTIONS -I${CMAKE_CURRENT_SOURCE_DIR}
)
else ()
qt5_add_translation (QM_FILES ${TS_FILES})
endif ()
add_custom_target (translations DEPENDS ${QM_FILES})
set_property (DIRECTORY PROPERTY CLEAN_NO_CUSTOM TRUE)
# embedded resources
function (add_resources resources path)
foreach (resource_file_ ${ARGN})
get_filename_component (name_ ${resource_file_} NAME)
if (IS_ABSOLUTE "${resource_file_}")
file (TO_NATIVE_PATH ${resource_file_} source_)
else ()
file (TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${resource_file_} source_)
endif ()
file (TO_NATIVE_PATH ${path}/${name_} dest_)
set (resources_ "${resources_}\n <file alias=\"${dest_}\">${source_}</file>")
set (${resources} ${${resources}}${resources_} PARENT_SCOPE)
endforeach (resource_file_ ${ARGN})
endfunction (add_resources resources path)
add_resources (wsjtx_RESOURCES "" ${TOP_LEVEL_RESOURCES})
add_resources (wsjtx_RESOURCES /Palettes ${PALETTE_FILES})
add_resources (wsjtx_RESOURCES /Translations ${QM_FILES})
configure_file (wsjtx.qrc.in wsjtx.qrc @ONLY)
# UI generation
qt5_wrap_ui (wsjt_qt_GENUISRCS ${wsjt_qt_UISRCS})
qt5_wrap_ui (wsjtx_GENUISRCS ${wsjtx_UISRCS})
# Resource generation
qt5_add_resources (wsjtx_RESOURCES_RCC
${CMAKE_BINARY_DIR}/wsjtx.qrc
contrib/QDarkStyleSheet/qdarkstyle/style.qrc
)
# AX COM servers
if (WIN32)
include (QtAxMacros)
wrap_ax_server (GENAXSRCS ${AXSERVERSRCS})
endif (WIN32)
#
# targets dependent on Qt
#
# build a library for the QCustomPlot widget
add_library (qcp STATIC ${qcp_CXXSRCS})
wsjt_enable_qt_automoc (qcp)
target_include_directories (qcp PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/qcustomplot-source>)
target_link_libraries (qcp Qt5::Widgets Qt5::PrintSupport)
# build a library of package Qt functionality
add_library (wsjt_qt STATIC ${wsjt_qt_CXXSRCS} ${wsjt_qt_GENUISRCS} ${GENAXSRCS})
wsjt_enable_qt_automoc (wsjt_qt)
# set wsjtx_udp exports to static variants
target_compile_definitions (wsjt_qt PUBLIC UDP_STATIC_DEFINE)
target_link_libraries (wsjt_qt Hamlib::Hamlib Boost::log qcp Qt5::Widgets Qt5::Network Qt5::Multimedia Qt5::SerialPort Qt5::Sql Qt5::WebSockets Qt5::Concurrent)
if (WIN32)
target_link_libraries (wsjt_qt Qt5::AxContainer Qt5::AxBase)
endif (WIN32)
# build a library of WSJT Qt multimedia components
add_library (wsjt_qtmm STATIC ${wsjt_qtmm_CXXSRCS} ${wsjt_qtmm_GENUISRCS})
wsjt_enable_qt_automoc (wsjt_qtmm)
target_link_libraries (wsjt_qtmm Qt5::Multimedia)
# build the jt9 slow mode decoder driver
generate_version_info (jt9_VERSION_RESOURCES
NAME jt9
BUNDLE ${PROJECT_BUNDLE_NAME}
ICON ${WSJTX_ICON_FILE}
FILE_DESCRIPTION "jt9 - WSJT-X slow mode decoder"
)
add_executable (record_time_signal Audio/tools/record_time_signal.cpp)
wsjt_enable_qt_automoc (record_time_signal)
target_link_libraries (record_time_signal wsjt_cxx wsjt_qtmm wsjt_qt)
add_executable (jt9 ${jt9_FSRCS} ${jt9_VERSION_RESOURCES})
if (TARGET test_streaming_consumers)
add_dependencies (test_streaming_consumers jt9 wsprd)
endif ()
if (WSJT_BUILD_UTILS)
add_executable (ft8sim lib/ft8/ft8sim.f90 lib/print_version.c ${jt9_VERSION_RESOURCES})
wsjt_link_common_fortran (ft8sim)
wsjt_add_simulator_usage_test (ft8sim "Usage:[ ]+ft8sim")
endif ()
if (WSJT_ENABLE_TESTS)
add_test (NAME test_jt9_version COMMAND $<TARGET_FILE:jt9> --version)
string (REPLACE "." "\\." wsjtx_version_pattern "${wsjtx_VERSION}")
set_tests_properties (test_jt9_version PROPERTIES
PASS_REGULAR_EXPRESSION "^jt9 ${wsjtx_version_pattern} \\(revision ([0-9a-f]+(-dirty)?|unavailable)\\)"
)
add_test (NAME test_jt9_cli_validation
COMMAND ${CMAKE_COMMAND} -DJT9=$<TARGET_FILE:jt9>
-P ${CMAKE_SOURCE_DIR}/tests/unit/jt9/test_jt9_cli_validation.cmake)
find_package (Python3 COMPONENTS Interpreter QUIET)
if (Python3_Interpreter_FOUND)
add_test (NAME test_jt65_stream
COMMAND ${Python3_EXECUTABLE}
${CMAKE_SOURCE_DIR}/tests/integration/jt65/check_stream.py
$<TARGET_FILE:jt9>
${CMAKE_SOURCE_DIR}/test/wav_to_stream_harness.py
${CMAKE_BINARY_DIR}/tests/unit/decoder_engine/jt65-engine.wav
${CMAKE_BINARY_DIR}/Testing/Jt65Stream)
set_tests_properties (test_jt65_stream PROPERTIES
FIXTURES_REQUIRED jt65_engine_wav TIMEOUT 75 LABELS "decoder;jt65;integration")
endif ()
# Golden output is pinned to the required GNU/Linux x86-64 decoder path.
if (EXISTS "${CMAKE_SOURCE_DIR}/samples" AND CMAKE_SYSTEM_NAME STREQUAL "Linux" AND
CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64|AMD64)$")
# mode_args is one or more jt9 flags (e.g. -8, or --q65 -p 30 -f 1000 -d 3).
# $<SEMICOLON> protects the list separators through the single -DMODE=...
# COMMAND argument; compare_decoder_output.cmake expands ${MODE} unquoted
# so it splits back into separate jt9 arguments on the far side.
function (wsjt_add_jt9_golden_test test_name sample expected)
set (mode_args ${ARGN})
string (REPLACE ";" "$<SEMICOLON>" mode_args "${mode_args}")
set (work_dir "${CMAKE_BINARY_DIR}/Testing/Golden/${test_name}")
file (MAKE_DIRECTORY "${work_dir}")
add_test (NAME ${test_name}
COMMAND ${CMAKE_COMMAND}
-DJT9=$<TARGET_FILE:jt9>
"-DMODE=${mode_args}"
-DSAMPLE=${CMAKE_SOURCE_DIR}/${sample}
-DEXPECTED=${CMAKE_SOURCE_DIR}/${expected}
-DWORK_DIR=${work_dir}
-DSOURCE_DIR=${CMAKE_SOURCE_DIR}
-P ${CMAKE_SOURCE_DIR}/tests/integration/jt9/compare_decoder_output.cmake)
set_tests_properties (${test_name} PROPERTIES
LABELS "decoder;golden;integration"
TIMEOUT 120)
if (WSJT_ENABLE_TSAN)
set_tests_properties (${test_name} PROPERTIES
ENVIRONMENT "TSAN_OPTIONS=${wsjt_tsan_fortran_options}")
endif ()
endfunction ()
wsjt_add_jt9_golden_test (
test_jt9_golden_ft8_210703_133430
samples/FT8/210703_133430.wav
test/fixtures/ft8_210703_133430.expected.txt
-8)
if (WSJT_BUILD_FORTRAN_OPENMP)
function (wsjt_add_jt9_mtd_golden_test test_name processors mtd_workers
decode_cycles fft_threads)
set (options CONSECUTIVE_PERIODS)
set (one_value_args MY_CALL DX_CALL QSO_FREQUENCY QSO_PROGRESS)
cmake_parse_arguments (MTD_TEST "${options}" "${one_value_args}" "" ${ARGN})
set (work_dir "${CMAKE_BINARY_DIR}/Testing/Golden/${test_name}")
file (MAKE_DIRECTORY "${work_dir}")
add_test (NAME ${test_name}
COMMAND ${CMAKE_COMMAND}
-DJT9=$<TARGET_FILE:jt9>
-DSAMPLE=${CMAKE_SOURCE_DIR}/samples/FT8/210703_133430.wav
-DEXPECTED=${CMAKE_SOURCE_DIR}/test/fixtures/ft8_210703_133430_mtd.expected.txt
-DWORK_DIR=${work_dir}
-DSOURCE_DIR=${CMAKE_SOURCE_DIR}
-DMTD_WORKERS=${mtd_workers}
-DDECODE_CYCLES=${decode_cycles}
-DFFT_THREADS=${fft_threads}
-DCONSECUTIVE_PERIODS=${MTD_TEST_CONSECUTIVE_PERIODS}
-DMY_CALL=${MTD_TEST_MY_CALL}
-DDX_CALL=${MTD_TEST_DX_CALL}
-DQSO_FREQUENCY=${MTD_TEST_QSO_FREQUENCY}
-DQSO_PROGRESS=${MTD_TEST_QSO_PROGRESS}
-P ${CMAKE_SOURCE_DIR}/tests/integration/jt9/compare_mtd_messages.cmake)
set_tests_properties (${test_name} PROPERTIES
LABELS "decoder;golden;integration;mtd"
PROCESSORS ${processors}
TIMEOUT 120)
if (WSJT_ENABLE_TSAN)
set_tests_properties (${test_name} PROPERTIES
ENVIRONMENT "TSAN_OPTIONS=${wsjt_tsan_fortran_options}")
endif ()
endfunction ()
if (WSJT_ENABLE_TSAN)
# One decode cycle covers the same full sample and golden message set
# while keeping the instrumented two-worker synchronization bounded.
wsjt_add_jt9_mtd_golden_test (
test_jt9_mtd_ft8_210703_133430_tsan 2 2 1 1)
# Reusing the sample in one process carries decoded messages into the
# next period and exercises signal-directed and QSO-state concurrency.
wsjt_add_jt9_mtd_golden_test (
test_jt9_mtd_ft8_prior_period_qso_tsan 2 2 1 1
CONSECUTIVE_PERIODS
MY_CALL K1JT
DX_CALL HA0DU
QSO_FREQUENCY 590
QSO_PROGRESS 1)
set_tests_properties (test_jt9_mtd_ft8_prior_period_qso_tsan PROPERTIES
TIMEOUT 360)
else ()
wsjt_add_jt9_mtd_golden_test (
test_jt9_mtd_ft8_210703_133430 4 4 3 3)
# Keep the stateful path covered in ordinary OpenMP builds as well as
# sanitizer builds.
wsjt_add_jt9_mtd_golden_test (
test_jt9_mtd_ft8_prior_period_qso 4 4 1 1
CONSECUTIVE_PERIODS
MY_CALL K1JT
DX_CALL HA0DU
QSO_FREQUENCY 590
QSO_PROGRESS 1)
wsjt_add_jt9_mtd_golden_test (
test_jt9_mtd_ft8_210703_133430_limited_team 2 4 3 3)
# The -N 4 request requires at least three visible processors for this
# limit to reduce the runtime team.
set_tests_properties (test_jt9_mtd_ft8_210703_133430_limited_team PROPERTIES
ENVIRONMENT "OMP_THREAD_LIMIT=2")
endif ()
endif ()
wsjt_add_jt9_golden_test (
test_jt9_golden_jt9_130418_1742
samples/JT9/130418_1742.wav
test/fixtures/jt9_130418_1742.expected.txt
-9)
wsjt_add_jt9_golden_test (
test_jt9_golden_q65_30a_201203_024000
samples/Q65/30A_Ionoscatter_6m/201203_024000.wav
test/fixtures/q65_30a_201203_024000.expected.txt
--q65 -p 30 -f 1000 -d 3)
wsjt_add_jt9_golden_test (
test_jt9_golden_q65_300a_201210_0505
samples/Q65/300A_Optical_Scatter/201210_0505.wav
test/fixtures/q65_300a_201210_0505.expected.txt
--q65 -p 300 -f 1000 -d 3)
set_tests_properties (test_jt9_golden_q65_300a_201210_0505 PROPERTIES
COST 18)
wsjt_add_jt9_golden_test (
test_jt9_golden_q65_60d_201212_1838
samples/Q65/60D_EME_10GHz/201212_1838.wav
test/fixtures/q65_60d_201212_1838.expected.txt
--q65 -b D -p 60 -f 1000 -d 3)
wsjt_add_jt9_golden_test (
test_jt9_golden_msk144_181211_120800
samples/MSK144/181211_120800.wav
test/fixtures/msk144_181211_120800.expected.txt
--msk144 -p 15 -f 1500 -F 50 -d 3)
wsjt_add_jt9_golden_test (
test_jt9_golden_fst4_210115_0058
samples/FST4+FST4W/210115_0058.wav
test/fixtures/fst4_210115_0058.expected.txt
--fst4 -p 60 -f 1331 -L 1000 -H 1400 -d 3)
wsjt_add_jt9_golden_test (
test_jt9_golden_fst4w_201230_0300
samples/FST4+FST4W/201230_0300.wav
test/fixtures/fst4w_201230_0300.expected.txt
--fst4w -p 1800 -f 1433 -F 100 -d 3)
wsjt_add_jt9_golden_test (
test_jt9_golden_ft4_000000_000002
samples/FT4/000000_000002.wav
test/fixtures/ft4_000000_000002.expected.txt
--ft4 -d 3)
wsjt_add_jt9_golden_test (
test_jt9_golden_jt65_000000_0004
samples/JT65/JT65B/000000_0004.wav
test/fixtures/jt65_000000_0004.expected.txt
--jt65 -b B -f 1700 -d 3)
wsjt_add_jt9_golden_test (
test_jt9_golden_jt4_OK1KIR_141105_175700
samples/JT4/JT4F/OK1KIR_141105_175700.WAV
test/fixtures/jt4_OK1KIR_141105_175700.expected.txt
--jt4 -b F -f 1200 -d 3)
# WSPR decodes via the standalone wsprd binary, not jt9. -a isolates its
# writable side files (wspr_wisdom.dat, ALL_WSPR.TXT, wspr_spots.txt,
# wspr_timer.out, hashtable.txt) in the per-test work dir; confirmed this
# doesn't affect stdout.
function (wsjt_add_wsprd_golden_test test_name sample expected)
set (work_dir "${CMAKE_BINARY_DIR}/Testing/Golden/${test_name}")
file (MAKE_DIRECTORY "${work_dir}")
add_test (NAME ${test_name}
COMMAND ${CMAKE_COMMAND}
-DWSPRD=$<TARGET_FILE:wsprd>
-DSAMPLE=${CMAKE_SOURCE_DIR}/${sample}
-DEXPECTED=${CMAKE_SOURCE_DIR}/${expected}
-DWORK_DIR=${work_dir}
-P ${CMAKE_SOURCE_DIR}/tests/integration/wsprd/compare_wsprd_output.cmake)
set_tests_properties (${test_name} PROPERTIES
LABELS "decoder;golden;integration"
TIMEOUT 120)
endfunction ()
wsjt_add_wsprd_golden_test (
test_wsprd_golden_150426_0918
samples/WSPR/150426_0918.wav
test/fixtures/wspr_150426_0918.expected.txt)
# Source archives omit samples/ (export-ignore), so decoder tests need a checkout.
elseif (EXISTS "${CMAKE_SOURCE_DIR}/samples")
set (jt9_smoke_work_dir
"${CMAKE_BINARY_DIR}/Testing/Smoke/test_jt9_ft8_callback_smoke")
file (MAKE_DIRECTORY "${jt9_smoke_work_dir}")
add_test (NAME test_jt9_ft8_callback_smoke
COMMAND ${CMAKE_COMMAND}
-DJT9=$<TARGET_FILE:jt9>
-DSAMPLE=${CMAKE_SOURCE_DIR}/samples/FT8/210703_133430.wav
-DEXPECTED_MESSAGE=CQ\ F5RXL\ IN94
-DWORK_DIR=${jt9_smoke_work_dir}
-DSOURCE_DIR=${CMAKE_SOURCE_DIR}
-P ${CMAKE_SOURCE_DIR}/tests/integration/jt9/smoke_decoder_callback.cmake)
set_tests_properties (test_jt9_ft8_callback_smoke PROPERTIES
LABELS "decoder;ft8;integration"
TIMEOUT 120)
endif ()
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
set (WSJT_READELF "${CMAKE_READELF}")
if (NOT WSJT_READELF)
find_program (WSJT_READELF NAMES readelf llvm-readelf)
endif ()
if (NOT WSJT_READELF)
message (FATAL_ERROR
"readelf is required to verify that jt9 has a non-executable stack")
endif ()
add_test (NAME test_jt9_non_executable_stack
COMMAND ${CMAKE_COMMAND}
-DREADELF=${WSJT_READELF}
-DEXECUTABLE=$<TARGET_FILE:jt9>
-P ${CMAKE_SOURCE_DIR}/tests/integration/jt9/verify_elf_stack.cmake)
set_tests_properties (test_jt9_non_executable_stack PROPERTIES
LABELS "build;elf;security"
TIMEOUT 30)
endif ()
endif ()
if (WSJT_BUILD_FORTRAN_OPENMP)
wsjt_link_fortran_openmp (jt9)
target_link_libraries (jt9 wsjt_cxx)
if (WIN32)
set_property (TARGET jt9 APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,--stack,16777216")
endif ()
else ()
target_link_libraries (jt9 wsjt_fort wsjt_cxx)
endif ()
# Build jt9stream with shared-memory worker mode disabled.
if (WSJT_BUILD_JT9STREAM)
generate_version_info (jt9stream_VERSION_RESOURCES
NAME jt9stream
BUNDLE ${PROJECT_BUNDLE_NAME}
ICON ${WSJTX_ICON_FILE}
FILE_DESCRIPTION "jt9stream - WSJT-X Qt-free streaming decoder"
)
add_executable (jt9stream ${jt9stream_FSRCS} ${jt9stream_VERSION_RESOURCES})
target_compile_definitions (jt9stream PRIVATE JT9_PROGRAM_NAME=\"jt9stream\")
# jt9stream shares jt9's Fortran module directory (fortran_modules_omp) so it
# can READ the modules emitted by wsjt_fort_omp (streaming_emit, etc.). jt9.f90
# is a program and streaming_io.f90's jt9_stream is a bare subroutine, so this
# target emits no .mod of its own — sharing the dir is collision-free.
if (WSJT_BUILD_FORTRAN_OPENMP)
wsjt_link_fortran_openmp (jt9stream)
if (WIN32)
set_property (TARGET jt9stream APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,--stack,16777216")
endif ()
target_link_libraries (jt9stream wsjt_cxx)
else ()
target_link_libraries (jt9stream wsjt_fort wsjt_cxx)
endif ()
endif (WSJT_BUILD_JT9STREAM)
if (WSJT_ENABLE_TESTS AND (APPLE OR CMAKE_SYSTEM_NAME STREQUAL "Linux"))
if (APPLE)
find_program (WSJT_OTOOL NAMES otool)
set (wsjt_library_lister "${WSJT_OTOOL}")
else ()
set (wsjt_library_lister "${WSJT_READELF}")
endif ()
if (NOT wsjt_library_lister)
message (FATAL_ERROR "otool or readelf is required to verify the libraries programs load")
endif ()
foreach (program jt9stream ft4sim)
if (TARGET ${program})
add_test (NAME test_${program}_loads_only_used_libraries
COMMAND ${CMAKE_COMMAND}
-DLISTER=${wsjt_library_lister}
-DEXECUTABLE=$<TARGET_FILE:${program}>
-P ${CMAKE_SOURCE_DIR}/tests/integration/jt9/verify_loaded_libraries.cmake)
set_tests_properties (test_${program}_loads_only_used_libraries PROPERTIES
LABELS "build;linking"
TIMEOUT 30)
endif ()
endforeach ()
endif ()
find_package (Portaudio REQUIRED)
add_subdirectory (map65)
if (TARGET map65)
wsjt_enable_qt_automoc (map65)
endif ()
if (NOT WSJT_SKIP_QMAP)
add_subdirectory (qmap)
endif ()
if (TARGET qmap)
wsjt_enable_qt_automoc (qmap)
endif ()
# build the main application
generate_version_info (wsjtx_VERSION_RESOURCES
NAME wsjtx
BUNDLE ${PROJECT_BUNDLE_NAME}
ICON ${WSJTX_ICON_FILE}
FILE_DESCRIPTION "WSJT-X"
)
# Embed a Windows application manifest declaring per-monitor V2 DPI
# awareness. Without it, Windows treats wsjtx.exe as DPI-unaware and
# applies legacy bitmap-stretching scaling on high-DPI displays —
# fonts/widgets appear larger than locally-built (MSVC) executables
# which auto-embed a manifest. Resource ID 1, type RT_MANIFEST (24).
set (wsjtx_PLATFORM_RESOURCES)
if (WIN32)
set (WSJTX_MANIFEST_PATH "${CMAKE_CURRENT_SOURCE_DIR}/wsjtx.exe.manifest")
configure_file (
"${CMAKE_CURRENT_SOURCE_DIR}/CMake/Modules/wsjtx-manifest.rc.in"
"${CMAKE_CURRENT_BINARY_DIR}/wsjtx-manifest.rc"
@ONLY
)
list (APPEND wsjtx_PLATFORM_RESOURCES
"${CMAKE_CURRENT_BINARY_DIR}/wsjtx-manifest.rc")
endif (WIN32)
add_executable (wsjtx MACOSX_BUNDLE
${wsjtx_CXXSRCS}
${wsjtx_GENUISRCS}
${WSJTX_ICON_FILE}
${wsjtx_RESOURCES_RCC}
${wsjtx_VERSION_RESOURCES}
${wsjtx_PLATFORM_RESOURCES}
${wsjtx_BUNDLE_DATA_FILES}
)
wsjt_enable_qt_automoc (wsjtx)
if (WSJT_ENABLE_TESTS)
target_compile_definitions (wsjtx PRIVATE WSJT_ENABLE_LIVE_AUDIO_TEST=1)
endif ()
if (APPLE)
add_custom_command(
TARGET wsjtx
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_BINARY_DIR}/jt9"
"$<TARGET_FILE_DIR:wsjtx>"
COMMENT "Copying $<TARGET_FILE_DIR:jt9> into the Contents/MacOS/ directory"
)
endif (APPLE)
if (WSJT_CREATE_WINMAIN)
set_target_properties (wsjtx PROPERTIES WIN32_EXECUTABLE ON)
endif (WSJT_CREATE_WINMAIN)
set_target_properties (wsjtx PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Darwin/Info.plist.in"
MACOSX_BUNDLE_INFO_STRING "${PROJECT_DESCRIPTION}"
MACOSX_BUNDLE_ICON_FILE "${WSJTX_ICON_FILE}"
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}
MACOSX_BUNDLE_SHORT_VERSION_STRING "v${wsjtx_VERSION}"
MACOSX_BUNDLE_LONG_VERSION_STRING "Version ${wsjtx_VERSION}"
MACOSX_BUNDLE_BUNDLE_NAME "${PROJECT_BUNDLE_NAME}"
MACOSX_BUNDLE_BUNDLE_EXECUTABLE_NAME "${PROJECT_NAME}"
MACOSX_BUNDLE_COPYRIGHT "${PROJECT_COPYRIGHT}"
MACOSX_BUNDLE_GUI_IDENTIFIER "org.k1jt.wsjtx"
)
target_include_directories (wsjtx PRIVATE ${FFTW3_INCLUDE_DIRS})
# On macOS the app links the non-OpenMP variant while jt9 carries the GNU
# OpenMP runtime separately; this keeps Apple Clang libomp out of the bundle.
if ((NOT WSJT_BUILD_FORTRAN_OPENMP) OR APPLE)
target_link_libraries (wsjtx wsjt_fort)
else ()
wsjt_link_fortran_openmp (wsjtx)
if (WIN32)
set_property (TARGET wsjtx APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,--stack,0x1000000,--heap,0x20000000")
endif ()
endif ()
target_link_libraries (wsjtx Qt5::SerialPort Qt5::Network wsjt_cxx wsjt_qt wsjt_qtmm ${FFTW3_LIBRARIES} ${LIBM_LIBRARIES})
if (WSJT_ENABLE_TSAN)
target_compile_definitions (wsjtx PRIVATE WSJT_TSAN_TEST_PROFILE)
endif ()
if (WSJT_ENABLE_TESTS AND NOT WIN32)
set (wsjtx_startup_test_root
"${CMAKE_BINARY_DIR}/Testing/Startup/test_wsjtx_startup")
file (MAKE_DIRECTORY
"${wsjtx_startup_test_root}/config"
"${wsjtx_startup_test_root}/data"
"${wsjtx_startup_test_root}/cache"
"${wsjtx_startup_test_root}/tmp")
set (wsjtx_startup_test_environment
"XDG_CONFIG_HOME=${wsjtx_startup_test_root}/config"
"XDG_DATA_HOME=${wsjtx_startup_test_root}/data"
"XDG_CACHE_HOME=${wsjtx_startup_test_root}/cache"
"WSJT_QMAP_SHARED_MEMORY_KEY=mem_qmap-test_wsjtx_startup")
if (NOT APPLE)
list (APPEND wsjtx_startup_test_environment
"TMPDIR=${wsjtx_startup_test_root}/tmp")
endif ()
if (APPLE)
add_test (
NAME test_wsjtx_startup
COMMAND /bin/bash "${CMAKE_SOURCE_DIR}/test/run-wsjtx-startup-macos.sh"
"${CMAKE_BINARY_DIR}/startup-smoke-diagnostics"
"$<TARGET_FILE:wsjtx>" --startup-smoke-test --rig-name CTEST-STARTUP
)
set (wsjtx_startup_test_timeout 45)
else ()
add_test (
NAME test_wsjtx_startup
COMMAND $<TARGET_FILE:wsjtx> --startup-smoke-test --rig-name CTEST-STARTUP
)
set (wsjtx_startup_test_timeout 20)
endif ()
set_tests_properties (test_wsjtx_startup PROPERTIES
ENVIRONMENT "${wsjtx_startup_test_environment}"
PROCESSORS 1
TIMEOUT ${wsjtx_startup_test_timeout}
)
if (WSJT_ENABLE_TSAN)
set_tests_properties (test_wsjtx_startup PROPERTIES
ENVIRONMENT "TSAN_OPTIONS=${wsjt_tsan_gui_options}")
endif ()
endif ()
if (WSJT_ENABLE_TESTS AND WSJT_ENABLE_GUI_SMOKE_TESTS
AND WSJT_BUILD_FORTRAN_OPENMP
AND (APPLE OR
(CMAKE_SYSTEM_NAME STREQUAL "Linux"
AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64|AMD64)$")))
# Keep GUI concurrency within the macOS CI pool's three-instance capacity.
set (wsjtx_live_audio_test_root
"${CMAKE_BINARY_DIR}/Testing/LiveAudio/test_wsjtx_live_audio_ft8")
file (MAKE_DIRECTORY
"${wsjtx_live_audio_test_root}/config"
"${wsjtx_live_audio_test_root}/data"
"${wsjtx_live_audio_test_root}/cache"
"${wsjtx_live_audio_test_root}/tmp")
set (wsjtx_live_audio_test_environment
"XDG_CONFIG_HOME=${wsjtx_live_audio_test_root}/config"
"XDG_DATA_HOME=${wsjtx_live_audio_test_root}/data"
"XDG_CACHE_HOME=${wsjtx_live_audio_test_root}/cache"
"WSJT_QMAP_SHARED_MEMORY_KEY=mem_qmap-test_wsjtx_live_audio_ft8")
if (NOT APPLE)
list (APPEND wsjtx_live_audio_test_environment
"TMPDIR=${wsjtx_live_audio_test_root}/tmp")
endif ()
if (WSJT_ENABLE_TSAN)
list (APPEND wsjtx_live_audio_test_environment
"TSAN_OPTIONS=${wsjt_tsan_gui_options}")
endif ()
add_test (
NAME test_wsjtx_live_audio_ft8
COMMAND $<TARGET_FILE:wsjtx>
--live-audio-test
"${CMAKE_SOURCE_DIR}/samples/FT8/210703_133430.wav"
--live-audio-expected
"${CMAKE_SOURCE_DIR}/test/fixtures/ft8_210703_133430_mtd.expected.txt"
--live-audio-data-dir
"${CMAKE_SOURCE_DIR}"
--rig-name CTEST-LIVE-AUDIO)
set_tests_properties (test_wsjtx_live_audio_ft8 PROPERTIES
COST 25
ENVIRONMENT "${wsjtx_live_audio_test_environment}"
LABELS "gui;audio;decoder;integration"
PROCESSORS 1
TIMEOUT 120)
set (wsjtx_receive_handoff_test_root
"${CMAKE_BINARY_DIR}/Testing/LiveAudio/test_wsjtx_receive_handoff")
file (MAKE_DIRECTORY
"${wsjtx_receive_handoff_test_root}/config"
"${wsjtx_receive_handoff_test_root}/data"
"${wsjtx_receive_handoff_test_root}/cache"
"${wsjtx_receive_handoff_test_root}/tmp")
set (wsjtx_receive_handoff_test_environment
"XDG_CONFIG_HOME=${wsjtx_receive_handoff_test_root}/config"
"XDG_DATA_HOME=${wsjtx_receive_handoff_test_root}/data"
"XDG_CACHE_HOME=${wsjtx_receive_handoff_test_root}/cache"
"WSJT_QMAP_SHARED_MEMORY_KEY=mem_qmap-test_wsjtx_receive_handoff")
if (NOT APPLE)
list (APPEND wsjtx_receive_handoff_test_environment
"TMPDIR=${wsjtx_receive_handoff_test_root}/tmp")
endif ()
if (WSJT_ENABLE_TSAN)
list (APPEND wsjtx_receive_handoff_test_environment
"TSAN_OPTIONS=${wsjt_tsan_gui_options}")
endif ()
add_test (
NAME test_wsjtx_receive_handoff
COMMAND $<TARGET_FILE:wsjtx>
--receive-handoff-test
--rig-name CTEST-RECEIVE-HANDOFF)
set_tests_properties (test_wsjtx_receive_handoff PROPERTIES
ENVIRONMENT "${wsjtx_receive_handoff_test_environment}"
LABELS "gui;audio;integration;receive-handoff"
PROCESSORS 1
TIMEOUT 30)
set (wsjtx_ft8_tx_loopback_test_root
"${CMAKE_BINARY_DIR}/Testing/LiveAudio/test_wsjtx_ft8_tx_loopback")
add_test (
NAME test_wsjtx_ft8_tx_loopback
COMMAND ${CMAKE_COMMAND}
"-DWSJTX=$<TARGET_FILE:wsjtx>"
"-DWORK_DIR=${wsjtx_ft8_tx_loopback_test_root}"
"-DEXPECTED=${CMAKE_SOURCE_DIR}/tests/integration/ft8/tx_loopback.expected.txt"
"-DDATA_DIR=${CMAKE_SOURCE_DIR}"
-P ${CMAKE_SOURCE_DIR}/tests/integration/ft8/run_tx_loopback.cmake)
set_tests_properties (test_wsjtx_ft8_tx_loopback PROPERTIES
COST 43
LABELS "gui;audio;decoder;ft8;integration"
PROCESSORS 2
TIMEOUT 150)
if (WSJT_ENABLE_TSAN)
set_tests_properties (
test_wsjtx_ft8_tx_loopback
PROPERTIES ENVIRONMENT "TSAN_OPTIONS=${wsjt_tsan_gui_options}")
endif ()
endif ()
if (WSJT_ENABLE_TESTS AND WSJT_ENABLE_GUI_SMOKE_TESTS
AND WSJT_BUILD_FORTRAN_OPENMP
AND (APPLE OR WIN32 OR
(CMAKE_SYSTEM_NAME STREQUAL "Linux"
AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64|AMD64)$")))
add_dependencies (wsjtx sjtty)
add_test (
NAME test_wsjtx_jt9_wav
COMMAND ${CMAKE_COMMAND}
"-DWSJTX=$<TARGET_FILE:wsjtx>"
"-DSAMPLE=${CMAKE_SOURCE_DIR}/samples/JT9/130418_1742.wav"
"-DEXPECTED_MESSAGE=JA1KAU PD0JAC -23"
"-DWORK_DIR=${CMAKE_BINARY_DIR}/Testing/Jt9Wav"
-P ${CMAKE_SOURCE_DIR}/tests/integration/decoder_engine/run_wav_gui.cmake)
set_tests_properties (test_wsjtx_jt9_wav PROPERTIES
LABELS "gui;decoder;jt9;integration"
PROCESSORS 1
TIMEOUT 90)
add_test (
NAME test_wsjtx_jt4_wav
COMMAND ${CMAKE_COMMAND}
"-DWSJTX=$<TARGET_FILE:wsjtx>"
"-DMODE=JT4"
"-DSAMPLE=${CMAKE_BINARY_DIR}/tests/unit/decoder_engine/jt4-engine.wav"
"-DEXPECTED_MESSAGE=K1ABC W9XYZ FN42"
"-DWORK_DIR=${CMAKE_BINARY_DIR}/Testing/Jt4Wav"
-P ${CMAKE_SOURCE_DIR}/tests/integration/decoder_engine/run_wav_gui.cmake)
set_tests_properties (test_wsjtx_jt4_wav PROPERTIES
FIXTURES_REQUIRED jt4_engine_wav
LABELS "gui;decoder;jt4;integration"
PROCESSORS 1
TIMEOUT 90)
add_test (
NAME test_wsjtx_jt65_wav
COMMAND ${CMAKE_COMMAND}
"-DWSJTX=$<TARGET_FILE:wsjtx>"
"-DMODE=JT65"
"-DSAMPLE=${CMAKE_BINARY_DIR}/tests/unit/decoder_engine/jt65-engine.wav"
"-DEXPECTED_MESSAGE=K1ABC W9XYZ FN42"
"-DWORK_DIR=${CMAKE_BINARY_DIR}/Testing/Jt65Wav"
-P ${CMAKE_SOURCE_DIR}/tests/integration/decoder_engine/run_wav_gui.cmake)
set_tests_properties (test_wsjtx_jt65_wav PROPERTIES
FIXTURES_REQUIRED jt65_engine_wav
LABELS "gui;decoder;jt65;integration"
PROCESSORS 1
TIMEOUT 90)
add_test (
NAME test_wsjtx_q65_wav
COMMAND ${CMAKE_COMMAND}
"-DWSJTX=$<TARGET_FILE:wsjtx>"
"-DMODE=Q65"
"-DSAMPLE=${CMAKE_BINARY_DIR}/tests/unit/decoder_engine/261003_001500.wav"
"-DEXPECTED_MESSAGE=K1ABC W9XYZ FN42"
"-DWORK_DIR=${CMAKE_BINARY_DIR}/Testing/Q65Wav"
-P ${CMAKE_SOURCE_DIR}/tests/integration/decoder_engine/run_wav_gui.cmake)
set_tests_properties (test_wsjtx_q65_wav PROPERTIES
FIXTURES_REQUIRED q65_engine_60s_wav
LABELS "gui;decoder;q65;integration"
PROCESSORS 1
TIMEOUT 90)
foreach (fst4_mode FST4 FST4W)
string (TOLOWER "${fst4_mode}" fst4_mode_lower)
if (fst4_mode STREQUAL "FST4")
set (fst4_message "K1ABC W9XYZ FN42")
else ()
set (fst4_message "K1ABC FN42 37")
endif ()
add_test (
NAME test_wsjtx_${fst4_mode_lower}_wav
COMMAND ${CMAKE_COMMAND}
"-DWSJTX=$<TARGET_FILE:wsjtx>"
"-DMODE=${fst4_mode}"
"-DSAMPLE=${CMAKE_BINARY_DIR}/tests/unit/decoder_engine/${fst4_mode_lower}-engine.wav"
"-DEXPECTED_MESSAGE=${fst4_message}"
"-DWORK_DIR=${CMAKE_BINARY_DIR}/Testing/${fst4_mode}Wav"
-P ${CMAKE_SOURCE_DIR}/tests/integration/decoder_engine/run_wav_gui.cmake)
set_tests_properties (test_wsjtx_${fst4_mode_lower}_wav PROPERTIES
FIXTURES_REQUIRED ${fst4_mode_lower}_engine_wav
LABELS "gui;decoder;${fst4_mode_lower};integration"
PROCESSORS 1
TIMEOUT 390)
endforeach ()
if (WSJT_ENABLE_TSAN)
set_tests_properties (test_wsjtx_jt4_wav test_wsjtx_jt9_wav test_wsjtx_jt65_wav test_wsjtx_q65_wav
test_wsjtx_fst4_wav test_wsjtx_fst4w_wav PROPERTIES
ENVIRONMENT "TSAN_OPTIONS=${wsjt_tsan_gui_options}")
endif ()
set (live_test "test_wsjtx_live_audio_jtty")
set (loopback_test "test_wsjtx_jtty_tx_loopback")
set (wsjtx_jtty_tests ${live_test} ${loopback_test})
add_test (
NAME ${live_test}
COMMAND ${CMAKE_COMMAND}
"-DSJTTY=$<TARGET_FILE:sjtty>"
"-DWSJTX=$<TARGET_FILE:wsjtx>"
"-DWORK_DIR=${CMAKE_BINARY_DIR}/Testing/LiveAudio/${live_test}"
"-DTEST_ID=${live_test}"
"-DAUDIO_SPEED=4"
"-DEXPECTED=${CMAKE_SOURCE_DIR}/tests/integration/jtty/live_audio.expected.txt"
-P ${CMAKE_SOURCE_DIR}/tests/integration/jtty/run_live_audio.cmake)
set_tests_properties (${live_test} PROPERTIES
COST 21
LABELS "gui;audio;jtty;integration;accelerated"
PROCESSORS 1
TIMEOUT 120)
add_test (
NAME ${loopback_test}
COMMAND ${CMAKE_COMMAND}
"-DWSJTX=$<TARGET_FILE:wsjtx>"
"-DWORK_DIR=${CMAKE_BINARY_DIR}/Testing/LiveAudio/${loopback_test}"
"-DTEST_ID=${loopback_test}"
"-DAUDIO_SPEED=4"
"-DEXPECTED=${CMAKE_SOURCE_DIR}/tests/integration/jtty/tx_loopback.expected.txt"
-P ${CMAKE_SOURCE_DIR}/tests/integration/jtty/run_tx_loopback.cmake)
set_tests_properties (${loopback_test} PROPERTIES
COST 37
LABELS "gui;audio;jtty;integration;accelerated"
PROCESSORS 1
TIMEOUT 600)
if (WSJT_ENABLE_TSAN)
set_tests_properties (
${wsjtx_jtty_tests}
PROPERTIES ENVIRONMENT "TSAN_OPTIONS=${wsjt_tsan_gui_options}")
endif ()
endif ()
# These GUI tests read samples/, which source archives omit.
if (NOT EXISTS "${CMAKE_SOURCE_DIR}/samples")
foreach (sample_test test_wsjtx_live_audio_ft8 test_wsjtx_jt9_wav)
if (TEST ${sample_test})
set_tests_properties (${sample_test} PROPERTIES DISABLED TRUE)
endif ()
endforeach ()
endif ()
# make a library for WSJT-X UDP servers
# add_library (wsjtx_udp SHARED ${UDP_library_CXXSRCS})
add_library (wsjtx_udp-static STATIC ${UDP_library_CXXSRCS})
wsjt_enable_qt_automoc (wsjtx_udp-static)
#target_include_directories (wsjtx_udp
# INTERFACE
# $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/wsjtx>
# )
target_include_directories (wsjtx_udp-static
INTERFACE
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/wsjtx>
)
#set_target_properties (wsjtx_udp PROPERTIES
# PUBLIC_HEADER "${UDP_library_HEADERS}"
# )
set_target_properties (wsjtx_udp-static PROPERTIES
OUTPUT_NAME wsjtx_udp
)
target_compile_definitions (wsjtx_udp-static PUBLIC UDP_STATIC_DEFINE)
target_link_libraries (wsjtx_udp-static Qt5::Network Qt5::Gui)
generate_export_header (wsjtx_udp-static BASE_NAME udp)
generate_version_info (udp_daemon_VERSION_RESOURCES
NAME udp_daemon
BUNDLE ${PROJECT_BUNDLE_NAME}
ICON ${WSJTX_ICON_FILE}
FILE_DESCRIPTION "Example WSJT-X UDP Message Protocol daemon"
)
add_executable (udp_daemon UDPExamples/UDPDaemon.cpp ${udp_daemon_VERSION_RESOURCES})
wsjt_enable_qt_automoc (udp_daemon)
target_link_libraries (udp_daemon wsjtx_udp-static)
generate_version_info (wsjtx_app_version_VERSION_RESOURCES
NAME wsjtx_app_version
BUNDLE ${PROJECT_BUNDLE_NAME}
ICON ${WSJTX_ICON_FILE}
FILE_DESCRIPTION "Display WSJT-X Application Version on console"
)
add_executable (wsjtx_app_version AppVersion/AppVersion.cpp ${wsjtx_app_version_VERSION_RESOURCES})
target_link_libraries (wsjtx_app_version wsjt_qt)
generate_version_info (message_aggregator_VERSION_RESOURCES
NAME message_aggregator
BUNDLE ${PROJECT_BUNDLE_NAME}
ICON ${WSJTX_ICON_FILE}
FILE_DESCRIPTION "Example WSJT-X UDP Message Protocol application"
)
add_resources (message_aggregator_RESOURCES /qss ${message_aggregator_STYLESHEETS})
configure_file (UDPExamples/message_aggregator.qrc.in message_aggregator.qrc @ONLY)
qt5_add_resources (message_aggregator_RESOURCES_RCC
${CMAKE_CURRENT_BINARY_DIR}/message_aggregator.qrc
contrib/QDarkStyleSheet/qdarkstyle/style.qrc
)
add_executable (message_aggregator
${message_aggregator_CXXSRCS}
${message_aggregator_RESOURCES_RCC}
${message_aggregator_VERSION_RESOURCES}
)
wsjt_enable_qt_automoc (message_aggregator)
target_link_libraries (message_aggregator wsjt_qt Qt5::Widgets wsjtx_udp-static)
if (WSJT_CREATE_WINMAIN)
set_target_properties (message_aggregator PROPERTIES WIN32_EXECUTABLE ON)
endif (WSJT_CREATE_WINMAIN)
if (UNIX)
if (NOT WSJT_SKIP_MANPAGES)
add_subdirectory (manpages)
add_dependencies (wsjtx manpages)
endif (NOT WSJT_SKIP_MANPAGES)
if (NOT APPLE)
add_subdirectory (debian)
add_dependencies (wsjtx debian)
endif (NOT APPLE)
endif (UNIX)
include (CMake/Install.cmake)
find_package (Git QUIET)
# Without SOURCE_DATE_EPOCH or Git the expiry is fixed at configure time,
# so a later install does not rebuild main.cpp.
string (TIMESTAMP wsjtx_CONFIGURE_EPOCH "%s" UTC)
# creates or updates ${PROJECT_BINARY_DIR}/scs_version.h and
# prerelease_expiry.h using cmake scripts
add_custom_target (revisiontag
COMMAND ${CMAKE_COMMAND}
-D SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
-D BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}
-D OUTPUT_DIR=${PROJECT_BINARY_DIR}
-D SOURCE_REVISION=${WSJT_SOURCE_REVISION}
-P ${CMAKE_CURRENT_SOURCE_DIR}/CMake/getsvn.cmake
COMMAND ${CMAKE_COMMAND}
-D CHANNEL=${WSJT_RELEASE_CHANNEL}
-D SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
-D OUTPUT_DIR=${PROJECT_BINARY_DIR}
-D GIT_EXECUTABLE=${GIT_EXECUTABLE}
-D CONFIGURE_EPOCH=${wsjtx_CONFIGURE_EPOCH}
-P ${CMAKE_CURRENT_SOURCE_DIR}/CMake/prerelease_expiry.cmake
VERBATIM
BYPRODUCTS scs_version.h prerelease_expiry.h
COMMENT "Getting source control system revision and prerelease expiry information"
)
# explicitly say that the wsjt_qt depends on custom target, this is
# done indirectly so that the revisiontag target gets built exactly
# once per build
add_dependencies (wsjt_qt revisiontag)
add_dependencies (wsjtx revisiontag)
add_dependencies (jt9 revisiontag)
add_dependencies (wsprd revisiontag)
#
# versioning and configuration
#
configure_file (
"${CMAKE_CURRENT_SOURCE_DIR}/wsjtx_config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/wsjtx_config.h"
)
if (NOT WIN32 AND NOT APPLE)
# install a desktop file so wsjtx appears in the application start
# menu with an icon
install (
FILES wsjtx.desktop message_aggregator.desktop
DESTINATION share/applications
#COMPONENT runtime
)
install (
FILES icons/Unix/wsjtx_icon.png
DESTINATION share/pixmaps
#COMPONENT runtime
)
endif (NOT WIN32 AND NOT APPLE)
if (APPLE)
set (CMAKE_POSTFLIGHT_SCRIPT
"${wsjtx_BINARY_DIR}/postflight.sh")
set (CMAKE_POSTUPGRADE_SCRIPT
"${wsjtx_BINARY_DIR}/postupgrade.sh")
configure_file ("${wsjtx_SOURCE_DIR}/Darwin/postflight.sh.in"
"${CMAKE_POSTFLIGHT_SCRIPT}")
configure_file ("${wsjtx_SOURCE_DIR}/Darwin/postupgrade.sh.in"
"${CMAKE_POSTUPGRADE_SCRIPT}")
add_custom_command(
TARGET wsjtx POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
$<TARGET_FILE:jt9>
$<TARGET_BUNDLE_CONTENT_DIR:wsjtx>/MacOS/
COMMENT "Copying jt9 into WSJT-X bundle"
)
endif ()
set (wsjt_enable_bundle_fixup FALSE)
if (NOT is_debug_build)
if (WIN32 AND NOT WSJT_SKIP_BUNDLE_FIXUP)
set (wsjt_enable_bundle_fixup TRUE)
elseif (APPLE AND WSJT_MACOS_INSTALL_TIME_FIXUP AND NOT WSJT_SKIP_BUNDLE_FIXUP)
set (wsjt_enable_bundle_fixup TRUE)
endif ()
endif ()
if (wsjt_enable_bundle_fixup)
# add this sub-sirectory after all install steps and other
# sub-directories to ensure that all executables are in-place before
# any fixup is done
add_subdirectory (bundle_fixup)
endif ()
#
# packaging
#
set (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/package_description.txt")
set (CPACK_MONOLITHIC_INSTALL 1)
set (CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
set (CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set (CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set (CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}${BUILD_TYPE_REVISION}")
if (WIN32)
set (CPACK_GENERATOR "NSIS")
elseif (APPLE)
set (CPACK_GENERATOR "DragNDrop")
else ()
find_program (DPKG_BUILDER dpkg-buildpackage DOC "Debian package builder")
if (DPKG_BUILDER)
#
# Derive the correct filename for a Debian package because the DEB
# generator doesn't do this correctly at present.
#
if (NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
find_program (DPKG_PROGRAM dpkg DOC "dpkg program of Debian-based systems")
if (DPKG_PROGRAM)
execute_process (
COMMAND ${DPKG_PROGRAM} --print-architecture
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
else (DPKG_PROGRAM)
set (CPACK_DEBIAN_PACKAGE_ARCHITECTURE noarch)
endif (DPKG_PROGRAM)
endif ()
list (APPEND CPACK_GENERATOR "DEB")
endif (DPKG_BUILDER)
find_program (RPMBUILDER rpmbuild DOC "RPM package builder")
if (RPMBUILDER)
list (APPEND CPACK_GENERATOR "RPM")
endif (RPMBUILDER)
endif ()
set (CPACK_DEBIAN_PACKAGE_VERSION "${wsjtx_PACKAGE_VERSION}")
set (CPACK_DEBIAN_PACKAGE_HOMEPAGE "${PROJECT_HOMEPAGE}")
set (CPACK_DEBIAN_PACKAGE_SECTION "hamradio")
set (CPACK_DEBIAN_PACKAGE_DEPENDS "libgfortran5 (>=8.3) | libgfortran4 (>=7.3) | libgfortran3 (>=6.3), libfftw3-single3 (>=3.3), libgomp1 (>=6), libqt5serialport5 (>=5.7), libqt5multimedia5-plugins (>=5.7), libqt5widgets5 (>=5.7), libqt5network5 (>=5.7), libqt5printsupport5 (>=5.7), libqt5websockets5 (>=5.7), libqt5sql5-sqlite (>=5.7), libusb-1.0-0 (>=1.0.21), libboost-log1.62.0 (>=1.62.0) | libboost-log1.65.1 (>=1.65.1) | libboost-log1.67.0 (>=1.67.0) | libboost-log1.71.0 (>=1.71.0) | libboost-log1.74.0 (>=1.74.0) | libboost-log1.81.0 (>=1.81.0) | libboost-log1.83.0 (>=1.83.0) | libboost-log1.85.0 (>=1.85.0)")
set (CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
# The downstream WSJT-X Improved fork uses the same executable, data, and doc
# paths as mainline. Replace its packages so the installations cannot mix,
# while preserving dependencies such as `js8call` through virtual packages.
set (CPACK_DEBIAN_PACKAGE_PROVIDES "wsjtx-data (= ${wsjtx_PACKAGE_VERSION}), wsjtx-doc (= ${wsjtx_PACKAGE_VERSION}), wsjtx-improved-data (= ${wsjtx_PACKAGE_VERSION}), wsjtx-improved-doc (= ${wsjtx_PACKAGE_VERSION})")
set (CPACK_DEBIAN_PACKAGE_REPLACES "wsjtx-improved, wsjtx-data, wsjtx-doc, wsjtx-improved-data, wsjtx-improved-doc")
# WSJT-X Improved is a downstream fork, not a versioned upgrade.
# Its packages can compare newer than mainline despite incompatible binaries
# and shared files, so these relationships must not be version-qualified.
set (CPACK_DEBIAN_PACKAGE_BREAKS "wsjtx-improved, wsjtx-improved-data, wsjtx-improved-doc")
set (CPACK_DEBIAN_PACKAGE_CONFLICTS "wsjtx-data (<< ${wsjtx_PACKAGE_VERSION}), wsjtx-doc (<< ${wsjtx_PACKAGE_VERSION})")
if (NOT CPACK_RPM_PACKAGE_ARCHITECTURE)
set (CPACK_RPM_PACKAGE_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
endif ()
set (CPACK_RPM_PACKAGE_VERSION "${wsjtx_PACKAGE_VERSION}")
set (CPACK_RPM_PACKAGE_REQUIRES "qt5-qtbase >= 5.9, qt5-qtserialport >= 5.9, qt5-qtmultimedia >= 5.9, qt5-qtwebsockets >= 5.9, qt5-qtsvg >= 5.9, libusbx >= 1.0.22, libgfortran >= 7, libgomp >= 7, fftw-libs-single >= 3.3, boost-log >= 1.62")
set (CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/share/pixmaps /usr/share/applications /usr/share/man /usr/share/man1)
configure_file ("${PROJECT_SOURCE_DIR}/CMakeCPackOptions.cmake.in"
"${PROJECT_BINARY_DIR}/CMakeCPackOptions.cmake" @ONLY)
set (CPACK_PROJECT_CONFIG_FILE "${PROJECT_BINARY_DIR}/CMakeCPackOptions.cmake")
include (CPack)
|