From: <bo...@us...> - 2009-05-01 09:44:38
|
Revision: 396 http://gearbox.svn.sourceforge.net/gearbox/?rev=396&view=rev Author: borax00 Date: 2009-05-01 09:44:22 +0000 (Fri, 01 May 2009) Log Message: ----------- MR changes Modified Paths: -------------- gearbox/trunk/CMakeLists.txt gearbox/trunk/cmake/DependencyUtils.cmake gearbox/trunk/cmake/TargetUtils.cmake gearbox/trunk/cmake/UseGearbox.cmake gearbox/trunk/cmake/internal/Setup.cmake gearbox/trunk/doc/buildsys.dox gearbox/trunk/doc/getting.dox gearbox/trunk/doc/history.dox gearbox/trunk/doc/install_debian.dox gearbox/trunk/src/gbxadvancedexample/CMakeLists.txt gearbox/trunk/src/gbxgarminacfr/CMakeLists.txt gearbox/trunk/src/gbxnovatelacfr/CMakeLists.txt gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/CMakeLists.txt gearbox/trunk/src/gbxserialacfr/CMakeLists.txt gearbox/trunk/src/gbxsickacfr/CMakeLists.txt gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/CMakeLists.txt gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/buffer.h gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/threadtest.cpp gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/thread.cpp gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/thread.h gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/timer.cpp gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/timer.h gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/CMakeLists.txt gearbox/trunk/src/gbxsmartbatteryacfr/CMakeLists.txt gearbox/trunk/src/gbxsmartbatteryacfr/gbxsmartbatteryacfr.h gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverparser.cpp gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverreader.h gearbox/trunk/src/gbxsmartbatteryacfr/oceanserversystem.cpp gearbox/trunk/src/gbxsmartbatteryacfr/oceanserversystem.h gearbox/trunk/src/gbxsmartbatteryacfr/test/longtest.cpp gearbox/trunk/src/gbxutilacfr/gbxutilacfr.h gearbox/trunk/src/gbxutilacfr/status.cpp gearbox/trunk/src/gbxutilacfr/status.h gearbox/trunk/src/gbxutilacfr/substatus.h gearbox/trunk/src/gbxutilacfr/trivialstatus.cpp gearbox/trunk/src/hokuyo_aist/CMakeLists.txt Modified: gearbox/trunk/CMakeLists.txt =================================================================== --- gearbox/trunk/CMakeLists.txt 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/CMakeLists.txt 2009-05-01 09:44:22 UTC (rev 396) @@ -6,13 +6,18 @@ # # project name # -PROJECT( gearbox ) +project( gearbox ) # -# project version string +# project version # -set( GBX_PROJECT_VERSION 9.02+ ) +set( GBX_PROJECT_VERSION_MAJOR "9" ) +set( GBX_PROJECT_VERSION_MINOR "02" ) +set( GBX_PROJECT_VERSION_PATCH "+" ) +set( GBX_PROJECT_VERSION + ${GBX_PROJECT_VERSION_MAJOR}.${GBX_PROJECT_VERSION_MINOR}.${GBX_PROJECT_VERSION_PATCH} ) + # # The rest is done by a script # Modified: gearbox/trunk/cmake/DependencyUtils.cmake =================================================================== --- gearbox/trunk/cmake/DependencyUtils.cmake 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/cmake/DependencyUtils.cmake 2009-05-01 09:44:22 UTC (rev 396) @@ -1,18 +1,31 @@ # # This is a utility macro for internal use. +# If module_type is not equal "EXE" or "LIB", prints error message and quits. # -macro( GBX_MAKE_OPTION_NAME option_name module_type module_name ) -# message( STATUS "GBX_MAKE_OPTION_NAME [ option_name=${option_name}, MOT_TYPE=${module_type}, MOD_NAME=${module_name} ]" ) +macro( GBX_UTIL_CHECK_MODULE_TYPE type ) +# message( STATUS "GBX_UTIL_CHECK_MODULE_TYPE type=${type}" ) - string( COMPARE EQUAL ${module_type} "EXE" is_exe ) - string( COMPARE EQUAL ${module_type} "LIB" is_lib ) + string( COMPARE EQUAL ${type} "EXE" is_exe ) + string( COMPARE EQUAL ${type} "LIB" is_lib ) if( NOT is_exe AND NOT is_lib ) - message( FATAL_ERROR "In macro GBX_MAKE_OPTION_NAME, module_type must be either 'EXE' or 'LIB'" ) + message( FATAL_ERROR "In GBX_REQUIRE_* macros, module_type must be either 'EXE' or 'LIB'" ) endif( NOT is_exe AND NOT is_lib ) if( is_exe AND is_lib ) - message( FATAL_ERROR "In macro GBX_MAKE_OPTION_NAME, module_type must be either 'EXE' or 'LIB'" ) + message( FATAL_ERROR "In GBX_REQUIRE_* macros, module_type must be either 'EXE' or 'LIB'" ) endif( is_exe AND is_lib ) +endmacro( GBX_UTIL_CHECK_MODULE_TYPE type ) + +# +# This is a utility macro for internal use. +# +macro( GBX_UTIL_MAKE_OPTION_NAME option_name module_type module_name ) +# message( STATUS "GBX_UTIL_MAKE_OPTION_NAME [ option_name=${option_name}, MOT_TYPE=${module_type}, MOD_NAME=${module_name} ]" ) + + GBX_UTIL_CHECK_MODULE_TYPE( ${module_type} ) + + string( COMPARE EQUAL ${module_type} "EXE" is_exe ) + string( COMPARE EQUAL ${module_type} "LIB" is_lib ) string( TOUPPER ${module_name} module_name_upper ) # dereference the variable name once, so that we are setting the variable in the calling context! if( is_exe ) @@ -21,23 +34,24 @@ set( ${option_name} "ENABLE_LIB_${module_name_upper}" ) endif( is_exe ) -# message( STATUS "GBX_MAKE_OPTION_NAME output: option_name=${${option_name}}" ) -endmacro( GBX_MAKE_OPTION_NAME option_name module_name ) +# message( STATUS "GBX_UTIL_MAKE_OPTION_NAME output: option_name=${${option_name}}" ) +endmacro( GBX_UTIL_MAKE_OPTION_NAME option_name module_name ) # # This is a utility macro for internal use. # (there's another copy of this simple macro in TargetUtils.cmake) # -macro( GBX_MAKE_MANIFEST_NAME manifest_name module_name ) -# message( STATUS "GBX_MAKE_MANIFEST_NAME [ manifest_name=${manifest_name}, MOD_NAME=${module_name} ]" ) +# macro( GBX_UTIL_MAKE_MANIFEST_NAME manifest_name module_name ) +# # message( STATUS "GBX_UTIL_MAKE_MANIFEST_NAME [ manifest_name=${manifest_name}, MOD_NAME=${module_name} ]" ) +# +# string( TOUPPER ${module_name} module_name_upper ) +# # dereference the variable name once, so that we are setting the variable in the calling context! +# set( ${manifest_name} ${module_name_upper}_INSTALLED ) +# +# # message( STATUS "GBX_UTIL_MAKE_MANIFEST_NAME output: manifest_name=${${manifest_name}}" ) +# endmacro( GBX_UTIL_MAKE_MANIFEST_NAME manifest_name module_name ) - string( TOUPPER ${module_name} module_name_upper ) - # dereference the variable name once, so that we are setting the variable in the calling context! - set( ${manifest_name} ${module_name_upper}_INSTALLED ) -# message( STATUS "GBX_MAKE_MANIFEST_NAME output: manifest_name=${${manifest_name}}" ) -endmacro( GBX_MAKE_MANIFEST_NAME manifest_name module_name ) - # # GBX_REQUIRE_OPTION( cumulative_var [EXE | LIB] module_name default_option_value [option_name] [OPTION DESCRIPTION] ) # @@ -51,19 +65,10 @@ # macro( GBX_REQUIRE_OPTION cumulative_var module_type module_name default_option_value ) - string( COMPARE EQUAL ${module_type} "EXE" is_exe ) - string( COMPARE EQUAL ${module_type} "LIB" is_lib ) - if( NOT is_exe AND NOT is_lib ) - message( FATAL_ERROR "In macro GBX_REQUIRE_OPTION, module_type must be either 'EXE' or 'LIB'" ) - endif( NOT is_exe AND NOT is_lib ) - if( is_exe AND is_lib ) - message( FATAL_ERROR "In macro GBX_REQUIRE_OPTION, module_type must be either 'EXE' or 'LIB'" ) - endif( is_exe AND is_lib ) - if( ${ARGC} GREATER 5 ) set( option_name ${ARGV6} ) else( ${ARGC} GREATER 5 ) - GBX_MAKE_OPTION_NAME( option_name ${module_type} ${module_name} ) + GBX_UTIL_MAKE_OPTION_NAME( option_name ${module_type} ${module_name} ) endif( ${ARGC} GREATER 5 ) if( ${ARGC} GREATER 6 ) @@ -95,7 +100,7 @@ if( ${cumulative_var} AND NOT ${option_name} ) set( ${cumulative_var} FALSE ) if( is_exe ) - GBX_NOT_add_executable( ${module_name} ${option_descr} ) + GBX_NOT_ADD_EXECUTABLE( ${module_name} ${option_descr} ) else( is_exe ) GBX_NOT_add_library( ${module_name} ${option_descr} ) endif( is_exe ) @@ -117,20 +122,13 @@ # debug # message( STATUS "GBX_REQUIRE_VAR [ CUM_VAR=${cumulative_var}, MOD_TYPE=${module_type}, MOD_NAME=${module_name}, test_var=${${test_var}}, reason=${reason} ]" ) - string( COMPARE EQUAL ${module_type} "EXE" is_exe ) - string( COMPARE EQUAL ${module_type} "LIB" is_lib ) - if( NOT is_exe AND NOT is_lib ) - message( FATAL_ERROR "In macro GBX_REQUIRE_VAR, module_type must be either 'EXE' or 'LIB'" ) - endif( NOT is_exe AND NOT is_lib ) - if( is_exe AND is_lib ) - message( FATAL_ERROR "In macro GBX_REQUIRE_VAR, module_type must be either 'EXE' or 'LIB'" ) - endif( is_exe AND is_lib ) + GBX_UTIL_CHECK_MODULE_TYPE( ${module_type} ) # must dereference both var names once (!) and IF will evaluate their values if( ${cumulative_var} AND NOT ${test_var} ) set( ${cumulative_var} FALSE ) if( is_exe ) - GBX_NOT_add_executable( ${module_name} ${reason} ) + GBX_NOT_ADD_EXECUTABLE( ${module_name} ${reason} ) else( is_exe ) GBX_NOT_add_library( ${module_name} ${reason} ) endif( is_exe ) @@ -138,6 +136,7 @@ endmacro( GBX_REQUIRE_VAR cumulative_var module_type module_name test_var reason ) +# OBSOLETE! CONVERTED FROM HOME-MADE MANIFESTS TO FIND_PACKAGE() # # GBX_REQUIRE_install( cumulative_var [EXE | LIB] module_name installed_module [reason] ) # @@ -152,107 +151,108 @@ # This example is equivalent to # REQUIRE_VAR( build LIB HydroStuff GBXSTUFF_INSTALLED "GbxStuff was not installed" ) # -macro( GBX_REQUIRE_INSTALL cumulative_var module_type module_name installed_module ) +# macro( GBX_REQUIRE_INSTALL cumulative_var module_type module_name installed_module ) +# +# # debug +# # message( STATUS "GBX_REQUIRE_INSTALL [ CUM_VAR=${cumulative_var}, MOD_TYPE=${module_type}, MOD_NAME=${module_name}, installed_module=${installed_module} ]" ) +# +# GBX_UTIL_MAKE_MANIFEST_NAME( test_var ${installed_module} ) +# +# if( ${ARGC} GREATER 5 ) +# set( reason ${ARGV6} ) +# else( ${ARGC} GREATER 5 ) +# set( reason "${installed_module} was not installed" ) +# endif( ${ARGC} GREATER 5 ) +# +# # must dereference both var names once (!) +# GBX_REQUIRE_VAR( ${cumulative_var} ${module_type} ${module_name} ${test_var} ${reason} ) +# +# endmacro( GBX_REQUIRE_INSTALL cumulative_var module_type module_name installed_module ) - # debug -# message( STATUS "GBX_REQUIRE_INSTALL [ CUM_VAR=${cumulative_var}, MOD_TYPE=${module_type}, MOD_NAME=${module_name}, installed_module=${installed_module} ]" ) - - GBX_MAKE_MANIFEST_NAME( test_var ${installed_module} ) - - if( ${ARGC} GREATER 5 ) - set( reason ${ARGV6} ) - else( ${ARGC} GREATER 5 ) - set( reason "${installed_module} was not installed" ) - endif( ${ARGC} GREATER 5 ) - - # must dereference both var names once (!) - GBX_REQUIRE_VAR( ${cumulative_var} ${module_type} ${module_name} ${test_var} ${reason} ) - -endmacro( GBX_REQUIRE_INSTALL cumulative_var module_type module_name installed_module ) - +# OBSOLETE! CONVERTED FROM HOME-MADE MANIFESTS TO FIND_PACKAGE() # # GBX_REQUIRE_INSTALLS( cumulative_var [EXE | LIB] module_name target0 [targe1 target2 ...] ) # -macro( GBX_REQUIRE_INSTALLS cumulative_var module_type module_name ) - - if( ${ARGC} LESS 4 ) - message( FATAL_ERROR "GBX_REQUIRE_INSTALLS macro needs to at least one target name (${ARGC} params were given)." ) - endif( ${ARGC} LESS 4 ) +# macro( GBX_REQUIRE_INSTALLS cumulative_var module_type module_name ) +# +# if( ${ARGC} LESS 4 ) +# message( FATAL_ERROR "GBX_REQUIRE_INSTALLS macro needs to at least one target name (${ARGC} params were given)." ) +# endif( ${ARGC} LESS 4 ) +# +# foreach( trgt ${ARGN} ) +# GBX_REQUIRE_install( ${cumulative_var} ${module_type} ${module_name} ${trgt} ) +# endforeach( trgt ${ARGN} ) +# +# endmacro( GBX_REQUIRE_INSTALLS cumulative_var module_type module_name ) - foreach( trgt ${ARGN} ) - GBX_REQUIRE_install( ${cumulative_var} ${module_type} ${module_name} ${trgt} ) - endforeach( trgt ${ARGN} ) - -endmacro( GBX_REQUIRE_INSTALLS cumulative_var module_type module_name ) - # -# GBX_REQUIRE_TARGET( cumulative_var [EXE | LIB] module_name target_name [reason] ) +# GBX_REQUIRE_LIB( cumulative_var [EXE | LIB] module_name target_name [reason] ) # +# Despite the name, this macro can enforce dependence on any target, not just a library. +# # E.g. # Initialize a variable first # set( build TRUE ) # Now set up and test option value -# GBX_REQUIRE_TARGET ( build EXE localiser HydroStuff ) +# GBX_REQUIRE_LIB ( build EXE localiser HydroStuff ) # -macro( GBX_REQUIRE_TARGET cumulative_var module_type module_name target_name ) - +macro( GBX_REQUIRE_LIB cumulative_var module_type module_name target_name ) # debug -# message( STATUS "GBX_REQUIRE_TARGET [ CUM_VAR=${${cumulative_var}}, MOD_TYPE=${module_type}, MOD_NAME=${module_name}, target_name=${target_name} ]" ) +# message( STATUS "GBX_REQUIRE_LIB [ CUM_VAR=${${cumulative_var}}, MOD_TYPE=${module_type}, MOD_NAME=${module_name}, target_name=${target_name} ]" ) - string( COMPARE EQUAL ${module_type} "EXE" is_exe ) - string( COMPARE EQUAL ${module_type} "LIB" is_lib ) - if( NOT is_exe AND NOT is_lib ) - message( FATAL_ERROR "In macro GBX_REQUIRE_TARGET, module_type must be either 'EXE' or 'LIB'" ) - endif( NOT is_exe AND NOT is_lib ) - if( is_exe AND is_lib ) - message( FATAL_ERROR "In macro GBX_REQUIRE_TARGET, module_type must be either 'EXE' or 'LIB'" ) - endif( is_exe AND is_lib ) + if( ${cumulative_var} ) - if( ${ARGC} GREATER 5 ) - set( reason ${ARGV6} ) - else( ${ARGC} GREATER 5 ) - set( reason "${target_name} is not being built" ) - endif( ${ARGC} GREATER 5 ) + GBX_UTIL_CHECK_MODULE_TYPE( ${module_type} ) + + if( ${ARGC} GREATER 5 ) + set( reason ${ARGV6} ) + else( ${ARGC} GREATER 5 ) + set( reason "${target_name} is not being built" ) + endif( ${ARGC} GREATER 5 ) + + GET_TARGET_PROPERTY( target_location ${target_name} LOCATION ) + + # must dereference both var and option names once (!) and IF will evaluate their values + if( NOT target_location ) + set( ${cumulative_var} FALSE ) + GBX_UTIL_MAKE_OPTION_NAME( option_name ${module_type} ${module_name} ) + if( is_exe ) + GBX_NOT_ADD_EXECUTABLE( ${module_name} ${reason} ) + set( ${option_name} OFF CACHE BOOL "Try to build ${module_name}" FORCE ) + else( is_exe ) + GBX_NOT_add_library( ${module_name} ${reason} ) + set( ${option_name} OFF CACHE BOOL "Try to build lib${module_name} library" FORCE ) + endif( is_exe ) + endif( NOT target_location ) - GET_TARGET_PROPERTY( target_location ${target_name} LOCATION ) + endif( ${cumulative_var} ) - # must dereference both var and option names once (!) and IF will evaluate their values - if( ${cumulative_var} AND NOT target_location ) - set( ${cumulative_var} FALSE ) - GBX_MAKE_OPTION_NAME( option_name ${module_type} ${module_name} ) - if( is_exe ) - GBX_NOT_add_executable( ${module_name} ${reason} ) - set( ${option_name} OFF CACHE BOOL "Try to build ${module_name}" FORCE ) - else( is_exe ) - GBX_NOT_add_library( ${module_name} ${reason} ) - set( ${option_name} OFF CACHE BOOL "Try to build lib${module_name} library" FORCE ) - endif( is_exe ) - endif( ${cumulative_var} AND NOT target_location ) +endmacro( GBX_REQUIRE_LIB cumulative_var module_type module_name target_name ) -endmacro( GBX_REQUIRE_TARGET cumulative_var module_type module_name target_name ) - # -# GBX_REQUIRE_TARGETS( cumulative_var [EXE | LIB] module_name TARGET0 [TARGET1 TARGET2 ...] ) +# GBX_REQUIRE_LIBS( cumulative_var [EXE | LIB] module_name TARGET0 [TARGET1 TARGET2 ...] ) # -macro( GBX_REQUIRE_TARGETS cumulative_var module_type module_name ) - +# Despite the name, this macro can enforce dependence on a set of target, not just a set of libraries. +# +macro( GBX_REQUIRE_LIBS cumulative_var module_type module_name ) # debug -# message( STATUS "GBX_REQUIRE_TARGETS [ CUM_VAR=${${cumulative_var}}, MOD_TYPE=${module_type}, MOD_NAME=${module_name}, target_names=${ARGN} ]" ) +# message( STATUS "GBX_REQUIRE_LIBS [ CUM_VAR=${${cumulative_var}}, MOD_TYPE=${module_type}, MOD_NAME=${module_name}, target_names=${ARGN} ]" ) if( ${ARGC} LESS 4 ) - message( FATAL_ERROR "GBX_REQUIRE_TARGETS macro needs to at least one target name (${ARGC} params were given)." ) + message( FATAL_ERROR "GBX_REQUIRE_LIBS macro needs to at least one target name (${ARGC} params were given)." ) endif( ${ARGC} LESS 4 ) foreach( trgt ${ARGN} ) - GBX_REQUIRE_TARGET( ${cumulative_var} ${module_type} ${module_name} ${trgt} ) + GBX_REQUIRE_LIB( ${cumulative_var} ${module_type} ${module_name} ${trgt} ) endforeach( trgt ${ARGN} ) -endmacro( GBX_REQUIRE_TARGETS cumulative_var module_type module_name ) +endmacro( GBX_REQUIRE_LIBS cumulative_var module_type module_name ) +# OBSOLETE! Use GBX_REQUIRE_LIB instead. # # GBX_REQUIRE_LIB( cumulative_var [EXE | LIB] module_name depend_name [reason] ) # -# This is a convenience macro which combines the functionality of GBX_REQUIRE_INSTALL and GBX_REQUIRE_TARGET. +# This is a convenience macro which combines the functionality of GBX_REQUIRE_INSTALL and GBX_REQUIRE_LIB. # It can be used to require executables despite the name. # # First checks if a target called ${depend_name} exists, i.e. a library or executable with this name @@ -265,63 +265,57 @@ # Initialize a variable first # set( build TRUE ) # Now set up and test option value -# GBX_REQUIRE_TARGET ( build EXE localiser HydroStuff ) -# GBX_REQUIRE_TARGET ( build LIB MyStuff HydroStuff ) +# GBX_REQUIRE_LIB ( build EXE localiser HydroStuff ) +# GBX_REQUIRE_LIB ( build LIB MyStuff HydroStuff ) # -macro( GBX_REQUIRE_LIB cumulative_var module_type module_name depend_name ) -# message( STATUS "GBX_REQUIRE_LIB [ CUM_VAR=${${cumulative_var}}, MOD_TYPE=${module_type}, MOD_NAME=${module_name}, depend_name=${depend_name} ]" ) +# macro( GBX_REQUIRE_LIB cumulative_var module_type module_name depend_name ) +# # message( STATUS "GBX_REQUIRE_LIB [ CUM_VAR=${${cumulative_var}}, MOD_TYPE=${module_type}, MOD_NAME=${module_name}, depend_name=${depend_name} ]" ) +# +# if( ${cumulative_var} ) +# +# GBX_UTIL_CHECK_MODULE_TYPE( ${module_type} ) +# +# if( ${ARGC} GREATER 5 ) +# set( reason ${ARGV6} ) +# else( ${ARGC} GREATER 5 ) +# set( reason "${depend_name} is not being built and was not installed" ) +# endif( ${ARGC} GREATER 5 ) +# +# # first, look for a target +# GET_TARGET_PROPERTY( target_location ${depend_name} LOCATION ) +# +# # must dereference both var and option names once (!) and IF will evaluate their values +# if( NOT target_location ) +# +# # target not found, look for an install +# GBX_UTIL_MAKE_MANIFEST_NAME( test_var ${depend_name} ) +# +# # must dereference both var names once (!) +# GBX_REQUIRE_VAR( ${cumulative_var} ${module_type} ${module_name} ${test_var} ${reason} ) +# +# endif( NOT target_location ) +# +# endif( ${cumulative_var} ) +# +# endmacro( GBX_REQUIRE_LIB cumulative_var module_type module_name target_name ) - if( ${cumulative_var} ) - - string( COMPARE EQUAL ${module_type} "EXE" is_exe ) - string( COMPARE EQUAL ${module_type} "LIB" is_lib ) - if( NOT is_exe AND NOT is_lib ) - message( FATAL_ERROR "In macro GBX_REQUIRE_LIB, module_type must be either 'EXE' or 'LIB'" ) - endif( NOT is_exe AND NOT is_lib ) - if( is_exe AND is_lib ) - message( FATAL_ERROR "In macro GBX_REQUIRE_LIB, module_type must be either 'EXE' or 'LIB'" ) - endif( is_exe AND is_lib ) - - if( ${ARGC} GREATER 5 ) - set( reason ${ARGV6} ) - else( ${ARGC} GREATER 5 ) - set( reason "${depend_name} is not being built and was not installed" ) - endif( ${ARGC} GREATER 5 ) - - # first, look for a target - GET_TARGET_PROPERTY( target_location ${depend_name} LOCATION ) - - # must dereference both var and option names once (!) and IF will evaluate their values - if( NOT target_location ) - - # target not found, look for an install - GBX_MAKE_MANIFEST_NAME( test_var ${depend_name} ) - - # must dereference both var names once (!) - GBX_REQUIRE_VAR( ${cumulative_var} ${module_type} ${module_name} ${test_var} ${reason} ) - - endif( NOT target_location ) - - endif( ${cumulative_var} ) - -endmacro( GBX_REQUIRE_LIB cumulative_var module_type module_name target_name ) - +# OBSOLETE! Use GBX_REQUIRE_LIBS instead. # # GBX_REQUIRE_LIBS( cumulative_var [EXE | LIB] module_name LIB0 [LIB1 LIB2 ...] ) # -macro( GBX_REQUIRE_LIBS cumulative_var module_type module_name ) -# message( STATUS "GBX_REQUIRE_LIBS [ CUM_VAR=${${cumulative_var}}, MOD_TYPE=${module_type}, MOD_NAME=${module_name}, target_names=${ARGN} ]" ) +# macro( GBX_REQUIRE_LIBS cumulative_var module_type module_name ) +# # message( STATUS "GBX_REQUIRE_LIBS [ CUM_VAR=${${cumulative_var}}, MOD_TYPE=${module_type}, MOD_NAME=${module_name}, target_names=${ARGN} ]" ) +# +# if( ${ARGC} LESS 4 ) +# message( FATAL_ERROR "GBX_REQUIRE_LIBS macro needs to at least one library name (${ARGC} params were given)." ) +# endif( ${ARGC} LESS 4 ) +# +# foreach( lib ${ARGN} ) +# GBX_REQUIRE_LIB( ${cumulative_var} ${module_type} ${module_name} ${lib} ) +# endforeach( lib ${ARGN} ) +# +# endmacro( GBX_REQUIRE_LIBS cumulative_var module_type module_name ) - if( ${ARGC} LESS 4 ) - message( FATAL_ERROR "GBX_REQUIRE_LIBS macro needs to at least one library name (${ARGC} params were given)." ) - endif( ${ARGC} LESS 4 ) - - foreach( lib ${ARGN} ) - GBX_REQUIRE_LIB( ${cumulative_var} ${module_type} ${module_name} ${lib} ) - endforeach( lib ${ARGN} ) - -endmacro( GBX_REQUIRE_LIBS cumulative_var module_type module_name ) - # # This is a utility macro for internal use. # Modified: gearbox/trunk/cmake/TargetUtils.cmake =================================================================== --- gearbox/trunk/cmake/TargetUtils.cmake 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/cmake/TargetUtils.cmake 2009-05-01 09:44:22 UTC (rev 396) @@ -5,6 +5,31 @@ mark_as_advanced( GBX_DEFAULT_LIB_TYPE ) # +# Default preference for installing header files. +# +set( GBX_INSTALL_HEADERS TRUE CACHE BOOLEAN "Do you want to install header files?" ) +mark_as_advanced( GBX_INSTALL_HEADERS ) + +# +# Default preference for installing shared files. +# +set( GBX_INSTALL_SHARED_FILES TRUE CACHE BOOLEAN "Do you want to install shared files?" ) +mark_as_advanced( GBX_INSTALL_SHARED_FILES ) + +# +# Default preference for installing examples. +# +set( GBX_INSTALL_EXAMPLES TRUE CACHE BOOLEAN "Do you want to install example files?" ) +mark_as_advanced( GBX_INSTALL_EXAMPLES ) + +# +# Default preference for installing PKGCONFIG's. +# +set( GBX_INSTALL_PKGCONFIGS TRUE CACHE BOOLEAN "Do you want to install PKGCONFIG's files?" ) +mark_as_advanced( GBX_INSTALL_PKGCONFIGS ) + + +# # Executables should add themselves by calling 'GBX_ADD_EXECUTABLE' # instead of 'ADD_EXECUTABLE' in CMakeLists.txt. # Usage is the same as ADD_EXECUTABLE, all parameters are passed to ADD_EXECUTABLE. @@ -51,7 +76,9 @@ # SET_TARGET_PROPERTIES( ${name} PROPERTIES # INSTALL_RPATH "${INSTALL_RPATH};${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}" # BUILD_WITH_INSTALL_RPATH TRUE ) - install( TARGETS ${name} DESTINATION lib/${PROJECT_NAME} ) + install( TARGETS ${name} + DESTINATION lib/${PROJECT_NAME} + EXPORT ${PROJECT_NAME}-targets ) set( templist ${LIB_LIST} ) list( APPEND templist ${name} ) @@ -72,7 +99,9 @@ # All files are installed into PREFIX/include/${PROJECT_NAME}/${install_subdir} # macro( GBX_ADD_HEADERS install_subdir ) - install( FILES ${ARGN} DESTINATION include/${PROJECT_NAME}/${install_subdir} ) + if( GBX_INSTALL_HEADERS ) + install( FILES ${ARGN} DESTINATION include/${PROJECT_NAME}/${install_subdir} ) + endif() endmacro( GBX_ADD_HEADERS install_subdir ) # # GBX_ADD_SHARED_FILES( install_subdir FILE0 [FILE1 FILE2 ...] ) @@ -81,7 +110,9 @@ # All files are installed into PREFIX/share/${PROJECT_NAME}/${install_subdir} directory. # macro( GBX_ADD_SHARED_FILES install_subdir ) - install( FILES ${ARGN} DESTINATION share/${PROJECT_NAME}/${install_subdir} ) + if( GBX_INSTALL_SHARED_FILES ) + install( FILES ${ARGN} DESTINATION share/${PROJECT_NAME}/${install_subdir} ) + endif() endmacro( GBX_ADD_SHARED_FILES install_subdir ) # @@ -94,8 +125,10 @@ # macro( GBX_ADD_EXAMPLE install_subdir makefile.in makefile.out ) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/${makefile.in} ${CMAKE_CURRENT_BINARY_DIR}/${makefile.out} @ONLY) - install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${makefile.out} DESTINATION share/${PROJECT_NAME}/${install_subdir} RENAME CMakeLists.txt ) - install( FILES ${ARGN} DESTINATION share/${PROJECT_NAME}/${install_subdir} ) + if( GBX_INSTALL_EXAMPLES ) + install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${makefile.out} DESTINATION share/${PROJECT_NAME}/${install_subdir} RENAME CMakeLists.txt ) + install( FILES ${ARGN} DESTINATION share/${PROJECT_NAME}/${install_subdir} ) + endif() endmacro( GBX_ADD_EXAMPLE install_subdir makefile ) # @@ -123,7 +156,10 @@ endif( ${int_deps} ) configure_file( ${GBX_CMAKE_DIR}/pkgconfig.in ${CMAKE_CURRENT_BINARY_DIR}/${name}.pc @ONLY) - install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.pc DESTINATION lib/pkgconfig/ ) + + if( GBX_INSTALL_PKGCONFIGS ) + install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.pc DESTINATION lib/pkgconfig/ ) + endif() endmacro( GBX_ADD_PKGCONFIG name desc cflags deps libflags libs ) # Modified: gearbox/trunk/cmake/UseGearbox.cmake =================================================================== --- gearbox/trunk/cmake/UseGearbox.cmake 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/cmake/UseGearbox.cmake 2009-05-01 09:44:22 UTC (rev 396) @@ -1,6 +1,9 @@ # This script is indended for Gearbox users (not for internal use) # Assumes that a variable GEARBOX_INCLUDE_DIR is defined. -# Variable GEARBOX_LINK_DIR only needs to be defined if you're using a gearbox installation (as opposed to a local gearbox repository) +# Variable GEARBOX_LINK_DIR only needs to be defined if you're using a gearbox +# installation (as opposed to a local gearbox repository) include_directories( ${GEARBOX_INCLUDE_DIR} ) link_directories( ${GEARBOX_LINK_DIR} ) + +# Not linking to specific libraries, it's up to the user which ones to link to. Modified: gearbox/trunk/cmake/internal/Setup.cmake =================================================================== --- gearbox/trunk/cmake/internal/Setup.cmake 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/cmake/internal/Setup.cmake 2009-05-01 09:44:22 UTC (rev 396) @@ -17,6 +17,11 @@ set( GBX_CMAKE_DIR ${${PROJECT_NAME}_SOURCE_DIR}/cmake CACHE INTERNAL "Location of CMake scripts" ) # +# Process project name +# +include( ${GBX_CMAKE_DIR}/SetupProjectName.cmake ) + +# # Process version number # include( ${GBX_CMAKE_DIR}/SetupVersion.cmake ) @@ -86,7 +91,7 @@ # Enable testing by including the Dart module # (must be done *before* entering source directories ) include(${CMAKE_ROOT}/Modules/Dart.cmake) -ENABLE_TESTING() +enable_testing() # # Enter the source tree @@ -99,10 +104,15 @@ add_subdirectory( cmake ) # +# Experimental +# +include( ${GBX_CMAKE_DIR}/WritePackageConfig.cmake ) + +# # Write results of CMake activity to file # -GBX_WRITE_MANIFEST() -GBX_WRITE_OPTIONS() +# GBX_WRITE_MANIFEST() +# GBX_WRITE_OPTIONS() # # Print license information to a file Modified: gearbox/trunk/doc/buildsys.dox =================================================================== --- gearbox/trunk/doc/buildsys.dox 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/doc/buildsys.dox 2009-05-01 09:44:22 UTC (rev 396) @@ -186,13 +186,24 @@ @endverbatim Don't forget to close the IF structure. Notice that CMake is quite strict with @c IF statements: the signature of the closing @c ENDIF must be identical. -@section gbx_doc_buildsys_varlist A list of useful CMake variables defined by GearBox +@section gbx_doc_buildsys_varlist A comprehensive list of CMake variables defined by GearBox Build system configuration: @verbatim GBX_DEFAULT_LIB_TYPE # Valid options {SHARED, STATIC}. Defaults to SHARED. @endverbatim +Project description: +@verbatim +GBX_PROJECT_VERSION_MAJOR +GBX_PROJECT_VERSION_MINOR +GBX_PROJECT_VERSION_PATCH +GBX_PROJECT_VERSION (=MAJOR.MINOR.PATCH) +GBX_PROJECT_NAME_LOWER (e.g. 'gearbox' ) +GBX_PROJECT_NAME_UPPER (e.g. 'GEARBOX' ) +GBX_PROJECT_NAME_CAP (e.g. 'Gearbox' ) +@endverbatim + OS variables: evaluate to TRUE when running on the corresponding OS, otherwise to FALSE. We define our own because the standard CMake ones are inconsistently named and the one for Linux is not defined. @verbatim GBX_OS_LINUX @@ -201,7 +212,7 @@ GBX_OS_WIN @endverbatim -Path variables: +Path variables for the current project: @verbatim GBX_BIN_INSTALL_DIR GBX_LIB_INSTALL_DIR Modified: gearbox/trunk/doc/getting.dox =================================================================== --- gearbox/trunk/doc/getting.dox 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/doc/getting.dox 2009-05-01 09:44:22 UTC (rev 396) @@ -38,7 +38,7 @@ The instructions below are quite general, follow them if your platform/distribution combination is not described above: -# Download and install <a href="http://www.cmake.org/">CMake: Cross-Platform Make</a> which is used to build the GearBox distribution. - - Minimum version required 2.4-patch 4 (latest tested: 2.4-patch 7). + - Minimum version required 2.4-patch 4 (latest tested: 2.6-patch 3). - Full instructions are available from the <a href="http://www.cmake.org/HTML/Download.html">download page</a>. -# Download and install any optional dependencies you'd like. Or just skip this step and do it later. - You may want to take a look at our notes on @ref gbx_doc_depends. Modified: gearbox/trunk/doc/history.dox =================================================================== --- gearbox/trunk/doc/history.dox 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/doc/history.dox 2009-05-01 09:44:22 UTC (rev 396) @@ -31,15 +31,31 @@ - Added a hook in the CMake setup to allow building Gearbox as part of a bigger "super-project". Default behavior is not modified. (tobie,alexm) - Changed format style of CMake files. Standard functions are low-case. Custom macros are upper case. "Local" variables are low-case. "Global" and cache variables are upper-case. (alexm) + - Added 4 advanced CMake variables to let user control what gets installed and what not. All are set to TRUE by default. + To disable installation, set a variable to FALSE on the command line: 'cmake -DGBX_INSTALL_HEADERS=false'. The + variables are: + - GBX_INSTALL_HEADERS + - GBX_INSTALL_SHARED_FILES + - GBX_INSTALL_EXAMPLES + - GBX_INSTALL_PKGCONFIGS @par New libraries @par Updated libraries +- libGbxUtilAcfr: + - Status class: removed SubsystemStalled from the list of health types for a subsystem. The stall condition + now needs to be defined as part of the state of the monitor. (alexm) + - Added SubHealth class: a delegator which has access to health function of one subsystem. (alexm) + - Added Stoppable class: a light interface class representing stoppable activities. (alexm) + - libGbxIceUtilAcfr: - Changed names in buffer.h to make it more intuitive, fixed comments (AlexB). + - Timer class: added constructor with non-zero elapsed time (alexm) + - Thread class: now derives from gbxutilacfr::Stoppable. No changes in user code are requried. (alexm) + - Function checkedSleep() is defined in terms of the new light interface class gbxutilacfr::Stoppable. + No changes in user code are required. (alexm) - @section gbx_doc_history_902 Changes in Release 9.02 @par New libraries Modified: gearbox/trunk/doc/install_debian.dox =================================================================== --- gearbox/trunk/doc/install_debian.dox 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/doc/install_debian.dox 2009-05-01 09:44:22 UTC (rev 396) @@ -12,13 +12,13 @@ @page gbx_doc_installdebian Installing GearBox on Debian Linux -@note Reviewed for release 0.0.1 +@note Reviewed for release 9.02 These are detailed instructions for installing GearBox on Debian Linux. They are known to work for a system using Debian \b Testing distribution. These instructions should also be applicable to Ubuntu/Kubuntu 6.10 (Edgy). See @ref gbx_doc_getting for general guidelines. @section gbx_doc_installdebian_cmake CMake -Minimum version required 2.4-patch 4 (latest tested: 2.4-patch 8). +Minimum version required 2.4-patch 4 (latest tested: 2.6-patch 3). @verbatim # apt-get install cmake Modified: gearbox/trunk/src/gbxadvancedexample/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxadvancedexample/CMakeLists.txt 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxadvancedexample/CMakeLists.txt 2009-05-01 09:44:22 UTC (rev 396) @@ -6,7 +6,7 @@ GBX_REQUIRE_VAR( build LIB ${lib_name} GBX_OS_LINUX "only Linux OS is supported" ) set( dep_libs basicexample ) -GBX_REQUIRE_TARGETS( build LIB ${lib_name} ${dep_libs} ) +GBX_REQUIRE_LIBS( build LIB ${lib_name} ${dep_libs} ) if( build ) Modified: gearbox/trunk/src/gbxgarminacfr/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxgarminacfr/CMakeLists.txt 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxgarminacfr/CMakeLists.txt 2009-05-01 09:44:22 UTC (rev 396) @@ -6,7 +6,7 @@ GBX_REQUIRE_VAR( build LIB ${lib_name} GBX_OS_LINUX "only Linux OS is supported" ) set( dep_libs GbxUtilAcfr GbxSerialAcfr ) -GBX_REQUIRE_TARGETS( build LIB ${lib_name} ${dep_libs} ) +GBX_REQUIRE_LIBS( build LIB ${lib_name} ${dep_libs} ) if( build ) Modified: gearbox/trunk/src/gbxnovatelacfr/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxnovatelacfr/CMakeLists.txt 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxnovatelacfr/CMakeLists.txt 2009-05-01 09:44:22 UTC (rev 396) @@ -5,7 +5,7 @@ GBX_REQUIRE_OPTION( build LIB ${lib_name} ON ) set( dep_libs GbxUtilAcfr GbxSerialAcfr ) -GBX_REQUIRE_TARGETS( build LIB ${lib_name} ${dep_libs} ) +GBX_REQUIRE_LIBS( build LIB ${lib_name} ${dep_libs} ) # built internally set( dep_libs ${dep_libs} GbxNovatelUtilAcfr ) Modified: gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/CMakeLists.txt 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/CMakeLists.txt 2009-05-01 09:44:22 UTC (rev 396) @@ -13,7 +13,7 @@ # GBX_REQUIRE_VAR( build LIB ${lib_name} ICEUTIL_FOUND "libIceUtil not found" ) set( dep_libs GbxUtilAcfr GbxSerialAcfr ) -GBX_REQUIRE_TARGETS( build LIB ${lib_name} ${dep_libs} ) +GBX_REQUIRE_LIBS( build LIB ${lib_name} ${dep_libs} ) if( build ) Modified: gearbox/trunk/src/gbxserialacfr/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxserialacfr/CMakeLists.txt 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxserialacfr/CMakeLists.txt 2009-05-01 09:44:22 UTC (rev 396) @@ -7,7 +7,7 @@ set( dep_libs GbxLockFileAcfr ) # this is currently internal, so we don't have to check it -# GBX_REQUIRE_TARGETS( build LIB ${lib_name} ${dep_libs} ) +# GBX_REQUIRE_LIBS( build LIB ${lib_name} ${dep_libs} ) if( build ) Modified: gearbox/trunk/src/gbxsickacfr/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxsickacfr/CMakeLists.txt 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxsickacfr/CMakeLists.txt 2009-05-01 09:44:22 UTC (rev 396) @@ -8,7 +8,7 @@ add_subdirectory( gbxiceutilacfr ) set( dep_libs GbxUtilAcfr GbxIceUtilAcfr GbxSerialAcfr ) -GBX_REQUIRE_TARGETS( build LIB ${lib_name} ${dep_libs} ) +GBX_REQUIRE_LIBS( build LIB ${lib_name} ${dep_libs} ) # these are built internally set( dep_libs ${dep_libs} GbxSerialDeviceAcfr ) Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/CMakeLists.txt 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/CMakeLists.txt 2009-05-01 09:44:22 UTC (rev 396) @@ -9,7 +9,7 @@ GBX_REQUIRE_VAR( build LIB ${lib_name} ICEUTIL_FOUND "libIceUtil not found" ) set( proj_libs GbxUtilAcfr ) -GBX_REQUIRE_TARGETS( build LIB ${lib_name} ${proj_libs} ) +GBX_REQUIRE_LIBS( build LIB ${lib_name} ${proj_libs} ) if( build ) Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/buffer.h =================================================================== --- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/buffer.h 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/buffer.h 2009-05-01 09:44:22 UTC (rev 396) @@ -95,7 +95,7 @@ * Non-popping and non-blocking read from the front of the buffer. * * Calls to @ref get() on an empty buffer raises an gbxutilacfr::Exception exception. - * You can catch these and call @ref getNext() which will block until new data arrives. + * You can catch these and call @ref getWithTimeout() which will block until new data arrives. */ void get( Type & obj ) const; Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/threadtest.cpp =================================================================== --- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/threadtest.cpp 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/threadtest.cpp 2009-05-01 09:44:22 UTC (rev 396) @@ -13,6 +13,7 @@ #include <IceUtil/Time.h> #include <gbxsickacfr/gbxiceutilacfr/thread.h> +#include <gbxsickacfr/gbxiceutilacfr/threadutils.h> #include <gbxutilacfr/exceptions.h> using namespace std; Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/thread.cpp =================================================================== --- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/thread.cpp 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/thread.cpp 2009-05-01 09:44:22 UTC (rev 396) @@ -80,15 +80,4 @@ } } -void checkedSleep( const gbxiceutilacfr::ThreadPtr& thread, IceUtil::Time duration, int checkIntervalMs ) -{ - IceUtil::Time wakeupTime = IceUtil::Time::now() + duration; - IceUtil::Time checkInterval = IceUtil::Time::milliSeconds( checkIntervalMs ); - - while ( !thread->isStopping() && IceUtil::Time::now() < wakeupTime ) - { - IceUtil::ThreadControl::sleep( checkInterval ); - } -} - } // namespace Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/thread.h =================================================================== --- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/thread.h 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/thread.h 2009-05-01 09:44:22 UTC (rev 396) @@ -12,6 +12,10 @@ #define GBXICEUTILACFR_THREAD_H #include <IceUtil/Thread.h> +#include <gbxutilacfr/stoppable.h> +// this is not needed for implementation of this class. +// it's included for convenience of users of Thread class. +#include <gbxsickacfr/gbxiceutilacfr/threadutils.h> namespace gbxiceutilacfr { @@ -65,7 +69,7 @@ @see SafeThread */ -class Thread : public IceUtil::Thread +class Thread : public IceUtil::Thread, public gbxutilacfr::Stoppable { public: @@ -75,12 +79,13 @@ //! from inside or outside this thread. void stop(); + // from gbxutilacfr::Stoppable + //! Returns TRUE if the thread is in Stopping state, FALSE otherwise. + virtual bool isStopping(); + //! Returns TRUE if the thread is in Started state, FALSE otherwise. bool isStarted(); - //! Returns TRUE if the thread is in Stopping state, FALSE otherwise. - bool isStopping(); - //! @b Depricated function! Use isStopping() instead (note that it returns the opposite). //! //! Returns FALSE if thread was told to stop, TRUE otherwise. @@ -108,12 +113,6 @@ //! terminate. If the smart pointer is 0, this function quietly returns. void stopAndJoin( const gbxiceutilacfr::ThreadPtr& thread ); -//! Sleeps for @ref duration waking up every @ref checkIntervalMs [ms] to check if the @c thread -//! was told to stop. This implementation is very simple so the error in total sleep duration -//! can be as large as checkIntervalMs. In particular, if @ref duration is shorter than @ref checkIntervalMs, -//! this function will sleep for @ref checkIntervalMs. -void checkedSleep( const gbxiceutilacfr::ThreadPtr& thread, IceUtil::Time duration, int checkIntervalMs=250 ); - } // end namespace #endif Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/timer.cpp =================================================================== --- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/timer.cpp 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/timer.cpp 2009-05-01 09:44:22 UTC (rev 396) @@ -12,11 +12,16 @@ namespace gbxiceutilacfr { -Timer::Timer() +Timer::Timer() : + time_( IceUtil::Time::now() ) { - restart(); } +Timer::Timer( const IceUtil::Time& elapsedTime ) : + time_( IceUtil::Time::now()-elapsedTime ) +{ +} + void Timer::restart() { time_ = IceUtil::Time::now(); Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/timer.h =================================================================== --- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/timer.h 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/timer.h 2009-05-01 09:44:22 UTC (rev 396) @@ -32,19 +32,22 @@ { public: - //! Sets internal clock to current time + //! Sets elapsed time to zero. Timer(); - //! Resets internal clock to current time + //! Sets elapased time to the specified time, which can be positive or negative. + Timer( const IceUtil::Time& elapsedTime ); + + //! Resets elapsed time to zero. void restart(); - //! Returns time elapsed from last restart + //! Returns time elapsed from last restart. IceUtil::Time elapsed() const; - //! returns elapsed milliseconds as a double + //! Returns elapsed milliseconds as a double. double elapsedMs() const; - //! returns elapsed seconds as a double + //! Returns elapsed seconds as a double. double elapsedSec() const; private: Modified: gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/CMakeLists.txt 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/CMakeLists.txt 2009-05-01 09:44:22 UTC (rev 396) @@ -7,7 +7,7 @@ # this was already tested in the dir above set( dep_libs GbxSerialAcfr GbxIceUtilAcfr ) -# GBX_REQUIRE_TARGETS( build LIB ${lib_name} ${proj_libs} ) +# GBX_REQUIRE_LIBS( build LIB ${lib_name} ${proj_libs} ) if( build ) Modified: gearbox/trunk/src/gbxsmartbatteryacfr/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxsmartbatteryacfr/CMakeLists.txt 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxsmartbatteryacfr/CMakeLists.txt 2009-05-01 09:44:22 UTC (rev 396) @@ -6,7 +6,7 @@ GBX_REQUIRE_VAR( build LIB ${lib_name} GBX_OS_LINUX "only Linux OS is supported" ) set( dep_libs GbxUtilAcfr GbxSerialAcfr ) -GBX_REQUIRE_TARGETS( build LIB ${lib_name} ${dep_libs} ) +GBX_REQUIRE_LIBS( build LIB ${lib_name} ${dep_libs} ) if( build ) Modified: gearbox/trunk/src/gbxsmartbatteryacfr/gbxsmartbatteryacfr.h =================================================================== --- gearbox/trunk/src/gbxsmartbatteryacfr/gbxsmartbatteryacfr.h 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxsmartbatteryacfr/gbxsmartbatteryacfr.h 2009-05-01 09:44:22 UTC (rev 396) @@ -17,6 +17,7 @@ #include <gbxsmartbatteryacfr/exceptions.h> #include <gbxsmartbatteryacfr/smartbattery.h> #include <gbxsmartbatteryacfr/smartbatteryparsing.h> +#include <gbxsmartbatteryacfr/oceanserverhealthchecks.h> #endif Modified: gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverparser.cpp =================================================================== --- gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverparser.cpp 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverparser.cpp 2009-05-01 09:44:22 UTC (rev 396) @@ -252,7 +252,10 @@ OceanServerParser::parse( vector<string> &stringList, OceanServerSystem &batterySystem ) { - + // put the raw record into the batterySystem representation + // useful for "higher-level" debugging: the caller can choose how to make use of this information + batterySystem.rawRecord = stringList; + // // Debugging output // @@ -273,9 +276,8 @@ } ss << endl; tracer_.debug( ss.str(), debugLevel ); - } + } - // // Parsing // Modified: gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverreader.h =================================================================== --- gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverreader.h 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverreader.h 2009-05-01 09:44:22 UTC (rev 396) @@ -37,6 +37,7 @@ OceanServerReader( const std::string &serialPort, gbxutilacfr::Tracer &tracer ); + //! Reads an OceanServerSystem record //! May throw HardwareReadingExceptions and ParsingExceptions void read( OceanServerSystem &system ); Modified: gearbox/trunk/src/gbxsmartbatteryacfr/oceanserversystem.cpp =================================================================== --- gearbox/trunk/src/gbxsmartbatteryacfr/oceanserversystem.cpp 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxsmartbatteryacfr/oceanserversystem.cpp 2009-05-01 09:44:22 UTC (rev 396) @@ -97,6 +97,8 @@ void updateWithNewData( const OceanServerSystem &from, OceanServerSystem &to ) { + to.rawRecord = from.rawRecord; + typedef map<int,SmartBattery>::const_iterator BatIt; to.availableBatteries = from.availableBatteries; Modified: gearbox/trunk/src/gbxsmartbatteryacfr/oceanserversystem.h =================================================================== --- gearbox/trunk/src/gbxsmartbatteryacfr/oceanserversystem.h 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxsmartbatteryacfr/oceanserversystem.h 2009-05-01 09:44:22 UTC (rev 396) @@ -55,6 +55,9 @@ std::vector<bool> chargePowerPresentStates; std::vector<bool> powerNoGoodStates; std::vector<bool> chargeInhibitedStates; + + //! the latest raw record, useful for debugging + std::vector<std::string> rawRecord; private: @@ -70,6 +73,7 @@ //! Updates all fields in 'to' with data from 'from'. Also reaps batteries in 'to' if they are not in 'from'. //! Has persistence capabilities: if fields in 'from' are not set and corresponding fields in 'to' are set, the ones in 'to' are kept. +//! There's one exception: the rawRecord field is always updated //! Use case: a class stores 'to' as a member variable, receives the latest records into 'from', calls this function to update 'to'. //! The reaping capability makes sure that battery modules which are no longer connected don't persist. void updateWithNewData( const OceanServerSystem &from, Modified: gearbox/trunk/src/gbxsmartbatteryacfr/test/longtest.cpp =================================================================== --- gearbox/trunk/src/gbxsmartbatteryacfr/test/longtest.cpp 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxsmartbatteryacfr/test/longtest.cpp 2009-05-01 09:44:22 UTC (rev 396) @@ -1,9 +1,22 @@ #include <iostream> +#include <sstream> #include <gbxutilacfr/trivialtracer.h> #include <gbxsmartbatteryacfr/gbxsmartbatteryacfr.h> using namespace std; +string toString( const vector<string> &stringList ) +{ + stringstream ss; + for (unsigned int i=0; i<stringList.size(); ++i) + { + ss << stringList[i]; + } + return ss.str(); + +} + + int main( int argc, char **argv ) { int opt; @@ -33,14 +46,39 @@ try { + gbxsmartbatteryacfr::BatteryHealthWarningConfig config; + config.expectedNumBatteries = 2; + config.numCyclesThreshhold = 0; //300 + config.chargeTempThreshhold = 10.0; // 54.0 + config.dischargeTempThreshhold = 10.0; // 70.0 + config.chargeWarnThreshhold = 60; // 10 + config.chargeDeviationThreshold = 1; // 10 + gbxsmartbatteryacfr::OceanServer oceanserver( port, tracer ); while (true) - { + { + cout << "TRACE(test): Reading record " << numRecords << endl; + numRecords++; + gbxsmartbatteryacfr::OceanServerSystem data = oceanserver.getData(); + vector<string> shortWarning; + vector<string> verboseWarning; + const bool printRawRecord = true; + bool haveWarnings = conductAllHealthChecks( data, config, shortWarning, verboseWarning, printRawRecord ); - cout << "TRACE(test): Reading record " << numRecords << endl; - numRecords++; + if (haveWarnings) + { + cout << "Short warning messages: " << endl; + cout << toString(shortWarning) << endl << endl; + cout << "Verbose warning messages:" << endl; + cout << toString(verboseWarning) << endl; + } + else + { + cout << "All systems normal." << endl; + } + } } catch ( gbxsmartbatteryacfr::HardwareReadingException &e ) Modified: gearbox/trunk/src/gbxutilacfr/gbxutilacfr.h =================================================================== --- gearbox/trunk/src/gbxutilacfr/gbxutilacfr.h 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxutilacfr/gbxutilacfr.h 2009-05-01 09:44:22 UTC (rev 396) @@ -19,7 +19,5 @@ #include <gbxutilacfr/status.h> #include <gbxutilacfr/exceptions.h> #include <gbxutilacfr/mathdefs.h> -// #include <gbxutilacfr/stringutils.h> -// #include <gbxutilacfr/sysutils.h> #endif Modified: gearbox/trunk/src/gbxutilacfr/status.cpp =================================================================== --- gearbox/trunk/src/gbxutilacfr/status.cpp 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxutilacfr/status.cpp 2009-05-01 09:44:22 UTC (rev 396) @@ -43,8 +43,6 @@ return "Warning"; case SubsystemFault : return "Fault"; - case SubsystemStalled : - return "Stalled"; default: assert( !"gbxutilacfr::toString(SubsystemHealth) should never get to default" ); } Modified: gearbox/trunk/src/gbxutilacfr/status.h =================================================================== --- gearbox/trunk/src/gbxutilacfr/status.h 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxutilacfr/status.h 2009-05-01 09:44:22 UTC (rev 396) @@ -42,9 +42,7 @@ //! Subsystem has encountered an abnormal but non-fault condition SubsystemWarning, //! Subsystem has declared a fault - SubsystemFault, - //! Subsystem has not been heard from for an abnormally long time - SubsystemStalled + SubsystemFault }; //! Returns string equivalent of health enumerator. @@ -54,10 +52,12 @@ struct SubsystemStatus { //! Constructor. - SubsystemStatus( SubsystemState s=SubsystemIdle, SubsystemHealth h=SubsystemOk, const std::string& msg="", double beat=0.0 ) : + SubsystemStatus( SubsystemState s=SubsystemIdle, SubsystemHealth h=SubsystemOk, const std::string& msg="", + bool stall=false, double beat=0.0 ) : state(s), health(h), message(msg), + isStalled(stall), sinceHeartbeat(beat) {}; //! Current state in the subsystem's state machine. I.e. what is the subsystem doing? @@ -69,6 +69,10 @@ //! Human-readable status description std::string message; + //! If true, the subsystem has not been heard from for an abnormally long time. + bool isStalled; + + //! OBSOLETE !? //! Ratio of time since last heartbeat to maximum expected time between heartbeats. //! For example, sinceHeartbeat=0.5 means that half of normally expected interval between heartbeats //! has elapsed. Modified: gearbox/trunk/src/gbxutilacfr/substatus.h =================================================================== --- gearbox/trunk/src/gbxutilacfr/substatus.h 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxutilacfr/substatus.h 2009-05-01 09:44:22 UTC (rev 396) @@ -16,13 +16,13 @@ namespace gbxutilacfr { //! -//! @brief Convenience class which represents the status of a subsystem. +//! @brief Convenience class which maniupulates the status of a subsystem. //! //! @par Overview //! //! Provides a convenient interface for setting status information for one subsystem. //! -//! @sa Status +//! @sa Status, @sa SubHealth //! class SubStatus { @@ -30,9 +30,9 @@ public: //! Sets a reference to the system Status and this subsystem's name. //! Adds this subsystem to the system. - SubStatus( Status& status, const std::string& subsystem, double maxHeartbeatIntervalSec=-1.0 ) : + SubStatus( Status& status, const std::string& subsysName, double maxHeartbeatIntervalSec=-1.0 ) : status_(status), - subsysName_(subsystem) + subsysName_(subsysName) { status_.addSubsystem( subsysName_, maxHeartbeatIntervalSec ); }; @@ -43,38 +43,55 @@ status_.removeSubsystem( subsysName_ ); } + // + // set expectations about ourselves + // + //! Passes this information to the system Status. void setMaxHeartbeatInterval( double interval ) { status_.setMaxHeartbeatInterval( subsysName_, interval ); }; //! Passes this information to the system Status. void setSubsystemType( SubsystemType type ) { status_.setSubsystemType( subsysName_, type ); }; + // + // set health + // + //! Passes this information to the system Status. void heartbeat() { status_.heartbeat( subsysName_ ); }; //! Passes this information to the system Status. - void initialising( const std::string& message="" ) { status_.initialising( subsysName_, message ); }; + void message( const std::string& message ) { status_.message( subsysName_, message ); }; //! Passes this information to the system Status. - void working( const std::string& message="" ) { status_.working( subsysName_, message ); }; + void ok( const std::string& message="" ) { status_.ok( subsysName_, message ); }; //! Passes this information to the system Status. - void finalising( const std::string& message="" ) { status_.finalising( subsysName_, message ); }; + void warning( const std::string& message ) { status_.warning( subsysName_, message ); }; //! Passes this information to the system Status. - void ok( const std::string& message="" ) { status_.ok( subsysName_, message ); }; + void fault( const std::string& message ) { status_.fault( subsysName_, message ); }; + // + // Set state machine states + // + //! Passes this information to the system Status. - void warning( const std::string& message ) { status_.warning( subsysName_, message ); }; + void initialising( const std::string& message="" ) { status_.initialising( subsysName_, message ); }; //! Passes this information to the system Status. - void fault( const std::string& message ) { status_.fault( subsysName_, message ); }; + void working( const std::string& message="" ) { status_.working( subsysName_, message ); }; + //! Passes this information to the system Status. + void finalising( const std::string& message="" ) { status_.finalising( subsysName_, message ); }; + + //! Returns system Status object Status& status() { return status_; }; //! Returns subsystem's name std::string name() const { return subsysName_; }; + private: Status& status_; Modified: gearbox/trunk/src/gbxutilacfr/trivialstatus.cpp =================================================================== --- gearbox/trunk/src/gbxutilacfr/trivialstatus.cpp 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/gbxutilacfr/trivialstatus.cpp 2009-05-01 09:44:22 UTC (rev 396) @@ -132,7 +132,6 @@ { // cout<<"DEBUG: state="<<state<<" health="<<health<<" msg="<<msg<<endl; assert( state!=gbxutilacfr::SubsystemIdle && "Idle state should not be reported from within the subsystem" ); - assert( health!=gbxutilacfr::SubsystemStalled && "Stalled health should not be reported from within the subsystem" ); // if this is a heartbeat, do nothing else if ( state<0 && health<0 && msg.empty() ) @@ -172,7 +171,6 @@ tracer_.warning( trace ); break; case gbxutilacfr::SubsystemFault : - case gbxutilacfr::SubsystemStalled : tracer_.error( trace ); break; } Modified: gearbox/trunk/src/hokuyo_aist/CMakeLists.txt =================================================================== --- gearbox/trunk/src/hokuyo_aist/CMakeLists.txt 2009-04-22 07:54:31 UTC (rev 395) +++ gearbox/trunk/src/hokuyo_aist/CMakeLists.txt 2009-05-01 09:44:22 UTC (rev 396) @@ -6,7 +6,7 @@ GBX_REQUIRE_OPTION (build LIB ${libName} ON) SET (reqLibs flexiport) -GBX_REQUIRE_TARGETS (build LIB ${libName} ${reqLibs}) +GBX_REQUIRE_LIBS (build LIB ${libName} ${reqLibs}) if(build) INCLUDE (${GBX_CMAKE_DIR}/UseBasicRules.cmake) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |