diff --git a/CMakeLists.txt b/CMakeLists.txt index 6341bed64..ffd934f0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,14 +3,22 @@ cmake_policy(SET CMP0043 OLD) option(V4L-RTL "Use Linux Kernel RTL-SDR Source." OFF) option(V4L-MSI "Use Linux Kernel MSI2500 Source." OFF) +option(BUILD_TYPE "Build type (RELEASE, RELEASEWITHDBGINFO, DEBUG" RELEASE) +option(DEBUG_OUTPUT "Print debug messages" OFF) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) project(sdrangel) -set(CMAKE_BUILD_TYPE "Release") -#set(CMAKE_BUILD_TYPE "ReleaseWithDebugInfo") -#set(CMAKE_BUILD_TYPE "Debug") +if (BUILD_TYPE MATCHES RELEASE) + set(CMAKE_BUILD_TYPE "Release") +elseif (BUILD_TYPE MATCHES RELEASEWITHDBGINFO) + set(CMAKE_BUILD_TYPE "ReleaseWithDebugInfo") +elseif (BUILD_TYPE MATCHES DEBUG) + set(CMAKE_BUILD_TYPE "Debug") +else() + set(CMAKE_BUILD_TYPE "Release") +endif() set(QT_USE_QTOPENGL TRUE) set(CMAKE_AUTOMOC ON) @@ -33,8 +41,13 @@ ENDIF() ############################################################################## #include(${QT_USE_FILE}) -set( QT_DEFINITIONS "${QT_DEFINITIONS} -DQT_NO_DEBUG_OUTPUT" ) -#set( QT_DEFINITIONS "${QT_DEFINITIONS}" ) + +if (DEBUG_OUTPUT) + set( QT_DEFINITIONS "${QT_DEFINITIONS}" ) +else() + set( QT_DEFINITIONS "${QT_DEFINITIONS} -DQT_NO_DEBUG_OUTPUT" ) +endif() + add_definitions(${QT_DEFINITIONS}) if(MSVC) diff --git a/Readme.md b/Readme.md index de048a2ae..46774a49f 100644 --- a/Readme.md +++ b/Readme.md @@ -201,3 +201,15 @@ For Debian Jessie or Stretch: - Enhance WFM (stereo, RDS?) - Even more demods ... +

Developper's notes

+ +

Build options

+ +The release type can be specified with the `-DBUILD_TYPE` cmake option. It takes the following values: + - `RELEASE` (default): produces production release code i.e.optimized and no debug symbols + - `RELEASEWITHDBGINFO`: optimized with debug info + - `DEBUG`: unoptimized with debug info + +You can specify whether or not you want to see debug messages printed out to the console with the `-DDEBUG_OUTPUT` cmake option: + - `OFF` (default): no debug output + - `ON`: debug output \ No newline at end of file