From 94f0af72e3c2edbb0b1ed7cc9404ca73f276114b Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Wed, 2 Dec 2020 01:53:36 +0000 Subject: [PATCH] Command line tool prints WSJT-X version to console, tnx Dave, W3DJS --- AppVersion/AppVersion.cpp | 43 +++++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 11 +++++++++- widgets/about.cpp | 2 +- 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 AppVersion/AppVersion.cpp diff --git a/AppVersion/AppVersion.cpp b/AppVersion/AppVersion.cpp new file mode 100644 index 000000000..26cac2c10 --- /dev/null +++ b/AppVersion/AppVersion.cpp @@ -0,0 +1,43 @@ +// +// wsjtx_app_version - a console application that outputs WSJT-X +// application version +// +// This application is only provided as a simple console application +// +// + +#include +#include +#include + +#include +#include +#include + +#include "revision_utils.hpp" + +int main (int argc, char * argv[]) +{ + QCoreApplication app {argc, argv}; + try + { + app.setApplicationName ("WSJT-X"); + app.setApplicationVersion (version()); + + QCommandLineParser parser; +// parser.setApplicationDescription ("\n" PROJECT_DESCRIPTION); + parser.addHelpOption (); + parser.addVersionOption (); + parser.process (app); + return EXIT_SUCCESS; + } + catch (std::exception const& e) + { + std::cerr << "Error: " << e.what () << '\n'; + } + catch (...) + { + std::cerr << "Unexpected error\n"; + } + return -1; +} diff --git a/CMakeLists.txt b/CMakeLists.txt index 1597eddca..e9c6db665 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1457,6 +1457,15 @@ generate_version_info (udp_daemon_VERSION_RESOURCES add_executable (udp_daemon UDPExamples/UDPDaemon.cpp ${udp_daemon_VERSION_RESOURCES}) 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} @@ -1516,7 +1525,7 @@ install (TARGETS wsjtx # DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/wsjtx # ) -install (TARGETS udp_daemon message_aggregator +install (TARGETS udp_daemon message_aggregator wsjtx_app_version RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime ) diff --git a/widgets/about.cpp b/widgets/about.cpp index b8e0fab43..908e6e38d 100644 --- a/widgets/about.cpp +++ b/widgets/about.cpp @@ -23,7 +23,7 @@ CAboutDlg::CAboutDlg(QWidget *parent) : "We gratefully acknowledge contributions from AC6SL, AE4JY,
" "DF2ET, DJ0OT, G3WDG, G4KLA, IV3NWV, IW3RAB, KA1GT, K3WYC,
" "KA6MAL, KA9Q, KB1ZMX, KD6EKQ, KI7MT, KK1D, ND0B, PY2SDR,
" - "VE1SKY, VK3ACF, VK4BDJ, VK7MO, W4TI, W4TV, and W9MDB.

" + "VE1SKY, VK3ACF, VK4BDJ, VK7MO, W3DJS, W4TI, W4TV, and W9MDB.

" "WSJT-X is licensed under the terms of Version 3
" "of the GNU General Public License (GPL)

" ""