From 245a6902c5b64cc34f9170e272dd4d69a8f1b300 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Thu, 19 Jun 2014 16:47:49 +0000 Subject: [PATCH] Added CMake option to control experimental features. Sometimes parts of the application are not fully ready for release at release time. This option allows such features to be enabled conditionally at configure time. The CMake option WSJT_ENABLE_EXPERIMENTAL_FEATURES is used to control this ability. Normally you will not need to change it as it behaves in a reasonable way. The option is ON in debug build configurations and OFF in non-debug configuratiuons. The option is made available in all source modules via the WSJT_ENABLE_EXPERIMENTAL_FEATURES macro which is defined to 1 if the option is ON and to 0 if it is OFF. Since this default behavior is potentially dangerous because it can mean that release builds contain different code from debug builds; the option may be set to OFF in debug configurations in the normal way (cmake-gui, edit CMakeCache.txt, etc.) to achieve a debug build similar to a default release build. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4182 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- CMakeLists.txt | 28 +++++++++++++++++++--------- Configuration.cpp | 4 ++++ Configuration.ui | 20 +++++++++++++------- mainwindow.cpp | 4 ++++ wsjtx_config.h.in | 1 + 5 files changed, 41 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 94d1e3aab..cc97ec924 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,17 @@ set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMake/Modules) include (${PROJECT_SOURCE_DIR}/CMake/VersionCompute.cmake) +# 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 () + + # # Options & features # @@ -47,6 +58,8 @@ include (${PROJECT_SOURCE_DIR}/CMake/VersionCompute.cmake) # wsjtx_config.h.in which makes them available to the C/C++ # pre-processor. # +include (CMakeDependentOption) + 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.") @@ -59,6 +72,10 @@ option (WSJT_STANDARD_FILE_LOCATIONS "All non-installation files located in \"St option (WSJT_SOFT_KEYING "Apply a ramp to CW keying envelope to reduce transients." ON) option (WSJT_SKIP_MANPAGES "Skip *nix manpage generation") +CMAKE_DEPENDENT_OPTION (WSJT_ENABLE_EXPERIMENTAL_FEATURES "Enable features not fully ready for public releases." ON + "is_debug_build" OFF) + + # # install locations # @@ -347,13 +364,6 @@ if (POLICY CMP0020) cmake_policy (SET CMP0020 NEW) # link to Qt winmain on Windows endif (POLICY CMP0020) -# make sure that the default 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) - # # decide on platform specifc packing and fixing up @@ -729,7 +739,7 @@ endif (NOT WIN32 AND NOT APPLE) # # bundle fixup only done in Release or MinSizeRel configurations # -if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") +if (NOT is_debug_build) # get_target_property (QtCore_location Qt5::Core LOCATION) # get_filename_component (QtCore_location ${QtCore_location} PATH) @@ -857,7 +867,7 @@ file (APPEND \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${WSJT_QT_CONF_DESTINATION ) endif (APPLE OR WIN32) -endif (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") +endif (NOT is_debug_build) # diff --git a/Configuration.cpp b/Configuration.cpp index 76be13ffe..3100c0e02 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -793,6 +793,10 @@ Configuration::impl::impl (Configuration * self, QString const& instance_key, QS initialise_models (); transceiver_thread_.start (); + +#if !WSJT_ENABLE_EXPERIMENTAL_FEATURES + ui_->jt9w_group_box->setEnabled (false); +#endif } Configuration::impl::~impl () diff --git a/Configuration.ui b/Configuration.ui index 6b315acf1..d214ff65a 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -6,10 +6,16 @@ 0 0 - 586 - 550 + 508 + 471 + + + 508 + 471 + + Configuration @@ -1815,12 +1821,12 @@ soundcard changes - - - - - + + + + + diff --git a/mainwindow.cpp b/mainwindow.cpp index 5ee0d3187..a2aae7de3 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -414,6 +414,10 @@ MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdme m_config.transceiver_online (true); qsy (m_lastMonitoredFrequency); monitor (!m_config.monitor_off_at_startup ()); + +#if !WSJT_ENABLE_EXPERIMENTAL_FEATURES + ui->actionJT9W_1->setEnabled (false); +#endif } //--------------------------------------------------- MainWindow destructor diff --git a/wsjtx_config.h.in b/wsjtx_config.h.in index 0d2769b57..f905727e9 100644 --- a/wsjtx_config.h.in +++ b/wsjtx_config.h.in @@ -24,6 +24,7 @@ #cmakedefine01 WSJT_HAMLIB_TRACE #cmakedefine01 WSJT_STANDARD_FILE_LOCATIONS #cmakedefine01 WSJT_SOFT_KEYING +#cmakedefine01 WSJT_ENABLE_EXPERIMENTAL_FEATURES #define WSJTX_STRINGIZE1(x) #x #define WSJTX_STRINGIZE(x) WSJTX_STRINGIZE1(x)