| 1 |
cmake_minimum_required(VERSION 3.22 FATAL_ERROR) |
| 2 |
#------------------------------------------------------------------------------# |
| 3 |
# |
| 4 |
# JS8Call Build: |
| 5 |
# |
| 6 |
# 1) mkdir build |
| 7 |
# 2) cd build |
| 8 |
# 3) cmake .. |
| 9 |
# 4) make |
| 10 |
# |
| 11 |
# For subsequent builds, just skip directly to step 4. |
| 12 |
# |
| 13 |
#------------------------------------------------------------------------------# |
| 14 |
|
| 15 |
#------------------------------------------------------------------------------# |
| 16 |
# Policies; add to this list as required: |
| 17 |
# |
| 18 |
# - CMP0167: Require a Boost 1.70+ installation, with cmake support. |
| 19 |
# - CMP0177: DESTINATION paths are normalized. |
| 20 |
#------------------------------------------------------------------------------# |
| 21 |
|
| 22 |
foreach(policy CMP0167 CMP0177) |
| 23 |
if(POLICY ${policy}) |
| 24 |
cmake_policy(SET ${policy} NEW) |
| 25 |
endif() |
| 26 |
endforeach() |
| 27 |
|
| 28 |
#------------------------------------------------------------------------------# |
| 29 |
# Configuration defaults that we allow to be overridden on the cmake |
| 30 |
# command line. |
| 31 |
#------------------------------------------------------------------------------# |
| 32 |
|
| 33 |
if (NOT CMAKE_BUILD_TYPE) |
| 34 |
set(CMAKE_BUILD_TYPE Release) |
| 35 |
endif() |
| 36 |
|
| 37 |
if (NOT CMAKE_PREFIX_PATH) |
| 38 |
set(CMAKE_PREFIX_PATH ${CMAKE_SOURCE_DIR}/../js8libs) |
| 39 |
endif() |
| 40 |
|
| 41 |
#------------------------------------------------------------------------------# |
| 42 |
# Configuration defaults that we don't allow to be overridden. |
| 43 |
#------------------------------------------------------------------------------# |
| 44 |
|
| 45 |
set(CMAKE_AUTOMOC ON) |
| 46 |
set(CMAKE_AUTORCC ON) |
| 47 |
set(CMAKE_AUTOUIC ON) |
| 48 |
set(CMAKE_CXX_EXTENSIONS OFF) |
| 49 |
set(CMAKE_CXX_STANDARD 20) |
| 50 |
set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 51 |
set(CMAKE_INCLUDE_CURRENT_DIR ON) |
| 52 |
set(CMAKE_OSX_DEPLOYMENT_TARGET 12.0) |
| 53 |
|
| 54 |
#------------------------------------------------------------------------------# |
| 55 |
# Project configuration. The software build version is set here. If the version |
| 56 |
# is set to 0.0.0 the build will be unversioned and marked as "Development" |
| 57 |
#------------------------------------------------------------------------------# |
| 58 |
|
| 59 |
project( |
| 60 |
JS8Call |
| 61 |
VERSION 3.0.3 |
| 62 |
LANGUAGES C CXX |
| 63 |
) |
| 64 |
|
| 65 |
set(PROJECT_VENDOR "Jordan Sherer, KN4CRD") |
| 66 |
set(PROJECT_CONTACT "Jordan Sherer <[email protected]>") |
| 67 |
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") |
| 68 |
set(PROJECT_HOMEPAGE https://groups.io/g/js8call) |
| 69 |
set(PROJECT_SUMMARY_DESCRIPTION "${PROJECT_NAME} - Digital Modes for Weak Signal Communications in Amateur Radio.") |
| 70 |
set(PROJECT_DESCRIPTION "${PROJECT_SUMMARY_DESCRIPTION} |
| 71 |
${PROJECT_NAME} is a computer program designed to facilitate amateur radio communication using very weak signals.") |
| 72 |
|
| 73 |
#------------------------------------------------------------------------------# |
| 74 |
# Add our own CMake modules. |
| 75 |
#------------------------------------------------------------------------------# |
| 76 |
|
| 77 |
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake/Modules") |
| 78 |
|
| 79 |
#------------------------------------------------------------------------------# |
| 80 |
# CMake Script Includes |
| 81 |
#------------------------------------------------------------------------------# |
| 82 |
|
| 83 |
include(CheckTypeSize) |
| 84 |
include(CheckSymbolExists) |
| 85 |
include(CMakeDependentOption) |
| 86 |
include(GenerateExportHeader) |
| 87 |
include(GNUInstallDirs) |
| 88 |
|
| 89 |
#------------------------------------------------------------------------------# |
| 90 |
# Options and features. Some of these directly affect compilation by being |
| 91 |
# define in js8call_config.h.in, which makes them available to the C/C++ |
| 92 |
# preprocessor. |
| 93 |
#------------------------------------------------------------------------------# |
| 94 |
|
| 95 |
option(WSJT_QDEBUG_TO_FILE "Redirect Qt debugging messages to a trace file.") |
| 96 |
option(WSJT_HAMLIB_TRACE "Debugging option that turns on minimal Hamlib internal diagnostics.") |
| 97 |
option(WSJT_RIG_NONE_CAN_SPLIT "Allow split operation with \"None\" as rig.") |
| 98 |
|
| 99 |
cmake_dependent_option( |
| 100 |
WSJT_HAMLIB_VERBOSE_TRACE |
| 101 |
"Debugging option that turns on full Hamlib internal diagnostics." |
| 102 |
OFF |
| 103 |
WSJT_HAMLIB_TRACE |
| 104 |
OFF) |
| 105 |
|
| 106 |
cmake_dependent_option( |
| 107 |
WSJT_QDEBUG_IN_RELEASE |
| 108 |
"Leave Qt debugging statements in Release configuration." |
| 109 |
OFF |
| 110 |
"NOT (CMAKE_BUILD_TYPE STREQUAL Debug)" |
| 111 |
OFF) |
| 112 |
|
| 113 |
cmake_dependent_option( |
| 114 |
WSJT_ENABLE_EXPERIMENTAL_FEATURES |
| 115 |
"Enable features not fully ready for public releases." |
| 116 |
ON |
| 117 |
"CMAKE_BUILD_TYPE STREQUAL Debug" |
| 118 |
OFF) |
| 119 |
|
| 120 |
#------------------------------------------------------------------------------# |
| 121 |
# Ensure we have required library dependencies; we'll need headers from the |
| 122 |
# Boost and FFTW3 libraries. |
| 123 |
#------------------------------------------------------------------------------# |
| 124 |
|
| 125 |
find_package(Boost 1.77 REQUIRED) |
| 126 |
find_package(FFTW3 REQUIRED COMPONENTS single threads) |
| 127 |
find_package(Hamlib REQUIRED) |
| 128 |
find_package(Qt6 6.5 REQUIRED COMPONENTS Multimedia Network SerialPort Widgets) |
| 129 |
|
| 130 |
include_directories(${Boost_INCLUDE_DIRS}) |
| 131 |
include_directories(${FFTW3_INCLUDE_DIRS}) |
| 132 |
|
| 133 |
# Debian: use system libraries |
| 134 |
find_package(PkgConfig) |
| 135 |
pkg_check_modules(EIGEN REQUIRED IMPORTED_TARGET GLOBAL eigen3) |
| 136 |
pkg_check_modules(SQLITE REQUIRED IMPORTED_TARGET GLOBAL sqlite3) |
| 137 |
|
| 138 |
#------------------------------------------------------------------------------# |
| 139 |
# OSX requires an icon file resource. |
| 140 |
#------------------------------------------------------------------------------# |
| 141 |
|
| 142 |
if (APPLE) |
| 143 |
set(ICON_FILE ${CMAKE_PROJECT_NAME}.icns) |
| 144 |
set(ICON_SRCS |
| 145 |
icons/Darwin/${CMAKE_PROJECT_NAME}.iconset/icon_16x16.png |
| 146 |
icons/Darwin/${CMAKE_PROJECT_NAME}.iconset/[email protected] |
| 147 |
icons/Darwin/${CMAKE_PROJECT_NAME}.iconset/icon_32x32.png |
| 148 |
icons/Darwin/${CMAKE_PROJECT_NAME}.iconset/[email protected] |
| 149 |
icons/Darwin/${CMAKE_PROJECT_NAME}.iconset/icon_128x128.png |
| 150 |
icons/Darwin/${CMAKE_PROJECT_NAME}.iconset/[email protected] |
| 151 |
icons/Darwin/${CMAKE_PROJECT_NAME}.iconset/icon_256x256.png |
| 152 |
icons/Darwin/${CMAKE_PROJECT_NAME}.iconset/[email protected] |
| 153 |
icons/Darwin/${CMAKE_PROJECT_NAME}.iconset/icon_512x512.png |
| 154 |
icons/Darwin/${CMAKE_PROJECT_NAME}.iconset/[email protected] |
| 155 |
) |
| 156 |
add_custom_command( |
| 157 |
OUTPUT ${ICON_FILE} |
| 158 |
COMMAND iconutil -c icns --output "${CMAKE_BINARY_DIR}/${ICON_FILE}" "${CMAKE_SOURCE_DIR}/icons/Darwin/${CMAKE_PROJECT_NAME}.iconset" |
| 159 |
DEPENDS ${ICON_SRCS} |
| 160 |
COMMENT "Building Icons" |
| 161 |
) |
| 162 |
set_source_files_properties(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") |
| 163 |
endif (APPLE) |
| 164 |
|
| 165 |
#------------------------------------------------------------------------------# |
| 166 |
# Create a target that's the same as our project name; that'll be our |
| 167 |
# created executable. |
| 168 |
#------------------------------------------------------------------------------# |
| 169 |
|
| 170 |
set(TARGET ${PROJECT_NAME}) |
| 171 |
|
| 172 |
qt_add_executable(${TARGET} MACOSX_BUNDLE WIN32 ${ICON_FILE}) |
| 173 |
|
| 174 |
#------------------------------------------------------------------------------# |
| 175 |
# OSX requires a number of settings in the plist file. |
| 176 |
#------------------------------------------------------------------------------# |
| 177 |
|
| 178 |
set_target_properties( |
| 179 |
${TARGET} PROPERTIES |
| 180 |
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/resources/MacOS/Info.plist.in" |
| 181 |
MACOSX_BUNDLE_ICON_FILE "${ICON_FILE}" |
| 182 |
MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_VERSION}" |
| 183 |
MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION}" |
| 184 |
MACOSX_BUNDLE_COPYRIGHT "${PROJECT_COPYRIGHT}" |
| 185 |
) |
| 186 |
|
| 187 |
#------------------------------------------------------------------------------# |
| 188 |
# Set CMAKE_BUILD to 1 globally for use by things that need to know |
| 189 |
# they're being compiled under cmake, then preprocess and precompile |
| 190 |
# the configuration header. |
| 191 |
#------------------------------------------------------------------------------# |
| 192 |
find_program(GIT_EXECUTABLE git) |
| 193 |
if(GIT_EXECUTABLE) |
| 194 |
execute_process( |
| 195 |
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD |
| 196 |
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
| 197 |
OUTPUT_VARIABLE GIT_HASH |
| 198 |
OUTPUT_STRIP_TRAILING_WHITESPACE |
| 199 |
) |
| 200 |
else() |
| 201 |
set(GIT_HASH "nogit") |
| 202 |
endif() |
| 203 |
|
| 204 |
if(WIN32) |
| 205 |
# Prefer environment variables on Windows |
| 206 |
set(HOSTNAME "$ENV{COMPUTERNAME}") |
| 207 |
set(USERNAME "$ENV{USERNAME}") |
| 208 |
else() |
| 209 |
execute_process( |
| 210 |
COMMAND hostname |
| 211 |
OUTPUT_VARIABLE HOSTNAME |
| 212 |
OUTPUT_STRIP_TRAILING_WHITESPACE |
| 213 |
) |
| 214 |
|
| 215 |
execute_process( |
| 216 |
COMMAND whoami |
| 217 |
OUTPUT_VARIABLE USERNAME |
| 218 |
OUTPUT_STRIP_TRAILING_WHITESPACE |
| 219 |
) |
| 220 |
endif() |
| 221 |
|
| 222 |
target_compile_definitions(${TARGET} |
| 223 |
PRIVATE |
| 224 |
CMAKE_BUILD |
| 225 |
JS8CALL_VERSION=\"$ENV{DEB_VERSION}\" |
| 226 |
GITSHORT=\"\" |
| 227 |
MACHINE=\"\" |
| 228 |
UNAME=\"\" |
| 229 |
) |
| 230 |
|
| 231 |
string(TIMESTAMP TODAY_DATE "%m-%d-%Y") |
| 232 |
|
| 233 |
configure_file( |
| 234 |
"${CMAKE_CURRENT_SOURCE_DIR}/JS8_Include/js8call_config.h.in" |
| 235 |
"${CMAKE_CURRENT_BINARY_DIR}/js8call_config.h" |
| 236 |
) |
| 237 |
|
| 238 |
target_precompile_headers( |
| 239 |
${TARGET} PRIVATE |
| 240 |
${CMAKE_CURRENT_BINARY_DIR}/js8call_config.h |
| 241 |
) |
| 242 |
|
| 243 |
#------------------------------------------------------------------------------# |
| 244 |
# Source files common to all platforms. |
| 245 |
#------------------------------------------------------------------------------# |
| 246 |
|
| 247 |
target_sources( |
| 248 |
${TARGET} PRIVATE |
| 249 |
JS8_Audio/AudioDevice.cpp |
| 250 |
JS8_Audio/BWFFile.cpp |
| 251 |
JS8_Audio/NotificationAudio.cpp |
| 252 |
JS8_Audio/NotificationSoundOutput.cpp |
| 253 |
JS8_Audio/SoundInput.cpp |
| 254 |
JS8_Audio/SoundOutput.cpp |
| 255 |
JS8_JSC/JSC.cpp |
| 256 |
JS8_JSC/JSC_checker.cpp |
| 257 |
JS8_JSC/JSC_list.cpp |
| 258 |
JS8_JSC/JSC_map.cpp |
| 259 |
JS8_Logbook/ADIF.cpp |
| 260 |
JS8_Logbook/CountryDat.cpp |
| 261 |
JS8_Logbook/CountriesWorked.cpp |
| 262 |
JS8_Logbook/LogBook.cpp |
| 263 |
JS8_Main/AprsInboundRelay.cpp |
| 264 |
JS8_Main/APRSISClient.cpp |
| 265 |
JS8_Main/AttenuationSlider.cpp |
| 266 |
JS8_Main/Bands.cpp |
| 267 |
JS8_Main/CallsignValidator.cpp |
| 268 |
JS8_Main/CandidateKeyFilter.cpp |
| 269 |
JS8_Main/CPlotter.cpp |
| 270 |
JS8_Main/DirectedMessageHighlighter.cpp |
| 271 |
JS8_Main/DirectedMessageParser.cpp |
| 272 |
JS8_Main/DriftingDateTime.cpp |
| 273 |
JS8_Main/Flatten.cpp |
| 274 |
JS8_Main/ForeignKeyDelegate.cpp |
| 275 |
JS8_Main/FrequencyLineEdit.cpp |
| 276 |
JS8_Main/FrequencyList.cpp |
| 277 |
JS8_Main/Geodesic.cpp |
| 278 |
JS8_Main/HBBlockingDB.cpp |
| 279 |
JS8_Main/HelpTextWindow.cpp |
| 280 |
JS8_Main/IARURegions.cpp |
| 281 |
JS8_Main/Inbox.cpp |
| 282 |
JS8_Main/JS8MessageBox.cpp |
| 283 |
JS8_Main/Message.cpp |
| 284 |
JS8_Main/MessageClient.cpp |
| 285 |
JS8_Main/MessageError.cpp |
| 286 |
JS8_Main/MessageServer.cpp |
| 287 |
JS8_Main/MetaDataRegistry.cpp |
| 288 |
JS8_Main/MultiSettings.cpp |
| 289 |
JS8_Main/RDP.cpp |
| 290 |
JS8_Main/StationList.cpp |
| 291 |
JS8_Main/TxLoop.cpp |
| 292 |
JS8_Main/fileutils.cpp |
| 293 |
JS8_Main/main.cpp |
| 294 |
JS8_Main/Modes.cpp |
| 295 |
JS8_Main/PillRenderer.cpp |
| 296 |
JS8_Main/ProcessThread.cpp |
| 297 |
JS8_Main/qt_helpers.cpp |
| 298 |
JS8_Main/Radio.cpp |
| 299 |
JS8_Main/RadioMetaType.cpp |
| 300 |
JS8_Main/revision_utils.cpp |
| 301 |
JS8_Main/SelfDestructMessageBox.cpp |
| 302 |
JS8_Main/SignalMeter.cpp |
| 303 |
JS8_Main/TraceFile.cpp |
| 304 |
JS8_Main/TransmitTextSourceMirror.cpp |
| 305 |
JS8_Main/TransmitTextEdit.cpp |
| 306 |
JS8_Main/TwoPhaseSignal.cpp |
| 307 |
JS8_Main/Varicode.cpp |
| 308 |
JS8_Mainwindow/buildQueryMenu.cpp |
| 309 |
JS8_Mainwindow/checkVersion.cpp |
| 310 |
JS8_Mainwindow/dataSink.cpp |
| 311 |
JS8_Mainwindow/displayBandActivity.cpp |
| 312 |
JS8_Mainwindow/displayCallActivity.cpp |
| 313 |
JS8_Mainwindow/initializeDummyData.cpp |
| 314 |
JS8_Mainwindow/initializeGroupMessage.cpp |
| 315 |
JS8_Mainwindow/networkMessage.cpp |
| 316 |
JS8_Mainwindow/processBufferedActivity.cpp |
| 317 |
JS8_Mainwindow/processCommandActivity.cpp |
| 318 |
JS8_Mainwindow/processDecodeEvent.cpp |
| 319 |
JS8_Mainwindow/processHeartbeatRateLimit.cpp |
| 320 |
JS8_Mainwindow/processRxActivity.cpp |
| 321 |
JS8_Mainwindow/UI_Constructor.cpp |
| 322 |
JS8_Mainwindow/confirmThenEnqueueMessage.cpp |
| 323 |
JS8_Mode/DecodedText.cpp |
| 324 |
JS8_Mode/Detector.cpp |
| 325 |
JS8_Mode/FrequencyTracker.cpp |
| 326 |
JS8_Mode/JS8.cpp |
| 327 |
JS8_Mode/JS8Submode.cpp |
| 328 |
JS8_Mode/Modulator.cpp |
| 329 |
JS8_Network/NetworkServerLookup.cpp |
| 330 |
JS8_Network/PSKReporter.cpp |
| 331 |
JS8_Network/SpotClient.cpp |
| 332 |
JS8_Network/TCPClient.cpp |
| 333 |
JS8_Transceiver/DXLabSuiteCommanderTransceiver.cpp |
| 334 |
JS8_Transceiver/EmulateSplitTransceiver.cpp |
| 335 |
JS8_Transceiver/HamlibTransceiver.cpp |
| 336 |
JS8_Transceiver/HRDTransceiver.cpp |
| 337 |
JS8_Transceiver/PollingTransceiver.cpp |
| 338 |
JS8_Transceiver/Transceiver.cpp |
| 339 |
JS8_Transceiver/TransceiverBase.cpp |
| 340 |
JS8_Transceiver/TransceiverFactory.cpp |
| 341 |
JS8_UDP/NetworkMessage.cpp |
| 342 |
JS8_UDP/WSJTXMessageClient.cpp |
| 343 |
JS8_UDP/WSJTXMessageMapper.cpp |
| 344 |
JS8_UI/Configuration.cpp |
| 345 |
JS8_UI/About.cpp |
| 346 |
JS8_UI/LogQSO.cpp |
| 347 |
JS8_UI/mainwindow.cpp |
| 348 |
JS8_UI/MessageReplyDialog.cpp |
| 349 |
JS8_UI/MessagePanel.cpp |
| 350 |
JS8_UI/WF.cpp |
| 351 |
JS8_UI/WideGraph.cpp |
| 352 |
JS8_Widgets/CheckableItemComboBox.cpp |
| 353 |
JS8_Widgets/LazyFillComboBox.cpp |
| 354 |
) |
| 355 |
|
| 356 |
#------------------------------------------------------------------------------# |
| 357 |
# Link libraries common to all platforms. |
| 358 |
#------------------------------------------------------------------------------# |
| 359 |
|
| 360 |
target_link_libraries( |
| 361 |
${TARGET} PRIVATE |
| 362 |
${FFTW3_LIBRARIES} |
| 363 |
Hamlib::Hamlib |
| 364 |
Qt::Multimedia |
| 365 |
Qt::Network |
| 366 |
Qt::SerialPort |
| 367 |
Qt::Widgets |
| 368 |
PkgConfig::EIGEN |
| 369 |
PkgConfig::SQLITE |
| 370 |
) |
| 371 |
|
| 372 |
#------------------------------------------------------------------------------# |
| 373 |
# Resources for country data and eclipse dates, used by the log book and the |
| 374 |
# PSK reporter, respectively. |
| 375 |
#------------------------------------------------------------------------------# |
| 376 |
|
| 377 |
qt_add_resources( |
| 378 |
${TARGET} "data" |
| 379 |
FILES |
| 380 |
JS8_Include/cty.dat |
| 381 |
JS8_Include/eclipse.txt |
| 382 |
) |
| 383 |
|
| 384 |
#------------------------------------------------------------------------------# |
| 385 |
# Waterfall palette resources. |
| 386 |
#------------------------------------------------------------------------------# |
| 387 |
|
| 388 |
qt_add_resources( |
| 389 |
${TARGET} "palettes" |
| 390 |
BASE "Palettes" |
| 391 |
PREFIX "/Palettes" |
| 392 |
FILES |
| 393 |
Palettes/Banana.pal |
| 394 |
Palettes/Blue1.pal |
| 395 |
Palettes/Blue2.pal |
| 396 |
Palettes/Blue3.pal |
| 397 |
Palettes/Brown.pal |
| 398 |
Palettes/Cyan1.pal |
| 399 |
Palettes/Cyan2.pal |
| 400 |
Palettes/Cyan3.pal |
| 401 |
Palettes/Default.pal |
| 402 |
Palettes/Digipan.pal |
| 403 |
Palettes/Fldigi.pal |
| 404 |
Palettes/Gray1.pal |
| 405 |
Palettes/Gray2.pal |
| 406 |
Palettes/Green1.pal |
| 407 |
Palettes/Green2.pal |
| 408 |
Palettes/Jungle.pal |
| 409 |
Palettes/Linrad.pal |
| 410 |
Palettes/Negative.pal |
| 411 |
Palettes/Orange.pal |
| 412 |
Palettes/Pink.pal |
| 413 |
Palettes/Rainbow.pal |
| 414 |
Palettes/Scope.pal |
| 415 |
Palettes/Sunburst.pal |
| 416 |
Palettes/VK4BDJ.pal |
| 417 |
Palettes/YL2KF.pal |
| 418 |
Palettes/Yellow1.pal |
| 419 |
Palettes/Yellow2.pal |
| 420 |
Palettes/ZL1FZ.pal |
| 421 |
) |
| 422 |
|
| 423 |
#------------------------------------------------------------------------------# |
| 424 |
# Compiler setup. OSX will by default choose the correct compiler flags; |
| 425 |
# on other platforms we'll probably need to expand on this by platform. |
| 426 |
#------------------------------------------------------------------------------# |
| 427 |
|
| 428 |
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra") |
| 429 |
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fexceptions -frtti") |
| 430 |
|
| 431 |
#------------------------------------------------------------------------------# |
| 432 |
# In order to execute the macdeployqt and windeployqt commands, we'll need |
| 433 |
# to know where they live, which is the same location as the qmake binary. |
| 434 |
#------------------------------------------------------------------------------# |
| 435 |
|
| 436 |
get_target_property(QMAKE_EXECUTABLE Qt::qmake IMPORTED_LOCATION) |
| 437 |
get_filename_component(QT_BIN_DIR "${QMAKE_EXECUTABLE}" DIRECTORY) |
| 438 |
|
| 439 |
#------------------------------------------------------------------------------# |
| 440 |
# On OSX, all we have to do at this point is deploy in overwrite mode to |
| 441 |
# have all the needed library dependencies injected into the target. |
| 442 |
#------------------------------------------------------------------------------# |
| 443 |
|
| 444 |
if (APPLE) |
| 445 |
find_program(MACDEPLOYQT macdeployqt HINTS "${QT_BIN_DIR}") |
| 446 |
add_custom_command( |
| 447 |
TARGET ${TARGET} |
| 448 |
POST_BUILD |
| 449 |
COMMAND "${MACDEPLOYQT}" |
| 450 |
"$<TARGET_FILE_DIR:${TARGET}>/../.." |
| 451 |
-always-overwrite |
| 452 |
COMMENT "Running macdeployqt..." |
| 453 |
) |
| 454 |
endif (APPLE) |
| 455 |
|
| 456 |
#------------------------------------------------------------------------------# |
| 457 |
# On Windows, we want to conditionally enable OmniRig, as frankly, it's at |
| 458 |
# present got a foot in the grave and another on a banana peel, we we must |
| 459 |
# be prepared to eliminate the integration if nothing changes for the better. |
| 460 |
#------------------------------------------------------------------------------# |
| 461 |
|
| 462 |
if (WIN32) |
| 463 |
|
| 464 |
option(ENABLE_OMNIRIG "Enable OmniRig COM integration" OFF) |
| 465 |
|
| 466 |
if (ENABLE_OMNIRIG) |
| 467 |
include(QtAxMacros) |
| 468 |
find_package(Qt6 REQUIRED COMPONENTS AxContainer AxServer) |
| 469 |
find_program(DUMPCPP dumpcpp HINTS "${QT_BIN_DIR}") |
| 470 |
execute_process( |
| 471 |
COMMAND "${DUMPCPP}" -getfile {4FE359C5-A58F-459D-BE95-CA559FB4F270} |
| 472 |
OUTPUT_VARIABLE AXSERVER |
| 473 |
OUTPUT_STRIP_TRAILING_WHITESPACE |
| 474 |
ERROR_QUIET |
| 475 |
) |
| 476 |
string(STRIP "${AXSERVER}" AXSERVER) |
| 477 |
if (AXSERVER) |
| 478 |
string(REPLACE "\"" "" AXSERVER "${AXSERVER}") |
| 479 |
file(TO_CMAKE_PATH "${AXSERVER}" AXSERVERSRCS) |
| 480 |
|
| 481 |
wrap_ax_server(GENAXSRCS "${AXSERVERSRCS}") |
| 482 |
|
| 483 |
target_compile_definitions(${TARGET} |
| 484 |
PRIVATE ENABLE_OMNIRIG=$<BOOL:${ENABLE_OMNIRIG}> |
| 485 |
) |
| 486 |
|
| 487 |
target_sources(${TARGET} PRIVATE |
| 488 |
JS8_Deprecated/OmniRigTransceiver.cpp |
| 489 |
${GENAXSRCS} |
| 490 |
) |
| 491 |
|
| 492 |
target_link_libraries(${TARGET} PRIVATE |
| 493 |
Qt::AxContainer |
| 494 |
Qt::AxServer |
| 495 |
) |
| 496 |
else() |
| 497 |
message(STATUS "OmniRig not installed; skipping OmniRig integration.") |
| 498 |
endif() |
| 499 |
endif() |
| 500 |
|
| 501 |
# Windows icons require an RC file. |
| 502 |
|
| 503 |
target_sources(${TARGET} PRIVATE JS8_Include/js8call.rc) |
| 504 |
|
| 505 |
# Find the windeployqt command and run it against the generated binary, |
| 506 |
# which should handle all the gnarly bits. |
| 507 |
|
| 508 |
find_program(WINDEPLOYQT NAMES windeployqt HINTS "${QT_BIN_DIR}") |
| 509 |
add_custom_command( |
| 510 |
TARGET ${TARGET} |
| 511 |
POST_BUILD |
| 512 |
COMMAND "${WINDEPLOYQT}" "$<TARGET_FILE_DIR:${TARGET}>" |
| 513 |
--libdir JS8Call |
| 514 |
--plugindir JS8Call |
| 515 |
--no-translations |
| 516 |
COMMENT "Running windeployqt..." |
| 517 |
) |
| 518 |
endif (WIN32) |
| 519 |
|
| 520 |
#------------------------------------------------------------------------------# |