forked from JS8Call-improved/JS8Call-improved
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
470 lines (408 loc) · 14.8 KB
/
CMakeLists.txt
File metadata and controls
470 lines (408 loc) · 14.8 KB
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
cmake_minimum_required(VERSION 3.22 FATAL_ERROR)
#------------------------------------------------------------------------------#
#
# JS8Call Build:
#
# 1) mkdir build
# 2) cd build
# 3) cmake ..
# 4) make
#
# For subsequent builds, just skip directly to step 4.
#
#------------------------------------------------------------------------------#
#------------------------------------------------------------------------------#
# Policies; add to this list as required:
#
# - CMP0167: Require a Boost 1.70+ installation, with cmake support.
# - CMP0177: DESTINATION paths are normalized.
#------------------------------------------------------------------------------#
foreach(policy CMP0167 CMP0177)
if(POLICY ${policy})
cmake_policy(SET ${policy} NEW)
endif()
endforeach()
#------------------------------------------------------------------------------#
# Configuration defaults that we allow to be overridden on the cmake
# command line.
#------------------------------------------------------------------------------#
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
if (NOT CMAKE_PREFIX_PATH)
set(CMAKE_PREFIX_PATH ${CMAKE_SOURCE_DIR}/../js8libs)
endif()
#------------------------------------------------------------------------------#
# Configuration defaults that we don't allow to be overridden.
#------------------------------------------------------------------------------#
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_OSX_DEPLOYMENT_TARGET 12.0)
#------------------------------------------------------------------------------#
# Project
#------------------------------------------------------------------------------#
project(
JS8Call-improved
VERSION 2.4.0
LANGUAGES C CXX
)
set(PROJECT_VENDOR "Jordan Sherer, KN4CRD")
set(PROJECT_CONTACT "Jordan Sherer <kn4crd@gmail.com>")
set(PROJECT_COPYRIGHT "Copyright (C) 2001-2018 by Joe Taylor, K1JT, (C) 2018 by Jordan Sherer, KN4CRD, (C) of contributed work is owned by individual contributors")
set(PROJECT_HOMEPAGE https://groups.io/g/js8call)
set(PROJECT_SUMMARY_DESCRIPTION "${PROJECT_NAME} - Digital Modes for Weak Signal Communications in Amateur Radio.")
set(PROJECT_DESCRIPTION "${PROJECT_SUMMARY_DESCRIPTION}
${PROJECT_NAME} is a computer program designed to facilitate amateur
radio communication using very weak signals.")
#------------------------------------------------------------------------------#
# Add our own CMake modules.
#------------------------------------------------------------------------------#
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake/Modules")
#------------------------------------------------------------------------------#
# CMake Script Includes
#------------------------------------------------------------------------------#
include(CheckTypeSize)
include(CheckSymbolExists)
include(CMakeDependentOption)
include(CPack)
include(GenerateExportHeader)
include(GNUInstallDirs)
include(VersionCompute)
#------------------------------------------------------------------------------#
# Options and features. Some of these directly affect compilation by being
# define in wsjtx_config.h.in, which makes them available to the C/C++
# preprocessor.
#------------------------------------------------------------------------------#
option(WSJT_QDEBUG_TO_FILE "Redirect Qt debugging messages to a trace file.")
option(WSJT_HAMLIB_TRACE "Debugging option that turns on minimal Hamlib internal diagnostics.")
option(WSJT_RIG_NONE_CAN_SPLIT "Allow split operation with \"None\" as rig.")
cmake_dependent_option(
WSJT_HAMLIB_VERBOSE_TRACE
"Debugging option that turns on full Hamlib internal diagnostics."
OFF
WSJT_HAMLIB_TRACE
OFF)
cmake_dependent_option(
WSJT_QDEBUG_IN_RELEASE
"Leave Qt debugging statements in Release configuration."
OFF
"NOT (CMAKE_BUILD_TYPE STREQUAL Debug)"
OFF)
cmake_dependent_option(
WSJT_ENABLE_EXPERIMENTAL_FEATURES
"Enable features not fully ready for public releases."
ON
"CMAKE_BUILD_TYPE STREQUAL Debug"
OFF)
#------------------------------------------------------------------------------#
# Ensure we have required library dependencies; we'll need headers from the
# Boost and FFTW3 libraries.
#------------------------------------------------------------------------------#
find_package(Boost 1.77 REQUIRED)
find_package(FFTW3 REQUIRED COMPONENTS single threads)
find_package(Hamlib REQUIRED)
find_package(Qt6 6.5 REQUIRED COMPONENTS Multimedia Network SerialPort Widgets)
include_directories(${Boost_INCLUDE_DIRS})
include_directories(${FFTW3_INCLUDE_DIRS})
#------------------------------------------------------------------------------#
# OSX requires an icon file resource.
#------------------------------------------------------------------------------#
if (APPLE)
set(ICON_FILE ${CMAKE_PROJECT_NAME}.icns)
set(ICON_SRCS
icons/Darwin/${CMAKE_PROJECT_NAME}.iconset/icon_16x16.png
icons/Darwin/${CMAKE_PROJECT_NAME}.iconset/icon_16x16@2x.png
icons/Darwin/${CMAKE_PROJECT_NAME}.iconset/icon_32x32.png
icons/Darwin/${CMAKE_PROJECT_NAME}.iconset/icon_32x32@2x.png
icons/Darwin/${CMAKE_PROJECT_NAME}.iconset/icon_128x128.png
icons/Darwin/${CMAKE_PROJECT_NAME}.iconset/icon_128x128@2x.png
icons/Darwin/${CMAKE_PROJECT_NAME}.iconset/icon_256x256.png
icons/Darwin/${CMAKE_PROJECT_NAME}.iconset/icon_256x256@2x.png
icons/Darwin/${CMAKE_PROJECT_NAME}.iconset/icon_512x512.png
icons/Darwin/${CMAKE_PROJECT_NAME}.iconset/icon_512x512@2x.png
)
add_custom_command(
OUTPUT ${ICON_FILE}
COMMAND iconutil -c icns --output "${CMAKE_BINARY_DIR}/${ICON_FILE}" "${CMAKE_SOURCE_DIR}/icons/Darwin/${CMAKE_PROJECT_NAME}.iconset"
DEPENDS ${ICON_SRCS}
COMMENT "Building Icons"
)
set_source_files_properties(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
endif (APPLE)
#------------------------------------------------------------------------------#
# Create a target that's the same as our project name; that'll be our
# created executable.
#------------------------------------------------------------------------------#
set(TARGET ${PROJECT_NAME})
qt_add_executable(${TARGET} MACOSX_BUNDLE WIN32 ${ICON_FILE})
#------------------------------------------------------------------------------#
# OSX requires a number of settings in the plist file.
#------------------------------------------------------------------------------#
set_target_properties(
${TARGET} PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Darwin/Info.plist.in"
MACOSX_BUNDLE_INFO_STRING "${WSJTX_DESCRIPTION_SUMMARY}"
MACOSX_BUNDLE_ICON_FILE "${ICON_FILE}"
MACOSX_BUNDLE_BUNDLE_VERSION "${wsjtx_VERSION}"
MACOSX_BUNDLE_SHORT_VERSION_STRING "${wsjtx_SHORT_VERSION}"
MACOSX_BUNDLE_BUNDLE_NAME "${PROJECT_NAME}"
MACOSX_BUNDLE_BUNDLE_EXECUTABLE_NAME "${PROJECT_NAME}"
MACOSX_BUNDLE_COPYRIGHT "${PROJECT_COPYRIGHT}"
MACOSX_BUNDLE_GUI_IDENTIFIER "org.kn4crd.js8call"
)
#------------------------------------------------------------------------------#
# Set CMAKE_BUILD to 1 globally for use by things that need to know
# they're being compiled under cmake, then preprocess and precompile
# the configuration header.
#------------------------------------------------------------------------------#
target_compile_definitions(${TARGET} PRIVATE CMAKE_BUILD)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/wsjtx_config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/wsjtx_config.h"
)
target_precompile_headers(
${TARGET} PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/wsjtx_config.h
)
#------------------------------------------------------------------------------#
# Source files common to all platforms.
#------------------------------------------------------------------------------#
target_sources(
${TARGET} PRIVATE
Audio/BWFFile.cpp
logbook/adif.cpp
logbook/countrydat.cpp
logbook/countriesworked.cpp
logbook/logbook.cpp
vendor/sqlite3/sqlite3.c
about.cpp
APRSISClient.cpp
AttenuationSlider.cpp
AudioDevice.cpp
Bands.cpp
CallsignValidator.cpp
CandidateKeyFilter.cpp
Configuration.cpp
decodedtext.cpp
Detector.cpp
DisplayManual.cpp
DriftingDateTime.cpp
DXLabSuiteCommanderTransceiver.cpp
EmulateSplitTransceiver.cpp
fileutils.cpp
Flatten.cpp
ForeignKeyDelegate.cpp
FrequencyLineEdit.cpp
FrequencyList.cpp
Geodesic.cpp
HamlibTransceiver.cpp
HelpTextWindow.cpp
HRDTransceiver.cpp
IARURegions.cpp
Inbox.cpp
JS8.cpp
JS8Submode.cpp
jsc_checker.cpp
jsc_list.cpp
jsc_map.cpp
jsc.cpp
LazyFillComboBox.cpp
logqso.cpp
main.cpp
mainwindow.cpp
Message.cpp
MessageBox.cpp
MessageClient.cpp
MessageError.cpp
messagereplydialog.cpp
MessageServer.cpp
messagewindow.cpp
MetaDataRegistry.cpp
Modes.cpp
Modulator.cpp
MultiSettings.cpp
NetworkServerLookup.cpp
NotificationAudio.cpp
plotter.cpp
PollingTransceiver.cpp
ProcessThread.cpp
PSKReporter.cpp
qDateTimeExperiment.cpp
qt_helpers.cpp
Radio.cpp
RadioMetaType.cpp
RDP.cpp
revision_utils.cpp
SelfDestructMessageBox.cpp
SignalMeter.cpp
soundin.cpp
soundout.cpp
SpotClient.cpp
StationList.cpp
TCPClient.cpp
TraceFile.cpp
Transceiver.cpp
TransceiverBase.cpp
TransceiverFactory.cpp
TransmitTextEdit.cpp
TwoPhaseSignal.cpp
TxLoop.cpp
varicode.cpp
WF.cpp
widegraph.cpp
)
#------------------------------------------------------------------------------#
# Link libraries common to all platforms.
#------------------------------------------------------------------------------#
target_link_libraries(
${TARGET} PRIVATE
${FFTW3_LIBRARIES}
Hamlib::Hamlib
Qt::Multimedia
Qt::Network
Qt::SerialPort
Qt::Widgets
)
#------------------------------------------------------------------------------#
# Resources for country data and eclipse dates, used by the log book and the
# PSK reporter, respectively.
#------------------------------------------------------------------------------#
qt_add_resources(
${TARGET} "data"
FILES
cty.dat
eclipse.txt
)
#------------------------------------------------------------------------------#
# Up and down arrow image resources, used in the main window by the
# frequency controls.
#------------------------------------------------------------------------------#
qt_add_resources(
${TARGET} "images"
PREFIX "/images"
FILES
artwork/up.png
artwork/down.png
)
#------------------------------------------------------------------------------#
# Waterfall palette resources.
#------------------------------------------------------------------------------#
qt_add_resources(
${TARGET} "palettes"
BASE "Palettes"
PREFIX "/Palettes"
FILES
Palettes/Banana.pal
Palettes/Blue1.pal
Palettes/Blue2.pal
Palettes/Blue3.pal
Palettes/Brown.pal
Palettes/Cyan1.pal
Palettes/Cyan2.pal
Palettes/Cyan3.pal
Palettes/Default.pal
Palettes/Digipan.pal
Palettes/Fldigi.pal
Palettes/Gray1.pal
Palettes/Gray2.pal
Palettes/Green1.pal
Palettes/Green2.pal
Palettes/Jungle.pal
Palettes/Linrad.pal
Palettes/Negative.pal
Palettes/Orange.pal
Palettes/Pink.pal
Palettes/Rainbow.pal
Palettes/Scope.pal
Palettes/Sunburst.pal
Palettes/VK4BDJ.pal
Palettes/YL2KF.pal
Palettes/Yellow1.pal
Palettes/Yellow2.pal
Palettes/ZL1FZ.pal
)
#------------------------------------------------------------------------------#
# Compiler setup. OSX will by default choose the correct compiler flags;
# on other platforms we'll probably need to expand on this by platform.
#------------------------------------------------------------------------------#
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fexceptions -frtti")
#------------------------------------------------------------------------------#
# In order to execute the macdeployqt and windeployqt commands, we'll need
# to know where they live, which is the same location as the qmake binary.
#------------------------------------------------------------------------------#
get_target_property(QMAKE_EXECUTABLE Qt::qmake IMPORTED_LOCATION)
get_filename_component(QT_BIN_DIR "${QMAKE_EXECUTABLE}" DIRECTORY)
#------------------------------------------------------------------------------#
# On OSX, all we have to do at this point is deploy in overwrite mode to
# have all the needed library dependencies injected into the target.
#------------------------------------------------------------------------------#
if (APPLE)
find_program(MACDEPLOYQT macdeployqt HINTS "${QT_BIN_DIR}")
add_custom_command(
TARGET ${TARGET}
POST_BUILD
COMMAND "${MACDEPLOYQT}"
"$<TARGET_FILE_DIR:${TARGET}>/../.."
-always-overwrite
COMMENT "Running macdeployqt..."
)
endif (APPLE)
#------------------------------------------------------------------------------#
# On Windows, we want to conditionally enable OmniRig, as frankly, it's at
# present got a foot in the grave and another on a banana peel, we we must
# be prepared to eliminate the integration if nothing changes for the better.
#------------------------------------------------------------------------------#
if (WIN32)
option(ENABLE_OMNIRIG "Enable OmniRig COM integration" OFF)
if (ENABLE_OMNIRIG)
include(QtAxMacros)
find_package(Qt6 REQUIRED COMPONENTS AxContainer AxServer)
find_program(DUMPCPP dumpcpp HINTS "${QT_BIN_DIR}")
execute_process(
COMMAND "${DUMPCPP}" -getfile {4FE359C5-A58F-459D-BE95-CA559FB4F270}
OUTPUT_VARIABLE AXSERVER
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
string(STRIP "${AXSERVER}" AXSERVER)
if (AXSERVER)
string(REPLACE "\"" "" AXSERVER "${AXSERVER}")
file(TO_CMAKE_PATH "${AXSERVER}" AXSERVERSRCS)
wrap_ax_server(GENAXSRCS "${AXSERVERSRCS}")
target_compile_definitions(${TARGET}
PRIVATE ENABLE_OMNIRIG=$<BOOL:${ENABLE_OMNIRIG}>
)
target_sources(${TARGET} PRIVATE
OmniRigTransceiver.cpp
${GENAXSRCS}
)
target_link_libraries(${TARGET} PRIVATE
Qt::AxContainer
Qt::AxServer
)
else()
message(STATUS "OmniRig not installed; skipping OmniRig integration.")
endif()
endif()
# Windows icons require an RC file.
target_sources(${TARGET} PRIVATE wsjtx.rc)
# Find the windeployqt command and run it against the generated binary,
# which should handle all the gnarly bits.
find_program(WINDEPLOYQT NAMES windeployqt HINTS "${QT_BIN_DIR}")
add_custom_command(
TARGET ${TARGET}
POST_BUILD
COMMAND "${WINDEPLOYQT}" "$<TARGET_FILE_DIR:${TARGET}>"
--libdir JS8Call-improved
--plugindir JS8Call-improved
--no-translations
COMMENT "Running windeployqt..."
)
endif (WIN32)
#------------------------------------------------------------------------------#