From: E. Scott Daniels Date: Mon, 30 Sep 2019 17:05:12 +0000 (-0400) Subject: Add ability to set debug via CMake (1.9.1) X-Git-Tag: 1.9.1^0 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=a1c1dc60f3d58d4ffb6bf55598b5134c9d69ca66;p=ric-plt%2Flib%2Frmr.git Add ability to set debug via CMake (1.9.1) This change allows the DEBUG flag to be supplied on the CMake command line, and adds instructions on how to do so in BUILD. Signed-off-by: E. Scott Daniels Change-Id: Ie5c6185a3016778c7e9c0d51c074c7592c114765 --- diff --git a/BUILD b/BUILD index 24e604f..681ba4c 100644 --- a/BUILD +++ b/BUILD @@ -173,4 +173,24 @@ and troff format. The troff pages are placed into the deb and the postscript pages are left in the build directory for the developer to convert to PDF, or otherwise use. - +Debug Mode +Because RMR is designed to keep its overhead to an absolute minimum, +messages written to standard error are by default very limited. +The route table collection thread provides the means to enable +debug messages on the fly, but only because that thread does not +impact the sending and receiving of user messages. + +If it becomes necessary, for development or problem soving, to have +the RMR functions generate debugging messages the following +CMake flag can be given when the CMake environment is created: + -DDEBUG=n + +The value for 'n' should be 1 or 2 to enable debugging. The default +when not given is the same as setting n to zero. + +When running in debug mode, RMR will log messages received, sent, +and other useful information. Because debugging uses fprintf() there +is a significant amount of overhead with logging this information and +thus in debugging mode the user should not expect that usual message +rates can be achieved, and in some cases may cause messages to drop +if TCP queues become full. diff --git a/CMakeLists.txt b/CMakeLists.txt index 3edb64c..6be67f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,7 +36,7 @@ cmake_minimum_required( VERSION 3.5 ) set( major_version "1" ) # should be automatically populated from git tag later, but until CI process sets a tag we use this set( minor_version "9" ) -set( patch_level "0" ) +set( patch_level "1" ) set( install_root "${CMAKE_INSTALL_PREFIX}" ) set( install_inc "include/rmr" ) @@ -95,13 +95,22 @@ execute_process( #list( GET mmp_version 1 minor_version ) #list( GET mmp_version 2 patch_level ) +if( DEBUG ) # if set, we'll set debugging on in the compile + set( debugging ${DEBUG} ) + message( "+++ debugging is being set to ${DEBUG}" ) +else() + set( debugging 0 ) + message( "+++ debugging is set to off" ) +endif() +unset( DEBUG CACHE ) # we don't want this to persist -# define constants used in the version string +# define constants used in the version string, debugging, etc. add_definitions( -DGIT_ID=${git_id} -DMAJOR_VER=${major_version} -DMINOR_VER=${minor_version} -DPATCH_VER=${patch_level} + -DDEBUG=${debugging} ) # ---------------- suss out pkg gen tools so we don't fail generating packages that the system cannot support --------------