Skip to content

Commit

Permalink
Use cmake options to specify build type and debug output so that CMak…
Browse files Browse the repository at this point in the history
…eList.txt needs not be modified to control this
  • Loading branch information
f4exb committed Oct 22, 2015
1 parent af58b0d commit 91cab6c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
23 changes: 18 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
12 changes: 12 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,15 @@ For Debian Jessie or Stretch:
- Enhance WFM (stereo, RDS?)
- Even more demods ...

<h1>Developper's notes</h1>

<h2>Build options</h2>

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

0 comments on commit 91cab6c

Please sign in to comment.