You can subscribe to this list here.
| 2008 |
Jan
|
Feb
(58) |
Mar
(15) |
Apr
(23) |
May
(8) |
Jun
(92) |
Jul
(66) |
Aug
(6) |
Sep
(9) |
Oct
(44) |
Nov
(8) |
Dec
(1) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(10) |
Feb
(8) |
Mar
(2) |
Apr
(8) |
May
(19) |
Jun
(11) |
Jul
(8) |
Aug
(6) |
Sep
(5) |
Oct
(4) |
Nov
(26) |
Dec
(4) |
| 2010 |
Jan
(5) |
Feb
(3) |
Mar
(4) |
Apr
(3) |
May
(4) |
Jun
|
Jul
(1) |
Aug
(16) |
Sep
(7) |
Oct
(3) |
Nov
(7) |
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <rus...@us...> - 2008-03-26 00:55:30
|
Revision: 107
http://gearbox.svn.sourceforge.net/gearbox/?rev=107&view=rev
Author: russo2503v
Date: 2008-03-25 17:55:37 -0700 (Tue, 25 Mar 2008)
Log Message:
-----------
enabled in-tree rpath, installing cmake scripts
Modified Paths:
--------------
gearbox/trunk/cmake/FindIceUtil.cmake
gearbox/trunk/cmake/UseGearbox.cmake
gearbox/trunk/cmake/internal/Setup.cmake
Added Paths:
-----------
gearbox/trunk/cmake/CheckCompiler.cmake
gearbox/trunk/cmake/DependencyUtils.cmake
gearbox/trunk/cmake/SetupBuildType.cmake
gearbox/trunk/cmake/SetupDirectories.cmake
gearbox/trunk/cmake/SetupOs.cmake
gearbox/trunk/cmake/SetupVersion.cmake
gearbox/trunk/cmake/TargetUtils.cmake
gearbox/trunk/cmake/WriteConfigH.cmake
Removed Paths:
-------------
gearbox/trunk/cmake/internal/CheckCompiler.cmake
gearbox/trunk/cmake/internal/DependencyUtils.cmake
gearbox/trunk/cmake/internal/SetupBuildType.cmake
gearbox/trunk/cmake/internal/SetupDirectories.cmake
gearbox/trunk/cmake/internal/SetupOs.cmake
gearbox/trunk/cmake/internal/SetupVersion.cmake
gearbox/trunk/cmake/internal/TargetUtils.cmake
gearbox/trunk/cmake/internal/WriteConfigH.cmake
Copied: gearbox/trunk/cmake/CheckCompiler.cmake (from rev 106, gearbox/trunk/cmake/internal/CheckCompiler.cmake)
===================================================================
--- gearbox/trunk/cmake/CheckCompiler.cmake (rev 0)
+++ gearbox/trunk/cmake/CheckCompiler.cmake 2008-03-26 00:55:37 UTC (rev 107)
@@ -0,0 +1,37 @@
+#
+# If we're using gcc, make sure the version is OK.
+#
+IF ( ${CMAKE_C_COMPILER} MATCHES gcc )
+
+ EXEC_PROGRAM ( ${CMAKE_C_COMPILER} ARGS --version OUTPUT_VARIABLE gcc_version )
+ MESSAGE ( STATUS "gcc version: ${gcc_version}")
+
+ # Why doesn't this work?
+ #STRING( REGEX MATCHALL "gcc\.*" VERSION_STRING ${CMAKE_C_COMPILER} )
+
+ IF ( gcc_version MATCHES ".*4\\.[0-9]\\.[0-9]" )
+ SET( GCC_VERSION_OK 1 )
+ ENDIF ( gcc_version MATCHES ".*4\\.[0-9]\\.[0-9]")
+
+ GBX_ASSERT ( GCC_VERSION_OK
+ "Checking gcc version - failed. ${PROJECT_NAME} requires gcc v. 4.x"
+ "Checking gcc version - ok"
+ 1 )
+
+ IF ( gcc_version MATCHES ".*4\\.0.*" )
+ # gcc 4.0.x
+ ENDIF ( gcc_version MATCHES ".*4\\.0.*" )
+
+ IF ( gcc_version MATCHES ".*4\\.1.*" )
+ # gcc 4.1.x
+ # gcc-4.1 adds stack protection, which makes code robust to buffer-overrun attacks
+ # (see: http://www.trl.ibm.com/projects/security/ssp/)
+ # However for some reason this can result in the symbol '__stack_chk_fail_local' not being found.
+ # So turn it off.
+ # Tobi: it looks like stack protection is off by default from version gcc 4.1.2, so we don't need this any more.
+ # Will keep it for now, it doesn't hurt.
+ ADD_DEFINITIONS( -fno-stack-protector )
+ ENDIF ( gcc_version MATCHES ".*4\\.1.*" )
+
+
+ENDIF ( ${CMAKE_C_COMPILER} MATCHES gcc )
Copied: gearbox/trunk/cmake/DependencyUtils.cmake (from rev 106, gearbox/trunk/cmake/internal/DependencyUtils.cmake)
===================================================================
--- gearbox/trunk/cmake/DependencyUtils.cmake (rev 0)
+++ gearbox/trunk/cmake/DependencyUtils.cmake 2008-03-26 00:55:37 UTC (rev 107)
@@ -0,0 +1,229 @@
+MACRO( GBX_MAKE_OPTION_NAME option_name module_type module_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_MAKE_OPTION_NAME, 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'" )
+ ENDIF ( is_exe AND is_lib )
+
+ STRING( TOUPPER ${module_name} module_name_upper )
+ IF ( is_exe )
+ SET( option_name "ENABLE_${module_name_upper}" )
+ ELSE ( is_exe )
+ SET( option_name "ENABLE_LIB_${module_name_upper}" )
+ ENDIF ( is_exe )
+
+ENDMACRO( GBX_MAKE_OPTION_NAME option_name module_name )
+
+#
+# GBX_REQUIRE_OPTION( cumulative_var [EXE | LIB] module_name default_option_value [option_name] [OPTION DESCRIPTION] )
+#
+# E.g.
+# Initialize a variable first
+# SET( BUILD TRUE )
+# Now set up and test option value
+# GBX_REQUIRE_OPTION ( BUILD EXE localiser ON )
+# This does the same thing
+# GBX_REQUIRE_OPTION ( BUILD EXE localiser ON BUILD_LOCALISER )
+#
+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 )
+ STRING( TOUPPER ${module_name} module_name_upper )
+ IF ( is_exe )
+ SET( option_name "ENABLE_${module_name_upper}" )
+ ELSE ( is_exe )
+ SET( option_name "ENABLE_LIB_${module_name_upper}" )
+ ENDIF ( is_exe )
+ ENDIF ( ${ARGC} GREATER 5 )
+
+ IF ( ${ARGC} GREATER 6 )
+ SET( option_descr ${ARGV7} )
+ ELSE ( ${ARGC} GREATER 6 )
+ SET( option_descr "disabled by user, use ccmake to enable" )
+ ENDIF ( ${ARGC} GREATER 6 )
+
+ # debug
+# MESSAGE( STATUS
+# "GBX_REQUIRE_OPTION (CUM_VAR=${cumulative_var}, MOD_TYPE=${module_type}, MOD_NAME=${module_name}, default_option_value=${default_option_value}, OPT_NAME=${option_name}, OPT_DESC=${option_descr})" )
+
+ # set up the option
+ IF ( is_exe )
+ OPTION( ${option_name} "Try to build ${module_name}" ${default_option_value} )
+ ELSE ( is_exe )
+ OPTION( ${option_name} "Try to build lib${module_name} library" ${default_option_value} )
+ ENDIF ( is_exe )
+
+ # must dereference both var and option names once (!) and IF will evaluate their values
+ IF ( ${cumulative_var} AND NOT ${option_name} )
+ SET( ${cumulative_var} FALSE )
+ IF ( is_exe )
+ GBX_NOT_ADD_EXECUTABLE( ${module_name} ${option_descr} )
+ ELSE ( is_exe )
+ GBX_NOT_ADD_LIBRARY( ${module_name} ${option_descr} )
+ ENDIF ( is_exe )
+ ENDIF ( ${cumulative_var} AND NOT ${option_name} )
+
+ENDMACRO( GBX_REQUIRE_OPTION cumulative_var module_type module_name default_option_value )
+
+#
+# GBX_REQUIRE_VAR ( cumulative_var [EXE | LIB] module_name test_var reason )
+#
+# E.g.
+# Initialize a variable first
+# SET( BUILD TRUE )
+# Now test the variable value
+# GBX_REQUIRE_VAR ( BUILD LIB HydroStuff GOOD_TO_GO "good-to-go is no good" )
+#
+MACRO( GBX_REQUIRE_VAR cumulative_var module_type module_name test_var reason )
+
+ # 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 )
+
+ # 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} )
+ ELSE ( is_exe )
+ GBX_NOT_ADD_LIBRARY( ${module_name} ${reason} )
+ ENDIF ( is_exe )
+ ENDIF ( ${cumulative_var} AND NOT ${test_var} )
+
+ENDMACRO( GBX_REQUIRE_VAR cumulative_var module_type module_name test_var reason )
+
+#
+# GBX_REQUIRE_INSTALL ( cumulative_var [EXE | LIB] module_name installed_module [reason] )
+#
+# A special case of REQUIRE_VAR. Checks whether a manifest variable is defined
+# for the module with a name "installed_module".
+# E.g.
+# Initialize a variable first
+# SET ( BUILD TRUE )
+# Now test the variable value
+# REQUIRE_INSTALL ( build LIB HydroStuff GbxStuff )
+# will check if GBXSTUFF_INSTALLED is defined.
+# 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 )
+
+ # debug
+# MESSAGE( STATUS "REQUIRE_INSTALL [ CUM_VAR=${cumulative_var}, MOD_TYPE=${module_type}, MOD_NAME=${module_name}, installed_module=${installed_module} ]" )
+
+ STRING ( TOUPPER ${installed_module} upper_installed_module )
+ SET( test_var ${upper_installed_module}_INSTALLED )
+
+ 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 )
+
+#
+# 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 )
+
+ 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] )
+#DEPS
+# E.g.
+# Initialize a variable first
+# SET( BUILD TRUE )
+# Now set up and test option value
+# GBX_REQUIRE_TARGET ( BUILD EXE localiser HydroStuff )
+#
+MACRO( GBX_REQUIRE_TARGET 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} ]" )
+
+ 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 ( ${ARGC} GREATER 5 )
+ SET( reason ${ARGV6} )
+ ELSE ( ${ARGC} GREATER 5 )
+ SET( reason "lib${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 ( ${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_TARGET cumulative_var module_type module_name target_name )
+
+
+#
+# GBX_REQUIRE_TARGETS( cumulative_var [EXE | LIB] module_name TARGET0 [TARGET1 TARGET2 ...] )
+#
+MACRO( GBX_REQUIRE_TARGETS 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} ]" )
+
+ IF( ${ARGC} LESS 4 )
+ MESSAGE( FATAL_ERROR "GBX_REQUIRE_TARGETS 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} )
+ ENDFOREACH( trgt ${ARGN} )
+
+ENDMACRO( GBX_REQUIRE_TARGETS cumulative_var module_type module_name )
Modified: gearbox/trunk/cmake/FindIceUtil.cmake
===================================================================
--- gearbox/trunk/cmake/FindIceUtil.cmake 2008-03-19 08:12:47 UTC (rev 106)
+++ gearbox/trunk/cmake/FindIceUtil.cmake 2008-03-26 00:55:37 UTC (rev 107)
@@ -15,8 +15,10 @@
# package + source install w/out env.var -> package
#
# installation selected by user
+ ${ICEUTIL_HOME}/include/IceUtil
+ ${ICE_HOME}/include/IceUtil
+ $ENV{ICEUTIL_HOME}/include/IceUtil
$ENV{ICE_HOME}/include/IceUtil
- $ENV{ICEUTIL_HOME}/include/IceUtil
# debian package installs Ice here
/usr/include/IceUtil
# Test standard installation points: newer versions first
Copied: gearbox/trunk/cmake/SetupBuildType.cmake (from rev 106, gearbox/trunk/cmake/internal/SetupBuildType.cmake)
===================================================================
--- gearbox/trunk/cmake/SetupBuildType.cmake (rev 0)
+++ gearbox/trunk/cmake/SetupBuildType.cmake 2008-03-26 00:55:37 UTC (rev 107)
@@ -0,0 +1,18 @@
+IF ( NOT CMAKE_BUILD_TYPE )
+
+ IF ( NOT GBX_OS_WIN )
+ # For gcc, RelWithDebInfo gives '-O2 -g'
+ SET( CMAKE_BUILD_TYPE RelWithDebInfo )
+ ELSE ( NOT GBX_OS_WIN )
+ # windows... a temp hack: VCC does not seem to respect the cmake
+ # setting and always defaults to debug, we have to match it here.
+ SET( CMAKE_BUILD_TYPE Debug )
+ ENDIF ( NOT GBX_OS_WIN )
+
+ MESSAGE( STATUS "Setting build type to '${CMAKE_BUILD_TYPE}'" )
+
+ELSE ( NOT CMAKE_BUILD_TYPE )
+
+ MESSAGE( STATUS "Build type set to '${CMAKE_BUILD_TYPE}' by user." )
+
+ENDIF ( NOT CMAKE_BUILD_TYPE )
Copied: gearbox/trunk/cmake/SetupDirectories.cmake (from rev 106, gearbox/trunk/cmake/internal/SetupDirectories.cmake)
===================================================================
--- gearbox/trunk/cmake/SetupDirectories.cmake (rev 0)
+++ gearbox/trunk/cmake/SetupDirectories.cmake 2008-03-26 00:55:37 UTC (rev 107)
@@ -0,0 +1,70 @@
+#
+# Installation directory is determined by looking at 3 sources of information in the following order,
+# later sources overwrite earlier ones:
+# 1. OS-dependent defaults (effective only the first time CMake runs or after CMakeCache is deleted)
+# 2. Enviroment variable whose name is held in variable project_install_var
+# 3. CMake variable whose name is held in project_install_var.
+#
+# E.g.
+# - rm CMakeCache.txt; cmake .
+# /opt/orca-1.2.3
+# - export HYDRO_INSTALL=/home/myname; cmake .
+# /home/myname
+# - export HYDRO_INSTALL=/home/myname; cmake -DHYDRO_INSTALL=/home/myname/opt.
+# /home/myname/opt
+#
+# Afterwards, it's ok to just use "cmake .", the previously set installation dir is held in cache.
+#
+# A manually set installation dir (e.i. with ccmake) is not touched until an environment variable or
+# a command line variable is introduced.
+
+# 1. using custom defaults (effective only the very first time CMake runs, or after CMakeCache is deleted)
+IF( CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ MESSAGE( STATUS "Setting default installation directory..." )
+ IF ( NOT GBX_OS_WIN )
+ SET( CMAKE_INSTALL_PREFIX /usr/local CACHE PATH "Installation directory" FORCE )
+ ELSE ( NOT GBX_OS_WIN )
+ SET( CMAKE_INSTALL_PREFIX "C:\Program Files\${PROJECT_NAME}\Include" CACHE PATH "Installation directory" FORCE )
+ ENDIF ( NOT GBX_OS_WIN )
+ENDIF( CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT )
+
+# the name of the variable controlling install directory for this project
+STRING( TOUPPER ${PROJECT_NAME} project_name_upper )
+SET( project_install_var "${project_name_upper}_INSTALL" )
+
+# 2. check if environment variable is set
+SET( install_dir $ENV{${project_install_var}} )
+STRING( LENGTH "A${install_dir}" is_env_var_defined_plus_one )
+MATH( EXPR is_env_var_defined "${is_env_var_defined_plus_one}-1" )
+IF( is_env_var_defined )
+ # debug
+ MESSAGE( STATUS "Overwriting install dir with enviroment variable ${project_install_var}=${install_dir}" )
+
+ SET( CMAKE_INSTALL_PREFIX ${install_dir} CACHE PATH "Installation directory" FORCE )
+ENDIF( is_env_var_defined )
+
+# 3. check if CMake variable is set on the command line
+IF( DEFINED ${project_install_var} )
+ SET( install_dir ${${project_install_var}} )
+ # debug
+ MESSAGE( STATUS "Overwriting install dir with command line variable ${project_install_var}=${install_dir}" )
+
+ # using user-supplied installation directory
+ SET( CMAKE_INSTALL_PREFIX ${install_dir} CACHE PATH "Installation directory" FORCE )
+ENDIF( DEFINED ${project_install_var} )
+
+# final result
+MESSAGE( STATUS "Setting installation directory to ${CMAKE_INSTALL_PREFIX}" )
+
+# special installation directories
+SET( GBX_BIN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/bin )
+SET( GBX_LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME} )
+SET( GBX_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/install/${PROJECT_NAME} )
+SET( GBX_SHARE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME} )
+
+#
+# It's sometimes useful to refer to the top level of the project.
+# CMake does not make it very easy.
+#
+SET( GBX_PROJECT_SOURCE_DIR ${${PROJECT_NAME}_SOURCE_DIR} )
+SET( GBX_PROJECT_BINARY_DIR ${${PROJECT_NAME}_BINARY_DIR} )
Copied: gearbox/trunk/cmake/SetupOs.cmake (from rev 106, gearbox/trunk/cmake/internal/SetupOs.cmake)
===================================================================
--- gearbox/trunk/cmake/SetupOs.cmake (rev 0)
+++ gearbox/trunk/cmake/SetupOs.cmake 2008-03-26 00:55:37 UTC (rev 107)
@@ -0,0 +1,41 @@
+#
+# Check the OS type.
+# Sets the 'GBX_OS_INCLUDES' variable, for system-wide Includes that must be set.
+#
+
+
+# CMake does not distinguish Linux from other Unices.
+STRING( REGEX MATCH Linux GBX_OS_LINUX ${CMAKE_SYSTEM_NAME})
+
+# Rename CMake's variable to something which makes more sense.
+IF ( QNXNTO )
+ SET( GBX_OS_QNX TRUE BOOL INTERNAL )
+ENDIF ( QNXNTO )
+
+# In windows we just mirror CMake's own variable
+IF ( WIN32 )
+ SET( GBX_OS_WIN TRUE BOOL INTERNAL )
+ENDIF ( WIN32 )
+
+# In MacOS X we just mirror CMake's own variable
+IF ( APPLE )
+ SET( GBX_OS_MAC TRUE BOOL INTERNAL )
+ENDIF ( APPLE )
+
+
+# From now on, use our own OS flags
+
+IF ( GBX_OS_LINUX )
+ MESSAGE ( STATUS "Running on Linux" )
+ENDIF ( GBX_OS_LINUX )
+
+IF ( GBX_OS_QNX )
+ MESSAGE ( STATUS "Running on QNX" )
+ ADD_DEFINITIONS( -shared -fexceptions )
+ENDIF ( GBX_OS_QNX )
+
+IF ( GBX_OS_WIN )
+ # CMake seems not to set this property correctly for some reason
+ SET( GBX_EXE_EXTENSION ".exe" )
+ MESSAGE ( STATUS "Running on Windows" )
+ENDIF ( GBX_OS_WIN )
Copied: gearbox/trunk/cmake/SetupVersion.cmake (from rev 106, gearbox/trunk/cmake/internal/SetupVersion.cmake)
===================================================================
--- gearbox/trunk/cmake/SetupVersion.cmake (rev 0)
+++ gearbox/trunk/cmake/SetupVersion.cmake 2008-03-26 00:55:37 UTC (rev 107)
@@ -0,0 +1,9 @@
+#
+# define the project version so we can have access to it from the code
+#
+
+# alexm: for gcc need to produce this in the Makefile: -DGEARBOX_VERSION=\"X.Y.Z\",
+# without escaping the quotes the compiler will strip them off.
+# alexb: it seems that you also need to escape the quotes for windoze??
+
+ADD_DEFINITIONS( "-DGEARBOX_VERSION=\\\"${GBX_PROJECT_VERSION}\\\"" )
Copied: gearbox/trunk/cmake/TargetUtils.cmake (from rev 106, gearbox/trunk/cmake/internal/TargetUtils.cmake)
===================================================================
--- gearbox/trunk/cmake/TargetUtils.cmake (rev 0)
+++ gearbox/trunk/cmake/TargetUtils.cmake 2008-03-26 00:55:37 UTC (rev 107)
@@ -0,0 +1,285 @@
+#
+# Components should add themselves by calling 'GBX_ADD_EXECUTABLE'
+# instead of 'ADD_EXECUTABLE' in CMakeLists.txt.
+# Usage: GBX_ADD_EXECUTABLE( name src1 src2 src3 )
+#
+MACRO( GBX_ADD_EXECUTABLE name )
+ ADD_EXECUTABLE( ${name} ${ARGN} )
+# SET_TARGET_PROPERTIES( ${name} PROPERTIES
+# INSTALL_RPATH "${INSTALL_RPATH};${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}"
+# BUILD_WITH_INSTALL_RPATH TRUE )
+ INSTALL( TARGETS ${name} RUNTIME DESTINATION bin )
+ SET( templist ${COMPONENT_LIST} )
+ LIST ( APPEND templist ${name} )
+# MESSAGE ( STATUS "DEBUG: ${templist}" )
+ SET( COMPONENT_LIST ${templist} CACHE INTERNAL "Global list of components to build" FORCE )
+ MESSAGE( STATUS "Planning to Build Executable: ${name}" )
+ENDMACRO( GBX_ADD_EXECUTABLE name )
+
+#
+# Components should add themselves by calling 'GBX_ADD_EXECUTABLE'
+# instead of 'ADD_LIBRARY' in CMakeLists.txt.
+# Usage: GBX_ADD_LIBRARY( name src1 src2 src3 )
+#
+MACRO( GBX_ADD_LIBRARY name )
+ ADD_LIBRARY( ${name} ${ARGN} )
+# SET_TARGET_PROPERTIES( ${name} PROPERTIES
+# INSTALL_RPATH "${INSTALL_RPATH};${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}"
+# BUILD_WITH_INSTALL_RPATH TRUE )
+ INSTALL( TARGETS ${name} LIBRARY DESTINATION lib/${PROJECT_NAME} )
+ SET( templist ${LIBRARY_LIST} )
+ LIST ( APPEND templist ${name} )
+ SET( LIBRARY_LIST ${templist} CACHE INTERNAL "Global list of libraries to build" FORCE )
+ MESSAGE( STATUS "Planning to Build Library : ${name}" )
+ENDMACRO( GBX_ADD_LIBRARY name )
+
+#
+# GBX_ADD_HEADERS( install_subdir FILE0 [FILE1 FILE2 ...] )
+#
+# Specialization of INSTALL(FILES ...) to install header files.
+# 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} )
+ENDMACRO( GBX_ADD_HEADERS install_subdir )
+#
+# GBX_ADD_SHARED_FILES( install_subdir FILE0 [FILE1 FILE2 ...] )
+#
+# Specialization of INSTALL(FILES ...) to install shared files.
+# 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} )
+ENDMACRO( GBX_ADD_SHARED_FILES install_subdir )
+
+#
+# GBX_ADD_EXAMPLE( install_subdir makefile.in makefile.out [FILE0 FILE1 FILE2 ...] )
+#
+# Specialisation of INSTALL(FILES ...) to install examples.
+# All files are installed into PREFIX/share/${PROJECT_NAME}/${install_subdir}.
+# makefile is passed through CONFIGURE_FILE to add in correct include and library
+# paths based on the install prefix.
+#
+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} )
+ENDMACRO( GBX_ADD_EXAMPLE install_subdir makefile )
+
+#
+# GBX_ADD_PKGCONFIG( name cflags libflags [DEPENDENCY0 DEPENDENCY1 ...] )
+#
+# Creates a pkg-config file for library "name".
+# desc is a description of the library.
+# ext_deps is a list containing all the external libraries this one requires (pass by reference).
+# int_deps is a list containing all the internal libraries this library depends on (pass by reference).
+# cflags is appended to the "Cflags" value.
+# libflags is appended to the "Libs" value.
+# that should be linked with at the same time as linking to this library.
+#
+MACRO( GBX_ADD_PKGCONFIG name desc ext_deps int_deps cflags libflags )
+ SET( PKG_NAME ${name} )
+ SET( PKG_DESC ${desc} )
+ SET( PKG_CFLAGS ${cflags} )
+ SET( PKG_LIBFLAGS ${libflags} )
+ SET( PKG_EXTERNAL_DEPS ${${ext_deps}} )
+ SET( PKG_INTERNAL_DEPS "" )
+ IF( ${int_deps} )
+ FOREACH( A ${${int_deps}} )
+ SET( PKG_INTERNAL_DEPS "${PKG_INTERNAL_DEPS} -l${A}" )
+ ENDFOREACH( A ${${int_deps}} )
+ 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/${PROJECT_NAME}/ )
+ENDMACRO( GBX_ADD_PKGCONFIG name desc cflags deps libflags libs )
+
+#
+# This is a mechanism to register special items which are not
+# components or libraries. This function only records the name of
+# the item to display it at the end of the cmake run and to submit
+# to the Dashboard.
+# Usage: GBX_ADD_ITEM( name )
+#
+MACRO( GBX_ADD_ITEM name )
+ SET( templist ${ITEM_LIST} )
+ LIST ( APPEND templist ${name} )
+ SET( ITEM_LIST ${templist} CACHE INTERNAL "Global list of special items to build" FORCE )
+ MESSAGE( STATUS "Planning to Build Item : ${name}" )
+ENDMACRO( GBX_ADD_ITEM name )
+
+#
+# This is a mechanism to specify a license for the current source directory.
+# Usage: GBX_ADD_LICENSE( license )
+#
+MACRO( GBX_ADD_LICENSE license )
+ SET( templist ${LICENSE_LIST} )
+
+ # get relative path to the current source dir
+ STRING ( LENGTH ${GBX_PROJECT_SOURCE_DIR} proj_src_dir_length )
+ STRING ( LENGTH ${CMAKE_CURRENT_SOURCE_DIR} current_src_dir_length )
+ MATH ( EXPR relative_path_length "${current_src_dir_length} - ${proj_src_dir_length} - 1" )
+ MATH ( EXPR relative_path_start "${proj_src_dir_length} + 1" )
+ STRING ( SUBSTRING ${CMAKE_CURRENT_SOURCE_DIR}
+ ${relative_path_start} ${relative_path_length} current_src_dir_relative )
+
+ # format the string to line up properly
+ SET( spaces "A Z" )
+ STRING ( LENGTH ${current_src_dir_relative} current_src_dir_relative_length )
+ MATH ( EXPR white_space_length "60 - ${current_src_dir_relative_length}" )
+ STRING ( SUBSTRING ${spaces} 1 ${white_space_length} white_space )
+
+ SET( line_item "${current_src_dir_relative}${white_space}${license}" )
+ LIST ( APPEND templist ${line_item} )
+ SET( LICENSE_LIST ${templist} CACHE INTERNAL "Global list of directories and their licenses" FORCE )
+# MESSAGE( STATUS ${line_item} )
+ENDMACRO( GBX_ADD_LICENSE license )
+
+#
+# Usage: GBX_ADD_TEST( testname exename [arg1 arg2 ...] )
+# Example: GBX_ADD_TEST( IntegerTest inttest --verbose )
+#
+MACRO( GBX_ADD_TEST name executable )
+ ADD_TEST( ${name} ${executable} ${ARGN} )
+ SET( templist ${TEST_LIST} )
+ LIST ( APPEND templist ${name} )
+ SET( TEST_LIST ${templist} CACHE INTERNAL "Global list of (CTest) tests to build" FORCE )
+# MESSAGE( STATUS "Planning to Build Test : ${name}" )
+ENDMACRO( GBX_ADD_TEST name executable )
+
+#
+# Usage: GBX_NOT_ADD_EXECUTABLE( name reason )
+#
+MACRO( GBX_NOT_ADD_EXECUTABLE name reason )
+ SET( templist ${COMPONENT_NOT_LIST} )
+ LIST ( APPEND templist ${name} )
+# MESSAGE ( STATUS "DEBUG: ${templist}" )
+ SET( COMPONENT_NOT_LIST ${templist} CACHE INTERNAL "Global list of components NOT to build" FORCE )
+ MESSAGE( STATUS "Not planning to Build Executable : ${name} because ${reason}" )
+ENDMACRO( GBX_NOT_ADD_EXECUTABLE name reason )
+
+#
+# Usage: GBX_NOT_ADD_LIBRARY( name reason )
+#
+MACRO( GBX_NOT_ADD_LIBRARY name reason )
+ SET( templist ${LIBRARY_NOT_LIST} )
+ LIST ( APPEND templist ${name} )
+# MESSAGE ( STATUS "DEBUG: ${templist}" )
+ SET( LIBRARY_NOT_LIST ${templist} CACHE INTERNAL "Global list of libraries NOT to build" FORCE )
+ MESSAGE( STATUS "Not planning to Build Library : ${name} because ${reason}" )
+ENDMACRO( GBX_NOT_ADD_LIBRARY name reason )
+
+#
+# Prints out list information: size, and items.
+# Prints nothing if list is empty.
+# Example: LIST_REPORT( COMPONENT_LIST "component(s)" )
+#
+# Tricky list stuff.
+# see http://www.cmake.org/Wiki/CMakeMacroMerge for an example
+#
+MACRO ( LIST_REPORT ACTION ITEM_NAME note L )
+ SET( templist ${L} )
+ LIST ( LENGTH templist templist_length )
+ SET( report_file ${GBX_PROJECT_BINARY_DIR}/cmake_config_report.txt )
+
+ IF ( templist_length GREATER 0 )
+ LIST ( SORT templist )
+
+ MESSAGE ( STATUS "${ACTION} ${templist_length} ${ITEM_NAME} ${note}:" )
+ MESSAGE ( STATUS " ${templist}" )
+
+ WRITE_FILE ( ${report_file} "${ACTION} ${templist_length} ${ITEM_NAME}:" APPEND )
+ WRITE_FILE ( ${report_file} " ${templist}" APPEND )
+ ENDIF ( templist_length GREATER 0 )
+ENDMACRO ( LIST_REPORT ACTION ITEM_NAME note L )
+
+#
+# Puts messages on the screen.
+# Writes to a text file.
+#
+MACRO( GBX_CONFIG_REPORT )
+
+ MESSAGE( STATUS "== SUMMARY ==" )
+
+ # write configuration results to file (this line clears existing contents)
+ SET( report_file ${GBX_PROJECT_BINARY_DIR}/cmake_config_report.txt )
+ WRITE_FILE ( ${report_file} "Autogenerated by CMake for ${PROJECT_NAME} project" )
+# WRITE_FILE ( ${report_file} "Using Ice version ${ICE_VERSION}" )
+
+ #
+ # Print some results
+ #
+ MESSAGE ( STATUS "Project name ${PROJECT_NAME}")
+ MESSAGE ( STATUS "Project version ${GBX_PROJECT_VERSION}")
+ # would be nice to print out Orca version for satellite projects
+ # for this we need an executable which is guaranteed to be installed.
+ # then we can run it with --version flag.
+ # IF ( NOT ORCA_MOTHERSHIP )
+ # MESSAGE ( STATUS "Using Orca version ${ORCA_VERSION}")
+ # ENDIF ( NOT ORCA_MOTHERSHIP )
+ MESSAGE ( STATUS "Platform ${CMAKE_SYSTEM}")
+ MESSAGE ( STATUS "CMake version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}-patch ${CMAKE_PATCH_VERSION}")
+ MESSAGE ( STATUS "Install dir ${CMAKE_INSTALL_PREFIX}")
+
+ SET( note " " )
+ LIST_REPORT ( "Will build" "executables" ${note} "${COMPONENT_LIST}" )
+ LIST_REPORT ( "Will build" "libraries" ${note} "${LIBRARY_LIST}" )
+ LIST_REPORT ( "Will build" "CTest tests" ${note} "${TEST_LIST}" )
+ LIST_REPORT ( "Will build" "special items" ${note} "${ITEM_LIST}" )
+
+ SET( note "(see above for reasons)" )
+ LIST_REPORT ( "Will NOT build" "executables" ${note} "${COMPONENT_NOT_LIST}" )
+ LIST_REPORT ( "Will NOT build" "libraries" ${note} "${LIBRARY_NOT_LIST}" )
+
+ENDMACRO( GBX_CONFIG_REPORT )
+
+MACRO ( GBX_WRITE_MANIFEST )
+ SET( manifest_file ${GBX_PROJECT_BINARY_DIR}/${PROJECT_NAME}_manifest.cmake )
+ WRITE_FILE ( ${manifest_file} "\# Autogenerated by CMake for ${PROJECT_NAME} project" )
+
+ FOREACH( A ${LIBRARY_LIST} )
+ STRING ( TOUPPER ${A} UPPERA )
+ WRITE_FILE ( ${manifest_file} "SET( ${UPPERA}_INSTALLED 1)" APPEND )
+ ENDFOREACH( A ${LIBRARY_LIST} )
+
+ FOREACH( A ${LIBRARY_NOT_LIST} )
+ STRING ( TOUPPER ${A} UPPERA )
+ WRITE_FILE ( ${manifest_file} "SET( ${UPPERA}_INSTALLED 0)" APPEND )
+ ENDFOREACH( A ${LIBRARY_NOT_LIST} )
+
+ WRITE_FILE ( ${manifest_file} " " APPEND )
+
+ STRING ( TOUPPER ${PROJECT_NAME} upper_project_name )
+ WRITE_FILE ( ${manifest_file} "SET( ${upper_project_name}_MANIFEST_LOADED 1)" APPEND )
+
+ INSTALL( FILES ${manifest_file} DESTINATION . )
+ENDMACRO ( GBX_WRITE_MANIFEST )
+
+MACRO ( GBX_WRITE_LICENSE )
+ SET( license_file ${GBX_PROJECT_SOURCE_DIR}/LICENSE )
+ WRITE_FILE ( ${license_file} "Autogenerated by CMake for ${PROJECT_NAME} project" )
+ WRITE_FILE ( ${license_file} "----------------------------------------------------------------------" APPEND )
+ WRITE_FILE ( ${license_file} "DIRECTORY license" APPEND )
+ WRITE_FILE ( ${license_file} "----------------------------------------------------------------------" APPEND )
+
+ FOREACH( A ${LICENSE_LIST} )
+ WRITE_FILE ( ${license_file} ${A} APPEND )
+ ENDFOREACH( A ${LICENSE_LIST} )
+
+ENDMACRO ( GBX_WRITE_LICENSE )
+
+#
+# Reset global lists of components, libraries, etc.
+#
+MACRO ( GBX_RESET_ALL_LISTS )
+ # MESSAGE ( STATUS "DEBUG: Resetting global component and library lists" )
+ SET( COMPONENT_LIST "" CACHE INTERNAL "Global list of components to build" FORCE )
+ SET( LIBRARY_LIST "" CACHE INTERNAL "Global list of libraries to build" FORCE )
+ SET( TEST_LIST "" CACHE INTERNAL "Global list of CTest tests to build" FORCE )
+ SET( ITEM_LIST "" CACHE INTERNAL "Global list of special items to build" FORCE )
+
+ SET( COMPONENT_NOT_LIST "" CACHE INTERNAL "Global list of components NOT to build" FORCE )
+ SET( LIBRARY_NOT_LIST "" CACHE INTERNAL "Global list of libraries NOT to build" FORCE )
+
+ SET( LICENSE_LIST "" CACHE INTERNAL "Global list of directories and their licenses" FORCE )
+ENDMACRO ( GBX_RESET_ALL_LISTS )
Modified: gearbox/trunk/cmake/UseGearbox.cmake
===================================================================
--- gearbox/trunk/cmake/UseGearbox.cmake 2008-03-19 08:12:47 UTC (rev 106)
+++ gearbox/trunk/cmake/UseGearbox.cmake 2008-03-26 00:55:37 UTC (rev 107)
@@ -1,3 +1,5 @@
# This script is indended for Gearbox users (not for internal use)
+# Assumes that a variable GEARBOX_HOME is defined.
+
INCLUDE_DIRECTORIES( ${GEARBOX_HOME}/include/gearbox )
LINK_DIRECTORIES( ${GEARBOX_HOME}/lib/gearbox )
Copied: gearbox/trunk/cmake/WriteConfigH.cmake (from rev 106, gearbox/trunk/cmake/internal/WriteConfigH.cmake)
===================================================================
--- gearbox/trunk/cmake/WriteConfigH.cmake (rev 0)
+++ gearbox/trunk/cmake/WriteConfigH.cmake 2008-03-26 00:55:37 UTC (rev 107)
@@ -0,0 +1,170 @@
+###########################################################
+# #
+# Look for low-level C headers, write defines to config.h #
+# #
+###########################################################
+
+INCLUDE( ${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake )
+INCLUDE( ${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake )
+
+SET( CONFIG_H ${PROJECT_BINARY_DIR}/config.h )
+
+# Only write config.h once
+IF ( WROTE_CONFIG_H )
+ MESSAGE( STATUS "Not writing config.h -- wrote it previously" )
+ELSE ( WROTE_CONFIG_H )
+ MESSAGE( STATUS "Writing config.h" )
+ SET( WROTE_CONFIG_H TRUE CACHE INTERNAL "Wrote config.h" )
+
+ FILE( WRITE ${CONFIG_H} "/* config.h. Generated by CMakeLists.txt */\n\n" )
+
+ IF ( WIN32 )
+
+ #
+ # define some stuff to make MSVC look a bit more like gcc
+ #
+
+ # define 'uint' to 'unsigned int' for windows
+ FILE( APPEND ${CONFIG_H} "#ifndef uint\n" )
+ FILE( APPEND ${CONFIG_H} "#define uint unsigned int\n" )
+ FILE( APPEND ${CONFIG_H} "#endif\n\n" )
+
+ FILE( APPEND ${CONFIG_H} "// MSVC compiler requires this symbol before exposing the (apparently)\n" )
+ FILE( APPEND ${CONFIG_H} "// non-standard symbols M_PI, etc...\n" )
+ FILE( APPEND ${CONFIG_H} "#define _USE_MATH_DEFINES\n\n" )
+
+ FILE( APPEND ${CONFIG_H} "// Just in case the above line didn't fix it...\n" )
+ FILE( APPEND ${CONFIG_H} "#ifndef M_PI\n" )
+ FILE( APPEND ${CONFIG_H} "#define M_PI 3.14159265358979323846\n" )
+ FILE( APPEND ${CONFIG_H} "#endif\n\n" )
+
+ ELSE( WIN32 )
+
+ #
+ # AlexB: I think all these low-level guys are 'nix-specific.
+ # Don't write them for win32.
+ #
+
+ CHECK_INCLUDE_FILE( termio.h HAVE_TERMIO_H )
+ IF( HAVE_TERMIO_H )
+ SET( VAL 1 )
+ ELSE( HAVE_TERMIO_H )
+ SET( VAL 0 )
+ ENDIF( HAVE_TERMIO_H )
+ FILE( APPEND ${CONFIG_H} "#define HAVE_TERMIO_H ${VAL}\n\n" )
+
+ CHECK_INCLUDE_FILE( linux/input.h HAVE_LINUX_INPUT_H )
+ IF( HAVE_LINUX_INPUT_H )
+ SET( VAL 1 )
+ ELSE( HAVE_LINUX_INPUT_H )
+ SET( VAL 0 )
+ ENDIF( HAVE_LINUX_INPUT_H )
+ FILE( APPEND ${CONFIG_H} "#define HAVE_LINUX_INPUT_H ${VAL}\n\n" )
+
+ CHECK_INCLUDE_FILE( string.h HAVE_STRING_H )
+ IF( HAVE_STRING_H )
+ SET( VAL 1 )
+ ELSE( HAVE_STRING_H )
+ SET( VAL 0 )
+ ENDIF( HAVE_STRING_H )
+ FILE( APPEND ${CONFIG_H} "#define HAVE_STRING_H ${VAL}\n\n" )
+
+ CHECK_INCLUDE_FILE( stdlib.h HAVE_STDLIB_H )
+ IF( HAVE_STDLIB_H )
+ SET( VAL 1 )
+ ELSE( HAVE_STDLIB_H )
+ SET( VAL 0 )
+ ENDIF( HAVE_STDLIB_H )
+ FILE( APPEND ${CONFIG_H} "#define HAVE_STDLIB_H ${VAL}\n\n" )
+
+ CHECK_INCLUDE_FILE( unistd.h HAVE_UNISTD_H )
+ IF( HAVE_UNISTD_H )
+ SET( VAL 1 )
+ ELSE( HAVE_UNISTD_H )
+ SET( VAL 0 )
+ ENDIF( HAVE_UNISTD_H )
+ FILE( APPEND ${CONFIG_H} "#define HAVE_UNISTD_H ${VAL}\n\n" )
+
+ CHECK_INCLUDE_FILE( sys/types.h HAVE_SYS_TYPES_H )
+ IF( HAVE_SYS_TYPES_H )
+ SET( VAL 1 )
+ ELSE( HAVE_SYS_TYPES_H )
+ SET( VAL 0 )
+ ENDIF( HAVE_SYS_TYPES_H )
+ FILE( APPEND ${CONFIG_H} "#define HAVE_SYS_TYPES_H ${VAL}\n\n" )
+
+ CHECK_INCLUDE_FILE( sys/stat.h HAVE_SYS_STAT_H )
+ IF( HAVE_SYS_STAT_H )
+ SET( VAL 1 )
+ ELSE( HAVE_SYS_STAT_H )
+ SET( VAL 0 )
+ ENDIF( HAVE_SYS_STAT_H )
+ FILE( APPEND ${CONFIG_H} "#define HAVE_SYS_STAT_H ${VAL}\n\n" )
+
+ CHECK_INCLUDE_FILE( pthread.h HAVE_PTHREAD_H )
+ IF( HAVE_PTHREAD_H )
+ SET( VAL 1 )
+ ELSE( HAVE_PTHREAD_H )
+ SET( VAL 0 )
+ ENDIF( HAVE_PTHREAD_H )
+ FILE( APPEND ${CONFIG_H} "#define HAVE_PTHREAD_H ${VAL}\n\n" )
+
+ CHECK_INCLUDE_FILE( sys/ioctl.h HAVE_SYS_IOCTL_H )
+ IF( HAVE_SYS_IOCTL_H )
+ SET( VAL 1 )
+ ELSE( HAVE_SYS_IOCTL_H )
+ SET( VAL 0 )
+ ENDIF( HAVE_SYS_IOCTL_H )
+ FILE( APPEND ${CONFIG_H} "#define HAVE_SYS_IOCTL_H ${VAL}\n\n" )
+
+ CHECK_INCLUDE_FILE( fcntl.h HAVE_FCNTL_H )
+ IF( HAVE_FCNTL_H )
+ SET( VAL 1 )
+ ELSE( HAVE_FCNTL_H )
+ SET( VAL 0 )
+ ENDIF( HAVE_FCNTL_H )
+ FILE( APPEND ${CONFIG_H} "#define HAVE_FCNTL_H ${VAL}\n\n" )
+
+ CHECK_INCLUDE_FILE( time.h HAVE_TIME_H )
+ IF( HAVE_TIME_H )
+ SET( VAL 1 )
+ ELSE( HAVE_TIME_H )
+ SET( VAL 0 )
+ ENDIF( HAVE_TIME_H )
+ FILE( APPEND ${CONFIG_H} "#define HAVE_TIME_H ${VAL}\n\n" )
+
+ CHECK_INCLUDE_FILE( errno.h HAVE_ERRNO_H )
+ IF( HAVE_ERRNO_H )
+ SET( VAL 1 )
+ ELSE( HAVE_ERRNO_H )
+ SET( VAL 0 )
+ ENDIF( HAVE_ERRNO_H )
+ FILE( APPEND ${CONFIG_H} "#define HAVE_ERRNO_H ${VAL}\n\n" )
+
+ CHECK_INCLUDE_FILE( zlib.h HAVE_ZLIB_H )
+ IF( HAVE_ZLIB_H )
+ SET( VAL 1 )
+ ELSE( HAVE_ZLIB_H )
+ SET( VAL 0 )
+ ENDIF( HAVE_ZLIB_H )
+ FILE( APPEND ${CONFIG_H} "#define HAVE_ZLIB_H ${VAL}\n\n" )
+
+ CHECK_INCLUDE_FILE( sys/filio.h HAVE_FILIO_H )
+ IF( HAVE_FILIO_H )
+ SET( VAL 1 )
+ ELSE( HAVE_FILIO_H )
+ SET( VAL 0 )
+ ENDIF( HAVE_FILIO_H )
+ FILE( APPEND ${CONFIG_H} "#define HAVE_FILIO_H ${VAL}\n\n" )
+
+ CHECK_FUNCTION_EXISTS( strnlen HAVE_STRNLEN )
+ IF( HAVE_STRNLEN )
+ SET( VAL 1 )
+ ELSE( HAVE_STRNLEN )
+ SET( VAL 0 )
+ ENDIF( HAVE_STRNLEN )
+ FILE( APPEND ${CONFIG_H} "#define HAVE_STRNLEN ${VAL}\n\n" )
+
+ ENDIF( WIN32 )
+
+ENDIF ( WROTE_CONFIG_H )
Deleted: gearbox/trunk/cmake/internal/CheckCompiler.cmake
===================================================================
--- gearbox/trunk/cmake/internal/CheckCompiler.cmake 2008-03-19 08:12:47 UTC (rev 106)
+++ gearbox/trunk/cmake/internal/CheckCompiler.cmake 2008-03-26 00:55:37 UTC (rev 107)
@@ -1,37 +0,0 @@
-#
-# If we're using gcc, make sure the version is OK.
-#
-IF ( ${CMAKE_C_COMPILER} MATCHES gcc )
-
- EXEC_PROGRAM ( ${CMAKE_C_COMPILER} ARGS --version OUTPUT_VARIABLE gcc_version )
- MESSAGE ( STATUS "gcc version: ${gcc_version}")
-
- # Why doesn't this work?
- #STRING( REGEX MATCHALL "gcc\.*" VERSION_STRING ${CMAKE_C_COMPILER} )
-
- IF ( gcc_version MATCHES ".*4\\.[0-9]\\.[0-9]" )
- SET( GCC_VERSION_OK 1 )
- ENDIF ( gcc_version MATCHES ".*4\\.[0-9]\\.[0-9]")
-
- GBX_ASSERT ( GCC_VERSION_OK
- "Checking gcc version - failed. ${PROJECT_NAME} requires gcc v. 4.x"
- "Checking gcc version - ok"
- 1 )
-
- IF ( gcc_version MATCHES ".*4\\.0.*" )
- # gcc 4.0.x
- ENDIF ( gcc_version MATCHES ".*4\\.0.*" )
-
- IF ( gcc_version MATCHES ".*4\\.1.*" )
- # gcc 4.1.x
- # gcc-4.1 adds stack protection, which makes code robust to buffer-overrun attacks
- # (see: http://www.trl.ibm.com/projects/security/ssp/)
- # However for some reason this can result in the symbol '__stack_chk_fail_local' not being found.
- # So turn it off.
- # Tobi: it looks like stack protection is off by default from version gcc 4.1.2, so we don't need this any more.
- # Will keep it for now, it doesn't hurt.
- ADD_DEFINITIONS( -fno-stack-protector )
- ENDIF ( gcc_version MATCHES ".*4\\.1.*" )
-
-
-ENDIF ( ${CMAKE_C_COMPILER} MATCHES gcc )
Deleted: gearbox/trunk/cmake/internal/DependencyUtils.cmake
===================================================================
--- gearbox/trunk/cmake/internal/DependencyUtils.cmake 2008-03-19 08:12:47 UTC (rev 106)
+++ gearbox/trunk/cmake/internal/DependencyUtils.cmake 2008-03-26 00:55:37 UTC (rev 107)
@@ -1,181 +0,0 @@
-MACRO( GBX_MAKE_OPTION_NAME option_name module_type module_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_MAKE_OPTION_NAME, 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'" )
- ENDIF ( is_exe AND is_lib )
-
- STRING( TOUPPER ${module_name} module_name_upper )
- IF ( is_exe )
- SET( option_name "ENABLE_${module_name_upper}" )
- ELSE ( is_exe )
- SET( option_name "ENABLE_LIB_${module_name_upper}" )
- ENDIF ( is_exe )
-
-ENDMACRO( GBX_MAKE_OPTION_NAME option_name module_name )
-
-#
-# GBX_REQUIRE_OPTION( cumulative_var [EXE | LIB] module_name default_option_value [option_name] [OPTION DESCRIPTION] )
-#
-# E.g.
-# Initialize a variable first
-# SET( BUILD TRUE )
-# Now set up and test option value
-# GBX_REQUIRE_OPTION ( BUILD EXE localiser ON )
-# This does the same thing
-# GBX_REQUIRE_OPTION ( BUILD EXE localiser ON BUILD_LOCALISER )
-#
-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 )
- STRING( TOUPPER ${module_name} module_name_upper )
- IF ( is_exe )
- SET( option_name "ENABLE_${module_name_upper}" )
- ELSE ( is_exe )
- SET( option_name "ENABLE_LIB_${module_name_upper}" )
- ENDIF ( is_exe )
- ENDIF ( ${ARGC} GREATER 5 )
-
- IF ( ${ARGC} GREATER 6 )
- SET( option_descr ${ARGV7} )
- ELSE ( ${ARGC} GREATER 6 )
- SET( option_descr "disabled by user, use ccmake to enable" )
- ENDIF ( ${ARGC} GREATER 6 )
-
- # debug
-# MESSAGE( STATUS
-# "GBX_REQUIRE_OPTION (CUM_VAR=${cumulative_var}, MOD_TYPE=${module_type}, MOD_NAME=${module_name}, default_option_value=${default_option_value}, OPT_NAME=${option_name}, OPT_DESC=${option_descr})" )
-
- # set up the option
- IF ( is_exe )
- OPTION( ${option_name} "Try to build ${module_name}" ${default_option_value} )
- ELSE ( is_exe )
- OPTION( ${option_name} "Try to build lib${module_name} library" ${default_option_value} )
- ENDIF ( is_exe )
-
- # must dereference both var and option names once (!) and IF will evaluate their values
- IF ( ${cumulative_var} AND NOT ${option_name} )
- SET( ${cumulative_var} FALSE )
- IF ( is_exe )
- GBX_NOT_ADD_EXECUTABLE( ${module_name} ${option_descr} )
- ELSE ( is_exe )
- GBX_NOT_ADD_LIBRARY( ${module_name} ${option_descr} )
- ENDIF ( is_exe )
- ENDIF ( ${cumulative_var} AND NOT ${option_name} )
-
-ENDMACRO( GBX_REQUIRE_OPTION cumulative_var module_type module_name default_option_value )
-
-#
-# GBX_REQUIRE_VAR ( cumulative_var [EXE | LIB] module_name test_var reason )
-#
-# E.g.
-# Initialize a variable first
-# SET( BUILD TRUE )
-# Now test the variable value
-# GBX_REQUIRE_VAR ( BUILD LIB HydroStuff GOOD_TO_GO "good-to-go is no good" )
-#
-MACRO( GBX_REQUIRE_VAR cumulative_var module_type module_name test_var reason )
-
- # 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 )
-
- # 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} )
- ELSE ( is_exe )
- GBX_NOT_ADD_LIBRARY( ${module_name} ${reason} )
- ENDIF ( is_exe )
- ENDIF ( ${cumulative_var} AND NOT ${test_var} )
-
-ENDMACRO( GBX_REQUIRE_VAR cumulative_var module_type module_name test_var reason )
-
-#
-# GBX_REQUIRE_TARGET( cumulative_var [EXE | LIB] module_name target_name [reason] )
-#DEPS
-# E.g.
-# Initialize a variable first
-# SET( BUILD TRUE )
-# Now set up and test option value
-# GBX_REQUIRE_TARGET ( BUILD EXE localiser HydroStuff )
-#
-MACRO( GBX_REQUIRE_TARGET 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} ]" )
-
- 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 ( ${ARGC} GREATER 5 )
- SET( reason ${ARGV6} )
- ELSE ( ${ARGC} GREATER 5 )
- SET( reason "lib${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 ( ${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_TARGET cumulative_var module_type module_name target_name )
-
-
-#
-# GBX_REQUIRE_TARGETS( cumulative_var [EXE | LIB] module_name TARGET0 [TARGET1 TARGET2 ...] )
-#
-MACRO( GBX_REQUIRE_TARGETS 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} ]" )
-
- IF( ${ARGC} LESS 4 )
- MESSAGE( FATAL_ERROR "GBX_REQUIRE_TARGETS 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} )
- ENDFOREACH( trgt ${ARGN} )
-
-ENDMACRO( GBX_REQUIRE_TARGETS cumulative_var module_type module_name )
Modified: gearbox/trunk/cmake/internal/Setup.cmake
===================================================================
--- gearbox/trunk/cmake/internal/Setup.cmake 2008-03-19 08:12:47 UTC (rev 106)
+++ gearbox/trunk/cmake/internal/Setup.cmake 2008-03-26 00:55:37 UTC (rev 107)
@@ -11,30 +11,30 @@
#
# Process version number
#
-INCLUDE( ${GBX_CMAKE_DIR}/internal/SetupVersion.cmake )
+INCLUDE( ${GBX_CMAKE_DIR}/SetupVersion.cmake )
#
# Project directories, including installation
#
-INCLUDE( ${GBX_CMAKE_DIR}/internal/SetupDirectories.cmake )
+INCLUDE( ${GBX_CMAKE_DIR}/SetupDirectories.cmake )
#
# Determine OS, and make os-specefic choices
#
-INCLUDE( ${GBX_CMAKE_DIR}/internal/SetupOs.cmake )
+INCLUDE( ${GBX_CMAKE_DIR}/SetupOs.cmake )
#
# Set the build type (affects debugging symbols and optimization)
#
-INCLUDE( ${GBX_CMAKE_DIR}/internal/SetupBuildType.cmake )
+INCLUDE( ${GBX_CMAKE_DIR}/SetupBuildType.cmake )
#
# Include internal macro definitions
#
INCLUDE( ${GBX_CMAKE_DIR}/Assert.cmake )
-INCLUDE( ${GBX_CMAKE_DIR}/internal/TargetUtils.cmake )
-INCLUDE( ${GBX_CMAKE_DIR}/internal/DependencyUtils.cmake )
+INCLUDE( ${GBX_CMAKE_DIR}/TargetUtils.cmake )
+INCLUDE( ${GBX_CMAKE_DIR}/DependencyUtils.cmake )
#
# Defaults for big source code switches
@@ -45,7 +45,7 @@
#
# check compiler type and version
#
-INCLUDE( ${GBX_CMAKE_DIR}/internal/CheckCompiler.cmake )
+INCLUDE( ${GBX_CMAKE_DIR}/CheckCompiler.cmake )
#
# Defaults for big source code switches
@@ -56,17 +56,24 @@
#
# Look for low-level C headers, write defines to config.h
#
-INCLUDE( ${GBX_CMAKE_DIR}/internal/WriteConfigH.cmake )
+INCLUDE( ${GBX_CMAKE_DIR}/WriteConfigH.cmake )
#
# Installation preferences
#
-# CMake default is FALSE
-# SET( CMAKE_SKIP_BUILD_RPATH TRUE )
-# CMake default is FALSE
-# SET( CMAKE_BUILD_WITH_INSTALL_RPATH TRUE )
-SET( CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib )
+# CMake defaults
+# see: \http://www.cmake.org/Wiki/CMake_RPATH_handling
+#
+# use, i.e. don't skip the full RPATH for the build tree
+# SET(CMAKE_SKIP_BUILD_RPATH FALSE)
+# when building, don't use the install RPATH already
+# (but later on when installing)
+# SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
+
+# the RPATH to be used when installing
+SET( CMAKE_INSTALL_RPATH ${GBX_LIB_INSTALL_DIR} )
+
# Enable testing by including the Dart module
# (must be done *before* entering source directories )
INCLUDE (${CMAKE_ROOT}/Modules/Dart.cmake)
Deleted: gearbox/trunk/cmake/internal/SetupBuildType.cmake
===================================================================
--- gearbox/trunk/cmake/internal/SetupBuildType.cmake 2008-03-19 08:12:47 UTC (rev 106)
+++ gearbox/trunk/cmake/internal/SetupBuildType.cmake 2008-03-26 00:55:37 UTC (rev 107)
@@ -1,18 +0,0 @@
-IF ( NOT CMAKE_BUILD_TYPE )
-
- IF ( NOT GBX_OS_WIN )
- # For gcc, RelWithDebInfo gives '-O2 -g'
- SET( CMAKE_BUILD_TYPE RelWithDebInfo )
- ELSE ( NOT GBX_OS_WIN )
- # windows... a temp hack: VCC does not seem to respect the cmake
- # setting and always defaults to debug, we have to match it here.
- SET( CMAKE_BUILD_TYPE Debug )
- ENDIF ( NOT GBX_OS_WIN )
-
- MESSAGE( STATUS "Setting build type to '${CMAKE_BUILD_TYPE}'" )
-
-ELSE ( NOT CMAKE_BUILD_TYPE )
-
- MESSAGE( STATUS "Build type set to '${CMAKE_BUILD_TYPE}' by user." )
-
-ENDIF ( NOT CMAKE_BUILD_TYPE )
Deleted: gearbox/trunk/cmake/internal/SetupDirectories.cmake
===================================================================
--- gearbox/trunk/cmake/internal/SetupDirectories.cmake 2008-03-19 08:12:47 UTC (rev 106)
+++ gearbox/trunk/cmake/internal/SetupDirectories.cmake 2008-03-26 00:55:37 UTC (rev 107)
@@ -1,38 +0,0 @@
-#
-# This CMake variable may be provided by the user on the command line
-# e.g. $ cmake -DGEARBOX_INSTALL=/home/user .
-#
-IF( CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT )
-
- IF( DEFINED GEARBOX_INSTALL )
-
- MESSAGE( STATUS GEARBOX_INSTALL=${GEARBOX_INSTALL} )
-
- # using user-supplied installation directory
- # SET( CMAKE_INSTALL_PREFIX ${GEARBOX_INSTALL} )
- SET( CMAKE_INSTALL_PREFIX ${GEARBOX_INSTALL} CACHE PATH "Installation directory" FORCE )
-
- MESSAGE( STATUS CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} )
-
- ELSE( DEFINED GEARBOX_INSTALL )
- #
- # Default installation directory is OS-dependent.
- #
- IF ( NOT GBX_OS_WIN )
- SET( CMAKE_INSTALL_PREFIX /usr/local CACHE PATH "Installation directory" FORCE )
- ELSE ( NOT GBX_OS_WIN )
- SET( CMAKE_INSTALL_PREFIX "C:\Program Files\Gearbox\Include" CACHE PATH "Installation directory" FORCE )
- ENDIF ( NOT GBX_OS_WIN )
-
- ENDIF( DEFINED GEARBOX_INSTALL )
-
-ENDIF( CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT )
-
-MESSAGE( STATUS "Setting installation directory to ${CMAKE_INSTALL_PREFIX}" )
-
-#
-# It's sometimes useful to refer to the top level of the project.
-# CMake does not make it very easy.
-#
-SET( GBX_PROJECT_SOURCE_DIR ${${PROJECT_NAME}_SOURCE_DIR} )
-SET( GBX_PROJECT_BINARY_DIR ${${PROJECT_NAME}_BINARY_DIR} )
Deleted: gearbox/trunk/cmake/internal/SetupOs.cmake
===================================================================
--- gearbox/trunk/cmake/internal/SetupOs.cmake 2008-03-19 08:12:47 UTC (rev 106)
+++ gearbox/trunk/cmake/internal/SetupOs.cmake 2008-03-26 00:55:37 UTC (rev 107)
@@ -1,41 +0,0 @@
-#
-# Check the OS type.
-# Sets the 'GBX_OS_INCLUDES' variable, for system-wide Includes that must be set.
-#
-
-
-# CMake does not distinguish Linux from other Unices.
-STRING( REGEX MATCH Linux GBX_OS_LINUX ${CMAKE_SYSTEM_NAME})
-
-# Rename CMake's variable to something which makes more sense.
-IF ( QNXNTO )
- SET( GBX_OS_QNX TRUE BOOL INTERNAL )
-ENDIF ( QNXNTO )
-
-# In windows we just mirror CMake's own variable
-IF ( WIN32 )
- SET( GBX_OS_WIN TRUE BOOL INTERNAL )
-ENDIF ( WIN32 )
-
-# In MacOS X we just mirror CMake's own variable
-IF ( APPLE )
- SET( GBX_OS_MAC TRUE BOOL INTERNAL )
-ENDIF ( APPLE )
-
-
-# From now on, use our own OS flags
-
-IF ( GBX_OS_LINUX )
- MESSAGE ( STATUS "Running on Linux" )
-ENDIF ( GBX_OS_LINUX )
-
-IF ( GBX_OS_QNX )
- MESSAGE ( STATUS "Running on QNX" )
- ADD_DEFINITIONS( -shared -fexceptions )
-ENDIF ( GBX_OS_QNX )
-
-IF ( GBX_OS_WIN )
- # CMake seems not to set this property correctly for some reason
- SET( GBX_EXE_EXTENSION ".exe" )
- MESSAGE ( STATUS "Running on Windows" )
-ENDIF ( GBX_OS_WIN )
Deleted: gearbox/trunk/cmake/internal/SetupVersion.cmake
===================================================================
--- gearbox/trunk/cmake/internal/SetupVersion.cmake 2008-03-19 08:12:47 UTC (rev 106)
+++ gearbox/trunk/cmake/internal/SetupVersion.cmake 2008-03-26 00:55:37 UTC (rev 107)
@@ -1,10 +0,0 @@
-#
-# define the project version so we can have access to it from the code
-#
-
-# alexm: for gcc need to produce this in the Makefile: -DGEARBOX_VERSION=\"X.Y.Z\",
-# without escaping the quotes the compiler will strip them off.
-# alexb: it seems that you also need to escape the quotes for windoze??
-
-ADD_DEFINITIONS( "-DGEARBOX_VERSION=\\\"${GBX_PROJECT_VERSION}\\\"" )
-# ADD_DEFINITIONS( "-DCMAKE_INSTALL_PREFIX=\\\"${CMAKE_INSTALL_PREFIX}\\\"" )
Deleted: gearbox/trunk/cmake/internal/TargetUtils.cmake
===================================================================
--- gearbox/trunk/cmake/internal/TargetUtils.cmake 2008-03-19 08:12:47 UTC (rev 106)
+++ gearbox/trunk/cmake/internal/TargetUtils.cmake 2008-03-26 00:55:37 UTC (rev 107)
@@ -1,276 +0,0 @@
-#
-# Components should add themselves by calling 'GBX_ADD_EXECUTABLE'
-# instead of 'ADD_EXECUTABLE' in CMakeLists.txt.
-# Usage: GBX_ADD_EXECUTABLE( name src1 src2 src3 )
-#
-MACRO( GBX_ADD_EXECUTABLE name )
- ADD_EXECUTABLE( ${name} ${ARGN} )
- SET_TARGET_PROPERTIES( ${name} PROPERTIES
- INSTALL_RPATH "${INSTALL_RPATH};${CMAKE_INSTALL_PREFIX}/lib/gearbox"
- BUILD_WITH_INSTALL_RPATH TRUE )
- INSTALL( TARGETS ${name} RUNTIME DESTINATION bin )
- SET( templist ${COMPONENT_LIST} )
- LIST ( APPEND templist ${name} )
-# MESSAGE ( STATUS "DEBUG: ${templist}" )
- SET( COMPONENT_LIST ${templist} CACHE INTERNAL "Global list of components to build" FORCE )
- MESSAGE( STATUS "Planning to Build Executable: ${name}" )
-ENDMACRO( GBX_ADD_EXECUTABLE name )
-
-#
-# Components should add themselves by calling 'GBX_ADD_EXECUTABLE'
-# instead of 'ADD_LIBRARY' in CMakeLists.txt.
-# Usage: GBX_ADD_LIBRARY( name src1 src2 src3 )
-#
-MACRO( GBX_ADD_LIBRARY name )
- ADD_LIBRARY( ${name} ${ARGN} )
- SET_TARGET_PROPERTIES( ${name} PROPERTIES
- INSTALL_RPATH "${INSTALL_RPATH};${CMAKE_INSTALL_PREFIX}/lib/gearbox"
- BUILD_WITH_INSTALL_RPATH TRUE )
- INSTALL( TARGETS ${name} LIBRARY DESTINATION lib/gearbox )
- SET( templist ${LIBRARY_LIST} )
- LIST ( APPEND templist ${name} )
- SET( LIBRARY_LIST ${templist} CACHE INTERNAL "Global list of libraries to build" FORCE )
- MESSAGE( STATUS "Planning to Build Library : ${name}" )
-ENDMACRO( GBX_ADD_LIBRARY name )
-
-#
-# GBX_ADD_HEADERS( install_subdir FILE0 [FILE1 FILE2 ...] )
-#
-# Specialization of INSTALL(FILES ...) for GearBox project.
-# All files are installed into PREFIX/include/gearbox/${install_subdir}
-#
-MACRO( GBX_ADD_HEADERS install_subdir )
- INSTALL( FILES ${ARGN} DESTINATION include/gearbox/${install_subdir} )
-ENDMACRO( GBX_ADD_HEADERS install_subdir )
-
-#
-# GBX_ADD_EXAMPLE( install_subdir makefile.in makefile.out [FILE0 FILE1 FILE2 ...] )
-#
-# Specialisation of INSTALL(FILES ...) for GearBox project to to install examples.
-# All files are installed into PREFIX/share/gearbox/${install_subdir}.
-# makefile is passed through CONFIGURE_FILE to add in correct include and library
-# paths based on the install prefix.
-#
-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/gearbox/${install_subdir} RENAME CMakeLists.txt )
- INSTALL( FILES ${ARGN} DESTINATION share/gearbox/${install_subdir} )
-ENDMACRO( GBX_ADD_EXAMPLE install_subdir makefile )
-
-#
-# GBX_ADD_PKGCONFIG( name cflags libflags [DEPENDENCY0 DEPENDENCY1 ...] )
-#
-# Creates a pkg-config file for library "name".
-# desc is a description of the library.
-# ext_deps is a list containing all the external libraries this one requires (pass by reference).
-# int_deps is a list containing all the internal libraries this library depends on (pass by reference).
-# cflags is appended to the "Cflags" value.
-# libflags is appended to the "Libs" value.
-# that should be linked with at the same time as linking to this library.
-#
-MACRO( GBX_ADD_PKGCONFIG name desc ext_deps int_deps cflags libflags )
- SET( PKG_NAME ${name} )
- SET( PKG_DESC ${desc} )
- ...
[truncated message content] |
|
From: <gb...@us...> - 2008-03-19 08:12:42
|
Revision: 106
http://gearbox.svn.sourceforge.net/gearbox/?rev=106&view=rev
Author: gbiggs
Date: 2008-03-19 01:12:47 -0700 (Wed, 19 Mar 2008)
Log Message:
-----------
Stopped examples compiling by default.
Modified Paths:
--------------
gearbox/trunk/src/basicexample/CMakeLists.txt
gearbox/trunk/src/gbxadvancedexample/CMakeLists.txt
Modified: gearbox/trunk/src/basicexample/CMakeLists.txt
===================================================================
--- gearbox/trunk/src/basicexample/CMakeLists.txt 2008-03-19 08:12:31 UTC (rev 105)
+++ gearbox/trunk/src/basicexample/CMakeLists.txt 2008-03-19 08:12:47 UTC (rev 106)
@@ -2,7 +2,7 @@
GBX_ADD_LICENSE( LGPL )
SET ( build TRUE )
-GBX_REQUIRE_OPTION( build LIB ${lib_name} ON )
+GBX_REQUIRE_OPTION( build LIB ${lib_name} OFF )
IF ( build )
Modified: gearbox/trunk/src/gbxadvancedexample/CMakeLists.txt
===================================================================
--- gearbox/trunk/src/gbxadvancedexample/CMakeLists.txt 2008-03-19 08:12:31 UTC (rev 105)
+++ gearbox/trunk/src/gbxadvancedexample/CMakeLists.txt 2008-03-19 08:12:47 UTC (rev 106)
@@ -2,7 +2,7 @@
GBX_ADD_LICENSE( GPL )
SET ( build TRUE )
-GBX_REQUIRE_OPTION( build LIB ${lib_name} ON )
+GBX_REQUIRE_OPTION( build LIB ${lib_name} OFF )
GBX_REQUIRE_VAR( build LIB ${lib_name} GBX_OS_LINUX "only Linux OS is supported" )
SET( dep_libs basicexample )
@@ -20,4 +20,4 @@
GBX_ADD_HEADERS( gbxadvancedexample ${hdrs} )
-ENDIF ( build )
\ No newline at end of file
+ENDIF ( build )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gb...@us...> - 2008-03-19 08:12:25
|
Revision: 105
http://gearbox.svn.sourceforge.net/gearbox/?rev=105&view=rev
Author: gbiggs
Date: 2008-03-19 01:12:31 -0700 (Wed, 19 Mar 2008)
Log Message:
-----------
Corrections to the documentation, fixed an off-by-one error in getting limited ranges.
Modified Paths:
--------------
gearbox/trunk/src/urg_nz/urg_nz.cpp
gearbox/trunk/src/urg_nz/urg_nz.h
Modified: gearbox/trunk/src/urg_nz/urg_nz.cpp
===================================================================
--- gearbox/trunk/src/urg_nz/urg_nz.cpp 2008-03-19 07:59:12 UTC (rev 104)
+++ gearbox/trunk/src/urg_nz/urg_nz.cpp 2008-03-19 08:12:31 UTC (rev 105)
@@ -475,9 +475,9 @@
// Shift the range readings down by min_i if necessary
if (min_i > 0)
{
- memmove (&readings->Readings[0], &readings->Readings[min_i], (max_i - min_i) * sizeof (readings->Readings[0]));
+ memmove (&readings->Readings[0], &readings->Readings[min_i], (max_i - min_i + 1) * sizeof (readings->Readings[0]));
// Don't forget to adjust the number of readings to account for this
- num_readings_read -= (MAX_READINGS - max_i) + min_i;
+ num_readings_read -= (MAX_READINGS - max_i) + min_i - 1; // -1 because max_i is inclusive
}
}
else // SCIP_Version == 2
@@ -565,9 +565,9 @@
// Shift the range readings down by min_i if necessary
if (min_i > 0)
{
- memmove (&readings->Readings[0], &readings->Readings[min_i], (max_i - min_i) * sizeof (readings->Readings[0]));
+ memmove (&readings->Readings[0], &readings->Readings[min_i], (max_i - min_i + 1) * sizeof (readings->Readings[0]));
// Don't forget to adjust the number of readings to account for this
- num_readings_read -= (MAX_READINGS - max_i) + min_i;
+ num_readings_read -= (MAX_READINGS - max_i) + min_i - 1; // -1 because max_i is inclusive
}
}
Modified: gearbox/trunk/src/urg_nz/urg_nz.h
===================================================================
--- gearbox/trunk/src/urg_nz/urg_nz.h 2008-03-19 07:59:12 UTC (rev 104)
+++ gearbox/trunk/src/urg_nz/urg_nz.h 2008-03-19 08:12:31 UTC (rev 105)
@@ -164,7 +164,10 @@
/** @brief Retrieve a set of range readings from the scanner. Ranges are returned in millimetres.
The scan is a series of discrete values. They can be indexed, starting at 0 and going up to
- @ref MAX_READINGS. A subset of these values only can be returned using min_i and max_i.
+ @ref MAX_READINGS. A subset of these values only can be returned using min_i and max_i. These
+ are inclusive, e.g. asking for readings from 5 to 10 will return 6 readings. Typically, you will
+ want to at least exclude the readings the scanner can't actually see, as given by
+ @ref GetSensorConfig.
@param readings Pointer to a @ref urg_nz_laser_readings_t structure to store the data in.
@param min_i The minimum scan index to retrieve. Must be at least 0. Default is 0.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-03-19 07:59:14
|
Revision: 104
http://gearbox.svn.sourceforge.net/gearbox/?rev=104&view=rev
Author: borax00
Date: 2008-03-19 00:59:12 -0700 (Wed, 19 Mar 2008)
Log Message:
-----------
fixed write-has-to-wait-for-read problem.
Modified Paths:
--------------
gearbox/trunk/src/gbxserialacfr/serial.cpp
gearbox/trunk/src/gbxserialacfr/serial.h
gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp
gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h
Modified: gearbox/trunk/src/gbxserialacfr/serial.cpp
===================================================================
--- gearbox/trunk/src/gbxserialacfr/serial.cpp 2008-03-19 00:16:15 UTC (rev 103)
+++ gearbox/trunk/src/gbxserialacfr/serial.cpp 2008-03-19 07:59:12 UTC (rev 104)
@@ -597,7 +597,6 @@
{
got += ret;
}
-
else if (timeoutsEnabled() && (errno == EAGAIN) )
{
if ( waitForDataOrTimeout() == TIMED_OUT )
@@ -642,7 +641,7 @@
char nextChar = 0;
do {
- //Check for buf overrun Must leave room for NULL terminator
+ // Check for buf overrun Must leave room for NULL terminator
if ( dataPtr >= bufPtr + (count - 1) )
{
stringstream ss;
@@ -664,12 +663,12 @@
{
continue;
}else{
- *dataPtr = 0x00; //Timed out. terminate string just incase it's used anyway
+ *dataPtr = 0x00; // Timed out. terminate string just incase it's used anyway
return -1;
}
}
- //If we get here then it was a more serious error
+ // If we get here then it was a more serious error
stringstream ss;
ss << "Serial::"<<__func__<<"(): "<<strerror(errno);
throw SerialException( ss.str() );
@@ -682,8 +681,6 @@
// Return the number of chars not including the NULL
return ( (int) (dataPtr - bufPtr) );
-
- //TODO: Duncan! I think that this should cope with any <CR><LF> pair gracefully!
}
Modified: gearbox/trunk/src/gbxserialacfr/serial.h
===================================================================
--- gearbox/trunk/src/gbxserialacfr/serial.h 2008-03-19 00:16:15 UTC (rev 103)
+++ gearbox/trunk/src/gbxserialacfr/serial.h 2008-03-19 07:59:12 UTC (rev 104)
@@ -38,8 +38,6 @@
//! - 8 data bits
//! - no handshaking
//!
-//! Warning: this thing is _NOT_ thread-safe.
-//!
//! @author Matthew Ridley, Alex Brooks
//!
class Serial : public Uncopyable
@@ -173,7 +171,7 @@
int portFd_;
Timeout timeout_;
-
+
int debugLevel_;
lockfile::LockFile *lockFile_;
Modified: gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp 2008-03-19 00:16:15 UTC (rev 103)
+++ gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp 2008-03-19 07:59:12 UTC (rev 104)
@@ -51,8 +51,6 @@
serial_(serialPort),
responseParser_(responseParser),
responseBuffer_(-1,gbxiceutilacfr::BufferTypeCircular),
- isMessageWaitingToBeSent_(false),
- baudRateChangePending_(false),
unparsedBytesWarnThreshold_(unparsedBytesWarnThreshold),
tracer_(tracer),
status_(status)
@@ -73,31 +71,19 @@
void
SerialDeviceHandler::setBaudRate( int baudRate )
{
- stringstream ss; ss << "SerialDeviceHandler: baud rate change requested: " << baudRate;
- tracer_.debug( ss.str() );
-
- IceUtil::Mutex::Lock lock(mutex_);
-
- assert( !baudRateChangePending_ );
-
- baudRateChangePending_ = true;
- newBaudRate_ = baudRate;
+ tracer_.debug( "SerialDeviceHandler: Changing baud rate and flushing." );
+ serial_.setBaudRate( baudRate );
+ // TODO: AlexB: not entirely sure if these are
+ // necessary, they should either be removed or
+ // added to the setBaudRate function.
+ serial_.flush();
+ serial_.drain();
}
void
SerialDeviceHandler::send( const char *commandBytes, int numCommandBytes )
{
- IceUtil::Mutex::Lock lock(mutex_);
-
- if ( isMessageWaitingToBeSent_ )
- {
- stringstream ss;
- ss << "SerialDeviceHandler::send(): there's a message already waiting to be sent!";
- throw gbxutilacfr::Exception( ERROR_INFO, ss.str() );
- }
- isMessageWaitingToBeSent_ = true;
- toSend_.resize(numCommandBytes);
- memcpy( &(toSend_[0]), commandBytes, numCommandBytes*sizeof(char) );
+ serial_.write( commandBytes, numCommandBytes );
}
void
@@ -112,41 +98,6 @@
try {
- // Check for house-keeping jobs first
- try
- {
- IceUtil::Mutex::Lock lock(mutex_);
-
- if ( baudRateChangePending_ )
- {
- tracer_.debug( "SerialDeviceHandler: Changing baud rate and flushing." );
- baudRateChangePending_ = false;
- serial_.setBaudRate( newBaudRate_ );
- // TODO: AlexB: not entirely sure if these are
- // necessary, they should either be removed or
- // added to the setBaudRate function.
- serial_.flush();
- serial_.drain();
- }
-
- if ( isMessageWaitingToBeSent_ )
- {
- stringstream ss;
- ss<<"SerialDeviceHandler: sending: " << toHexString(toSend_);
- tracer_.debug( ss.str() );
-
- isMessageWaitingToBeSent_ = false;
- serial_.write( &(toSend_[0]), toSend_.size() );
- }
- }
- catch ( std::exception &e )
- {
- stringstream ss;
- ss << "SerialDeviceHandler: During house-keeping jobs: " << e.what();
- tracer_.error( ss.str() );
- throw;
- }
-
// Wait for data to arrive, put it in our buffer_
try {
if ( getDataFromSerial() )
Modified: gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h 2008-03-19 00:16:15 UTC (rev 103)
+++ gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h 2008-03-19 07:59:12 UTC (rev 104)
@@ -125,8 +125,6 @@
// Returns: true if statusOK, false it something bad happened
bool processBuffer( const int &timeStampSec, int &timeStampUsec );
- IceUtil::Mutex mutex_;
-
gbxserialacfr::Serial &serial_;
// Knows how to parse for responses
@@ -138,13 +136,6 @@
// Thread-safe store of responses from the device
gbxiceutilacfr::Buffer<TimedResponse> responseBuffer_;
- // Stuff waiting to be sent
- bool isMessageWaitingToBeSent_;
- std::vector<char> toSend_;
-
- bool baudRateChangePending_;
- int newBaudRate_;
-
int unparsedBytesWarnThreshold_;
gbxutilacfr::Tracer& tracer_;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-03-19 00:16:17
|
Revision: 103
http://gearbox.svn.sourceforge.net/gearbox/?rev=103&view=rev
Author: russo2503v
Date: 2008-03-18 17:16:15 -0700 (Tue, 18 Mar 2008)
Log Message:
-----------
added ctests and a few related classes
Modified Paths:
--------------
gearbox/trunk/cmake/internal/Setup.cmake
gearbox/trunk/cmake/internal/SetupDirectories.cmake
gearbox/trunk/cmake/internal/WriteConfigH.cmake
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/CMakeLists.txt
gearbox/trunk/src/gbxsickacfr/gbxutilacfr/CMakeLists.txt
gearbox/trunk/src/gbxsickacfr/sickdefines.cpp
gearbox/trunk/src/gbxsickacfr/sickdefines.h
Added Paths:
-----------
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/notify.h
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.cpp
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.h
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/store.h
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/CMakeLists.txt
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/buffertest.cpp
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/notifytest.cpp
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/safethreadtest.cpp
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/storetest.cpp
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/subsystemthreadtest.cpp
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/threadtest.cpp
gearbox/trunk/src/gbxsickacfr/gbxutilacfr/test/
gearbox/trunk/src/gbxsickacfr/gbxutilacfr/test/CMakeLists.txt
gearbox/trunk/src/gbxsickacfr/gbxutilacfr/test/mathtest.cpp
Modified: gearbox/trunk/cmake/internal/Setup.cmake
===================================================================
--- gearbox/trunk/cmake/internal/Setup.cmake 2008-03-18 06:43:26 UTC (rev 102)
+++ gearbox/trunk/cmake/internal/Setup.cmake 2008-03-19 00:16:15 UTC (rev 103)
@@ -6,7 +6,7 @@
-SET( GBX_CMAKE_DIR ${${PROJECT_NAME}_SOURCE_DIR}/cmake CACHE PATH "Location of CMake scripts" )
+SET( GBX_CMAKE_DIR ${${PROJECT_NAME}_SOURCE_DIR}/cmake CACHE INTERNAL "Location of CMake scripts" )
#
# Process version number
@@ -14,7 +14,7 @@
INCLUDE( ${GBX_CMAKE_DIR}/internal/SetupVersion.cmake )
#
-# Project directories
+# Project directories, including installation
#
INCLUDE( ${GBX_CMAKE_DIR}/internal/SetupDirectories.cmake )
Modified: gearbox/trunk/cmake/internal/SetupDirectories.cmake
===================================================================
--- gearbox/trunk/cmake/internal/SetupDirectories.cmake 2008-03-18 06:43:26 UTC (rev 102)
+++ gearbox/trunk/cmake/internal/SetupDirectories.cmake 2008-03-19 00:16:15 UTC (rev 103)
@@ -1,12 +1,33 @@
#
-# Default installation directory is OS-dependent.
+# This CMake variable may be provided by the user on the command line
+# e.g. $ cmake -DGEARBOX_INSTALL=/home/user .
#
-IF ( NOT GBX_OS_WIN )
- SET( CMAKE_INSTALL_PREFIX /usr/local CACHE PATH "Installation directory" )
-ELSE ( NOT GBX_OS_WIN )
- SET( CMAKE_INSTALL_PREFIX "C:\Program Files\Gearbox\Include" CACHE PATH "Installation directory" )
-ENDIF ( NOT GBX_OS_WIN )
+IF( CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT )
+ IF( DEFINED GEARBOX_INSTALL )
+
+ MESSAGE( STATUS GEARBOX_INSTALL=${GEARBOX_INSTALL} )
+
+ # using user-supplied installation directory
+ # SET( CMAKE_INSTALL_PREFIX ${GEARBOX_INSTALL} )
+ SET( CMAKE_INSTALL_PREFIX ${GEARBOX_INSTALL} CACHE PATH "Installation directory" FORCE )
+
+ MESSAGE( STATUS CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} )
+
+ ELSE( DEFINED GEARBOX_INSTALL )
+ #
+ # Default installation directory is OS-dependent.
+ #
+ IF ( NOT GBX_OS_WIN )
+ SET( CMAKE_INSTALL_PREFIX /usr/local CACHE PATH "Installation directory" FORCE )
+ ELSE ( NOT GBX_OS_WIN )
+ SET( CMAKE_INSTALL_PREFIX "C:\Program Files\Gearbox\Include" CACHE PATH "Installation directory" FORCE )
+ ENDIF ( NOT GBX_OS_WIN )
+
+ ENDIF( DEFINED GEARBOX_INSTALL )
+
+ENDIF( CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT )
+
MESSAGE( STATUS "Setting installation directory to ${CMAKE_INSTALL_PREFIX}" )
#
Modified: gearbox/trunk/cmake/internal/WriteConfigH.cmake
===================================================================
--- gearbox/trunk/cmake/internal/WriteConfigH.cmake 2008-03-18 06:43:26 UTC (rev 102)
+++ gearbox/trunk/cmake/internal/WriteConfigH.cmake 2008-03-19 00:16:15 UTC (rev 103)
@@ -14,7 +14,7 @@
MESSAGE( STATUS "Not writing config.h -- wrote it previously" )
ELSE ( WROTE_CONFIG_H )
MESSAGE( STATUS "Writing config.h" )
- SET( WROTE_CONFIG_H TRUE CACHE BOOL "Wrote config.h" )
+ SET( WROTE_CONFIG_H TRUE CACHE INTERNAL "Wrote config.h" )
FILE( WRITE ${CONFIG_H} "/* config.h. Generated by CMakeLists.txt */\n\n" )
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/CMakeLists.txt
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/CMakeLists.txt 2008-03-18 06:43:26 UTC (rev 102)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/CMakeLists.txt 2008-03-19 00:16:15 UTC (rev 103)
@@ -33,8 +33,8 @@
GBX_ADD_HEADERS( gbxsickacfr/gbxiceutilacfr ${hdrs} )
-# IF ( GBX_BUILD_TESTS )
-# ADD_SUBDIRECTORY ( test )
-# ENDIF ( GBX_BUILD_TESTS )
+ IF ( GBX_BUILD_TESTS )
+ ADD_SUBDIRECTORY ( test )
+ ENDIF ( GBX_BUILD_TESTS )
ENDIF ( build )
Added: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/notify.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/notify.h (rev 0)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/notify.h 2008-03-19 00:16:15 UTC (rev 103)
@@ -0,0 +1,114 @@
+/*
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
+ * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp
+ *
+ * This distribution is licensed to you under the terms described in
+ * the LICENSE file included in this distribution.
+ *
+ */
+
+#ifndef GBXICEUTILACFR_NOTIFY_H
+#define GBXICEUTILACFR_NOTIFY_H
+
+#include <gbxsickacfr/gbxutilacfr/exceptions.h>
+#include <iostream>
+
+//
+// note: this class can be libGbxUtilAcfr but we keep it with the other "data pattern"
+// classes: Store and Buffer.
+//
+namespace gbxsickacfr {
+namespace gbxiceutilacfr {
+
+/*!
+ * @brief The object which implements the callback function.
+ *
+ * Derive from this class and implement the callback function NotifyHandler::handleData and
+ * register it with Notify by calline Notify::setNotifyHandler.
+ */
+template<class Type>
+class NotifyHandler
+{
+public:
+ virtual ~NotifyHandler() {};
+ //!
+ //! This function must be implemented by the component developer.
+ //!
+ virtual void handleData( const Type & obj )=0;
+};
+
+/*!
+ * @brief A data pipe with callback semantics.
+ *
+ * Write new data with Notify::set. The data is delivered to the data handler by
+ * calling NotifyHandler::handleData in the registered NotifyHandler.
+ *
+ * @see Buffer, Proxy
+ */
+template<class Type>
+class Notify
+{
+public:
+ Notify()
+ : hasNotifyHandler_(false)
+ {};
+
+ virtual ~Notify() {};
+
+ //! Sets internal link to the notify handler. If the provided pointer is NULL,
+ //! the internal link is quietly not set.
+ void setNotifyHandler( NotifyHandler<Type>* handler );
+
+ //! Returns TRUE is the notify handler has been set and FALSE otherwise.
+ bool hasNotifyHandler() { return hasNotifyHandler_; };
+
+ //! Forwards the @p obj to the data handler.
+ //! Raises gbxsickacfr::gbxutilacfr::Exception if the function is called when a notify handler has
+ //! not been set.
+ void set( const Type & obj );
+
+protected:
+ //! Reimplement this function for non-standard types.
+ virtual void internalSet( const Type & obj );
+
+ //! Interface to the object which is notified of incoming data.
+ NotifyHandler<Type>* handler_;
+
+private:
+
+ bool hasNotifyHandler_;
+};
+
+template<class Type>
+void Notify<Type>::setNotifyHandler( NotifyHandler<Type>* handler )
+{
+ if ( handler == 0 ) {
+ std::cout<<"TRACE(notify.h): no handler set. Ignoring data." << std::endl;
+ return;
+ }
+
+ handler_ = handler;
+ hasNotifyHandler_ = true;
+}
+
+template<class Type>
+void Notify<Type>::set( const Type & obj )
+{
+ if ( !hasNotifyHandler_ ) {
+ throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO, "setting data when data handler has not been set" );
+ }
+
+ internalSet( obj );
+}
+
+template<class Type>
+void Notify<Type>::internalSet( const Type & obj )
+{
+ handler_->handleData( obj );
+}
+
+}
+} // end namespace
+
+#endif
Added: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.cpp (rev 0)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.cpp 2008-03-19 00:16:15 UTC (rev 103)
@@ -0,0 +1,59 @@
+/*
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
+ * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp
+ *
+ * This distribution is licensed to you under the terms described in
+ * the LICENSE file included in this distribution.
+ *
+ */
+
+#include <iostream>
+#include <sstream>
+
+#include "safethread.h"
+
+using namespace gbxsickacfr::gbxiceutilacfr;
+using namespace std;
+
+
+SafeThread::SafeThread( gbxsickacfr::gbxutilacfr::Tracer& tracer ) :
+ tracer_(tracer)
+{
+}
+
+void
+SafeThread::run()
+{
+ stringstream ss;
+ try
+ {
+ walk();
+ }
+ catch ( const IceUtil::Exception &e ) {
+ ss << "SafeThread::run(): Caught unexpected exception: " << e;
+ }
+ catch ( const std::exception &e ) {
+ ss << "SafeThread::run(): Caught unexpected exception: " << e.what();
+ }
+ catch ( const std::string &e ) {
+ ss << "SafeThread::run(): Caught unexpected string: " << e;
+ }
+ catch ( const char *e ) {
+ ss << "SafeThread::run(): Caught unexpected char *: " << e;
+ }
+ catch ( ... ) {
+ ss << "SafeThread::run(): Caught unexpected unknown exception.";
+ }
+
+ // only if there were exceptions
+ if ( !ss.str().empty() ) {
+ tracer_.error( ss.str() );
+ }
+ else {
+ tracer_.debug( "dropping out from run()", 4 );
+ }
+
+ // wait for the component to realize that we are quitting and tell us to stop.
+ waitForStop();
+}
Added: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.h (rev 0)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.h 2008-03-19 00:16:15 UTC (rev 103)
@@ -0,0 +1,68 @@
+/*
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
+ * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp
+ *
+ * This distribution is licensed to you under the terms described in
+ * the LICENSE file included in this distribution.
+ *
+ */
+
+#ifndef GBXICEUTILACFR_SAFE_THREAD_H
+#define GBXICEUTILACFR_SAFE_THREAD_H
+
+#include <gbxsickacfr/gbxiceutilacfr/thread.h>
+#include <gbxsickacfr/gbxutilacfr/tracer.h>
+
+namespace gbxsickacfr {
+namespace gbxiceutilacfr {
+
+/*!
+@brief A version of the Thread class which catches all possible exceptions.
+
+If a stray exception is caught, an error message will be printed
+(using cout), then we will wait for someone to call stop().
+
+To use this class, simply implement the pure virtual walk() function.
+@verbatim
+void MyThread::walk()
+{
+ // initialize
+
+ // main loop
+ while ( !isStopping() )
+ {
+ // do something
+ }
+
+ // clean up
+}
+@endverbatim
+
+@see Thread, SubsystemThread.
+ */
+class SafeThread : public Thread
+{
+public:
+ //! Needs an implementation of Tracer to report possible exceptions.
+ SafeThread( gbxsickacfr::gbxutilacfr::Tracer& tracer );
+
+ // from IceUtil::Thread (from which HydroUtil::Thread is derived)
+ //! This implementation calls walk(), catches all possible exceptions, prints out
+ //! errors and waits for someone to call stop().
+ virtual void run();
+
+ //! Implement this function in the derived class and put here all the stuff which your
+ //! thread needs to do.
+ virtual void walk()=0;
+
+private:
+ gbxsickacfr::gbxutilacfr::Tracer& tracer_;
+};
+//! A smart pointer to the SafeThread class.
+typedef IceUtil::Handle<SafeThread> SafeThreadPtr;
+
+}
+} // end namespace
+
+#endif
Added: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/store.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/store.h (rev 0)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/store.h 2008-03-19 00:16:15 UTC (rev 103)
@@ -0,0 +1,246 @@
+/*
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
+ * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp
+ *
+ * This distribution is licensed to you under the terms described in
+ * the LICENSE file included in this distribution.
+ *
+ */
+
+#ifndef GBXICEUTILACFR_STORE_H
+#define GBXICEUTILACFR_STORE_H
+
+#include <gbxsickacfr/gbxutilacfr/exceptions.h>
+
+#include <IceUtil/Monitor.h>
+#include <IceUtil/Mutex.h>
+#include <IceUtil/Time.h>
+
+namespace gbxsickacfr {
+namespace gbxiceutilacfr {
+
+/*!
+ * @brief Thread-safe storage for a single data objects.
+ *
+ * This container is similar to a circular Buffer of size one but with two
+ * differences:
+ * - a copy of the data is always available, yet the user knows when new
+ * data has arrived by calling @ref isNewData
+ * - @ref getNext returns the new data arrives (not when the buffer
+ * is non-empty.
+ *
+ * Write to it with @ref set. Read its contents with @ref get. Trying to read from
+ * an empty Store raises an gbxsickacfr::gbxutilacfr::Exception.
+ *
+ * @note Replaces the deprecated Proxy class.
+ * @see Buffer, Notify
+ */
+template<class Type>
+class Store : public IceUtil::Monitor<IceUtil::Mutex>
+{
+public:
+
+ Store();
+ virtual ~Store();
+
+ //! Returns TRUE if there's something in the Store. The Store starts its life empty
+ //! but after the object is set once, it will be non-empty again until @ref purge is
+ //! called.
+ bool isEmpty() const;
+
+ //! Returns TRUE if the data in the Store has not been accessed with @ref get yet.
+ bool isNewData() const;
+
+ //! Sets the contents of the Store.
+ void set( const Type & obj );
+
+ //! Returns the contents of the Store. This operation makes the data in the Store
+ //! "not new", i.e. @ref isNewData returns FALSE. Calls to @ref get when the Store is empty
+ //! raises an gbxsickacfr::gbxutilacfr::Exception exception.
+ void get( Type & obj ) const;
+
+ /*!
+ * @brief Waits until the next update and returns the new value.
+ * If the Store is empty, @ref getNext blocks until the Store is set and returns the new value.
+ * By default, there is no timeout (negative value). Returns 0 if successful.
+ *
+ * If timeout is set to a positive value (in milliseconds) and the wait times out, the function returns -1
+ * and the object argument itself is not touched. In the rare event of spurious wakeup,
+ * the return value is 1.
+ *
+ */
+ int getNext( Type & obj, int timeoutMs=-1 ) const;
+
+ //! Makes the Store empty.
+ //! @see isEmpty
+ void purge();
+
+protected:
+
+ // local copy of the object
+ Type obj_;
+
+ // Reimplement this function for non-standard types.
+ virtual void internalGet( Type & obj ) const ;
+
+ // Reimplement this function for non-standard types.
+ virtual void internalSet( const Type & obj );
+
+private:
+
+
+ bool isEmpty_;
+
+ // flag to keep track of new data. Make it mutable so that get() functions can be const.
+ mutable bool isNewData_;
+
+ // internal implementation of front( obj, -1 ); returns 0.
+ int getNextNoWait( Type & obj ) const;
+
+};
+
+
+//////////////////////////////////////////////////////////////////////
+
+template<class Type>
+Store<Type>::Store()
+ : isEmpty_(true),
+ isNewData_(false)
+{
+}
+
+template<class Type>
+Store<Type>::~Store()
+{
+}
+
+template<class Type>
+bool Store<Type>::isEmpty() const
+{
+ IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
+ return isEmpty_;
+}
+
+template<class Type>
+bool Store<Type>::isNewData() const
+{
+ IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
+ return isNewData_;
+}
+
+template<class Type>
+void Store<Type>::get( Type & obj ) const
+{
+ IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
+ if ( !isEmpty_ )
+ {
+ internalGet( obj );
+ isNewData_ = false;
+ }
+ else
+ {
+ throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO, "trying to read from an empty Store." );
+ }
+}
+
+template<class Type>
+int Store<Type>::getNext( Type & obj, int timeoutMs ) const
+{
+ // special case: infinite wait time
+ if ( timeoutMs == -1 ) {
+ return getNextNoWait( obj );
+ }
+
+ // finite wait time
+ IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
+
+ // if already have data in the buffer, return it and get out
+ if ( isNewData_ )
+ {
+ internalGet( obj );
+ isNewData_ = false;
+ return 0;
+ }
+
+ // empty buffer: figure out when to wake up
+ // notice that we are still holding the lock, so it's ok to call timedWait()
+ if ( this->timedWait( IceUtil::Time::milliSeconds( timeoutMs ) ) )
+ {
+ // someone woke us up, we are holding the lock again
+ // check new data again (could be a spurious wakeup)
+ if ( isNewData_ )
+ {
+ internalGet( obj );
+ isNewData_ = false;
+ return 0;
+ }
+ else {
+ // spurious wakup, don't wait again, just return
+ return 1;
+ }
+ }
+ else {
+ // wait timedout, nobody woke us up
+ return -1;
+ }
+}
+
+template<class Type>
+int Store<Type>::getNextNoWait( Type & obj ) const
+{
+ IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
+
+ // check the condition before and after waiting to deal with spurious wakeups
+ // (see Ice manual sec. 28.9.2)
+ while ( !isNewData_ )
+ {
+ this->wait();
+ }
+
+ internalGet( obj );
+ isNewData_ = false;
+ return 0;
+}
+
+// NOTE: see notes on efficient notification in Ice sec. 28.9.3
+template<class Type>
+void Store<Type>::set( const Type &obj )
+{
+ IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
+
+ internalSet( obj );
+
+ // mark as having new data (nobody has looked at it yet)
+ isNewData_ = true;
+
+ // mark Store non-empty (only usefull the very first time)
+ isEmpty_ = false;
+
+ // wakeup someone who's waiting for an update
+ this->notify();
+}
+
+template<class Type>
+void Store<Type>::purge()
+{
+ IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
+ isEmpty_ = true;
+}
+
+template<class Type>
+void Store<Type>::internalGet( Type & obj ) const
+{
+ obj = obj_;
+}
+
+template<class Type>
+void Store<Type>::internalSet( const Type & obj )
+{
+ obj_ = obj;
+}
+
+}
+} // end namespace
+
+#endif
Added: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/CMakeLists.txt
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/CMakeLists.txt (rev 0)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/CMakeLists.txt 2008-03-19 00:16:15 UTC (rev 103)
@@ -0,0 +1,21 @@
+# INCLUDE( ${HYDRO_CMAKE_DIR}/UseBasicRules.cmake )
+# INCLUDE( ${CMAKE_CURRENT_SOURCE_DIR}/../UseHydroIceUtil.cmake )
+LINK_LIBRARIES( GbxIceUtilAcfr )
+
+ADD_EXECUTABLE( buffertest buffertest.cpp )
+GBX_ADD_TEST( GbxIceUtilAcfrBufferTest buffertest )
+
+ADD_EXECUTABLE( storetest storetest.cpp )
+GBX_ADD_TEST( GbxIceUtilAcfrStoreTest storetest )
+
+ADD_EXECUTABLE( notifytest notifytest.cpp )
+GBX_ADD_TEST( GbxIceUtilAcfrNotifyTest notifytest )
+
+ADD_EXECUTABLE( threadtest threadtest.cpp )
+GBX_ADD_TEST( GbxIceUtilAcfrThreadTest threadtest )
+
+ADD_EXECUTABLE( safethreadtest safethreadtest.cpp )
+GBX_ADD_TEST( GbxIceUtilAcfrSafeThreadTest safethreadtest )
+
+ADD_EXECUTABLE( subsystemthreadtest subsystemthreadtest.cpp )
+GBX_ADD_TEST( GbxIceUtilAcfrSubsystemThreadTest subsystemthreadtest )
Added: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/buffertest.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/buffertest.cpp (rev 0)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/buffertest.cpp 2008-03-19 00:16:15 UTC (rev 103)
@@ -0,0 +1,218 @@
+/*
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
+ * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp
+ *
+ * This distribution is licensed to you under the terms described in
+ * the LICENSE file included in this distribution.
+ *
+ */
+
+#include <iostream>
+#include <cstdlib>
+#include <gbxsickacfr/gbxiceutilacfr/buffer.h>
+
+using namespace std;
+
+int main(int argc, char * argv[])
+{
+ gbxsickacfr::gbxiceutilacfr::Buffer<double> buffer(-1, gbxsickacfr::gbxiceutilacfr::BufferTypeCircular);
+ double data = 20.0;
+ double copy = -1.0;
+
+ cout<<"testing default constructor and depth() and type() ... ";
+ if ( buffer.depth()!=-1 || buffer.type()!=gbxsickacfr::gbxiceutilacfr::BufferTypeCircular ) {
+ cout<<"failed. depth: exp=-1 got="<<buffer.depth()<<" type: exp="<<(int)gbxsickacfr::gbxiceutilacfr::BufferTypeCircular<<" got="<<(int)buffer.type()<<endl;
+ return EXIT_FAILURE;
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing get() with empty buffer ... ";
+ // call get on an empty stomach
+ try
+ {
+ buffer.get( copy );
+ cout<<"failed. empty buffer, should've caught exception"<<endl;
+ return EXIT_FAILURE;
+ }
+ catch ( const gbxsickacfr::gbxutilacfr::Exception & )
+ {
+ ; // ok
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing getAndPop() with empty buffer ... ";
+ try
+ {
+ buffer.getAndPop( data );
+ cout<<"failed. empty buffer, should've caught exception"<<endl;
+ return EXIT_FAILURE;
+ }
+ catch ( const gbxsickacfr::gbxutilacfr::Exception & )
+ {
+ ; // ok
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing getNext() with empty buffer ... ";
+ if ( buffer.getNext( data, 50 )==0 ) {
+ cout<<"failed. not expecting anybody setting the buffer"<<endl;
+ return EXIT_FAILURE;
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing getAndPopNext() with empty buffer ... ";
+ if ( buffer.getAndPopNext( data, 50 )==0 ) {
+ cout<<"failed. not expecting anybody setting the proxy"<<endl;
+ return EXIT_FAILURE;
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing isEmpty() and size() with empty buffer ... ";
+ if ( !buffer.isEmpty() || buffer.size()!=0 ) {
+ cout<<"failed. expecting an empty buffer."<<endl;
+ return EXIT_FAILURE;
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing push() ... ";
+ for ( int i=0; i<3; ++i ) {
+ buffer.push( data );
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing isEmpty() and size() ... ";
+ if ( buffer.isEmpty() || buffer.size()!=3 ) {
+ cout<<"failed on line "<<__LINE__<<": expecting an empty buffer of size 3."<<endl;
+ cout<<"TRACE(buffertest.cpp): buffer.size(): " << buffer.size() << endl;
+
+ return EXIT_FAILURE;
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing get() ... ";
+ try
+ {
+ buffer.get( copy );
+ }
+ catch ( const gbxsickacfr::gbxutilacfr::Exception & )
+ {
+ cout<<"failed. should be a non-empty buffer."<<endl;
+ return EXIT_FAILURE;
+ }
+ if ( data!=copy )
+ {
+ cout<<"failed. expecting an exact copy of the data."<<endl;
+ cout<<"\tin="<<data<<" out="<<copy<<endl;
+ return EXIT_FAILURE;
+ }
+ if ( buffer.isEmpty() || buffer.size()!=3 ) {
+ cout<<"failed on line "<<__LINE__<<": expecting an empty buffer of size 3."<<endl;
+ return EXIT_FAILURE;
+ }
+ cout<<"ok, size="<<buffer.size()<<endl;
+
+ cout<<"testing getAndPop()... ";
+ try
+ {
+ int size = buffer.size();
+ for ( int i=0; i < size; i++ )
+ buffer.getAndPop( data );
+ }
+ catch ( const gbxsickacfr::gbxutilacfr::Exception & )
+ {
+ cout<<"failed. should be a non-empty buffer."<<endl;
+ return EXIT_FAILURE;
+ }
+ if ( !buffer.isEmpty() || buffer.size()!=0 ) {
+ cout<<"failed. expecting an empty buffer."<<endl;
+ return EXIT_FAILURE;
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing circular buffer behavior ...";
+ buffer.configure( 1, gbxsickacfr::gbxiceutilacfr::BufferTypeCircular );
+ //this fills the buffer
+ buffer.push( 0 );
+ // this should over-write
+ buffer.push( 1 );
+ buffer.get( data );
+ if ( data != 1 ) {
+ cout<<"failed. second push should overwrite: expected=1, got="<<data<<endl;
+ return EXIT_FAILURE;
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing queue buffer behavior ...";
+ buffer.configure( 1, gbxsickacfr::gbxiceutilacfr::BufferTypeQueue );
+ //this fills the buffer
+ buffer.push( 0 );
+ // this should be ignored
+ buffer.push( 1 );
+ buffer.get( data );
+ if ( data != 0 ) {
+ cout<<"failed. second push should not overwrite: expected=0, got="<<data<<endl;
+ return EXIT_FAILURE;
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing configure() with gbxsickacfr::gbxiceutilacfr::BufferTypeCircular ... ";
+ buffer.configure( 300, gbxsickacfr::gbxiceutilacfr::BufferTypeCircular );
+ for ( int i=0; i<400; ++i ) {
+ buffer.push( data );
+ }
+ if ( buffer.isEmpty() || buffer.size()!=300 ) {
+ cout<<"failed. expecting a buffer of size 300."<<endl;
+ return EXIT_FAILURE;
+ }
+ // todo: test where the last data actually went.
+ cout<<"ok"<<endl;
+
+ cout<<"testing purge()... ";
+ buffer.purge();
+ if ( !buffer.isEmpty() || buffer.size()!=0 ) {
+ cout<<"failed. expecting an empty buffer."<<endl;
+ return EXIT_FAILURE;
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing configure() with gbxsickacfr::gbxiceutilacfr::BufferTypeQueue ... ";
+ buffer.configure( 300, gbxsickacfr::gbxiceutilacfr::BufferTypeQueue );
+ for ( int i=0; i<400; ++i ) {
+ buffer.push( data );
+ }
+ if ( buffer.isEmpty() || buffer.size()!=300 ) {
+ cout<<"failed. expecting a buffer of size 300."<<endl;
+ return EXIT_FAILURE;
+ }
+ // todo: test where the last data actually went.
+ cout<<"ok"<<endl;
+
+ cout<<"testing getNext() ... ";
+ if ( buffer.getNext( data, 50 )!=0 ) {
+ cout<<"failed. expected to get data"<<endl;
+ return EXIT_FAILURE;
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing getAndPopNext() ... ";
+ if ( buffer.getAndPopNext( data, 50 )!=0 ) {
+ cout<<"failed. expected to get data"<<endl;
+ return EXIT_FAILURE;
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing pop() ... ";
+ for ( int i=0; i<400; ++i ) {
+ buffer.pop();
+ }
+ if ( !buffer.isEmpty() || buffer.size()!=0 ) {
+ cout<<"failed. expecting an empty buffer."<<endl;
+ return EXIT_FAILURE;
+ }
+ // todo: test where the last data actually went.
+ cout<<"ok"<<endl;
+
+
+ return EXIT_SUCCESS;
+}
Added: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/notifytest.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/notifytest.cpp (rev 0)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/notifytest.cpp 2008-03-19 00:16:15 UTC (rev 103)
@@ -0,0 +1,88 @@
+/*
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
+ * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp
+ *
+ * This distribution is licensed to you under the terms described in
+ * the LICENSE file included in this distribution.
+ *
+ */
+
+#include <iostream>
+#include <cstdlib>
+#include <gbxsickacfr/gbxiceutilacfr/notify.h>
+
+using namespace std;
+
+class TestNotifyHandler : public gbxsickacfr::gbxiceutilacfr::NotifyHandler<double>
+{
+public:
+ virtual void handleData( const double& obj )
+ {
+ copy_=obj;
+ };
+
+ double copy_;
+};
+
+int main(int argc, char * argv[])
+{
+ gbxsickacfr::gbxiceutilacfr::Notify<double> notify;
+ double data = 2.0;
+
+ gbxsickacfr::gbxiceutilacfr::NotifyHandler<double>* emptyHandler = 0;
+ TestNotifyHandler testHandler;
+
+ cout<<"testing set() ... ";
+ // call set on an empty stomach
+ try
+ {
+ notify.set( data );
+ cout<<"failed. empty notify handler, should've caught exception"<<endl;
+ return EXIT_FAILURE;
+ }
+ catch ( const gbxsickacfr::gbxutilacfr::Exception & )
+ {
+ ; // ok
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing hasNotifyHandler() ... ";
+ if ( notify.hasNotifyHandler()!=0 ) {
+ cout<<"failed. not expecting to have a handler"<<endl;
+ return EXIT_FAILURE;
+ }
+ notify.setNotifyHandler( emptyHandler );
+ if ( notify.hasNotifyHandler()!=0 ) {
+ cout<<"failed. still not expecting to have a handler"<<endl;
+ return EXIT_FAILURE;
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing setNotifyHandler() ... ";
+ notify.setNotifyHandler( &testHandler );
+ if ( notify.hasNotifyHandler()==0 ) {
+ cout<<"failed. expecting to have a handler"<<endl;
+ return EXIT_FAILURE;
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing set() ... ";
+ try
+ {
+ notify.set( data );
+ }
+ catch ( const gbxsickacfr::gbxutilacfr::Exception & )
+ {
+ cout<<"failed. shouldn't have caught exception"<<endl;
+ return EXIT_FAILURE;
+ }
+ if ( data != testHandler.copy_ ) {
+ cout<<"failed. expecting an exact copy of the data."<<endl;
+ cout<<"\tin="<<data<<" out="<<testHandler.copy_<<endl;
+ return EXIT_FAILURE;
+ }
+ cout<<"ok"<<endl;
+
+ return EXIT_SUCCESS;
+}
Added: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/safethreadtest.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/safethreadtest.cpp (rev 0)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/safethreadtest.cpp 2008-03-19 00:16:15 UTC (rev 103)
@@ -0,0 +1,91 @@
+/*
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
+ * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp
+ *
+ * This distribution is licensed to you under the terms described in
+ * the LICENSE file included in this distribution.
+ *
+ */
+
+#include <iostream>
+
+#include <IceUtil/Time.h>
+
+#include <gbxsickacfr/gbxiceutilacfr/safethread.h>
+#include <gbxsickacfr/gbxutilacfr/trivialtracer.h>
+
+using namespace std;
+
+class TestThread : public gbxsickacfr::gbxiceutilacfr::SafeThread
+{
+public:
+ // it's safe to pass zero pointers
+ TestThread( gbxsickacfr::gbxutilacfr::Tracer& tracer ) :
+ SafeThread( tracer ) {};
+ virtual void walk()
+ {
+ while ( !isStopping() ) {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(50));
+ }
+ };
+};
+
+class TestThreadWithThrow : public gbxsickacfr::gbxiceutilacfr::SafeThread
+{
+public:
+ // it's safe to pass zero pointers
+ TestThreadWithThrow( gbxsickacfr::gbxutilacfr::Tracer& tracer ) :
+ SafeThread( tracer ) {};
+ virtual void walk()
+ {
+ throw "throwing from walk";
+ };
+};
+
+int main(int argc, char * argv[])
+{
+ gbxsickacfr::gbxutilacfr::TrivialTracer tracer;
+
+ cout<<"testing start() and stop()... ";
+ {
+ gbxsickacfr::gbxiceutilacfr::Thread* t=0;
+ try
+ {
+ t = new TestThread( tracer );
+ t->start();
+ }
+ catch (...)
+ {
+ cout<<"failed"<<endl<<"should be able to create thread"<<endl;
+ exit(EXIT_FAILURE);
+ }
+ IceUtil::ThreadControl tc = t->getThreadControl();
+ t->stop();
+ tc.join();
+ // do not delete t! it's already self-destructed.
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing SafeThread() with exceptions... ";
+ {
+ gbxsickacfr::gbxiceutilacfr::Thread* t=0;
+ try
+ {
+ t = new TestThreadWithThrow( tracer );
+ t->start();
+ }
+ catch (...)
+ {
+ cout<<"failed"<<endl<<"all exception should've been caught."<<endl;
+ // ok
+ }
+ IceUtil::ThreadControl tc = t->getThreadControl();
+ t->stop();
+ tc.join();
+ // do not delete t! it's already self-destructed.
+ }
+ cout<<"ok"<<endl;
+
+ return EXIT_SUCCESS;
+}
Added: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/storetest.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/storetest.cpp (rev 0)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/storetest.cpp 2008-03-19 00:16:15 UTC (rev 103)
@@ -0,0 +1,101 @@
+/*
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
+ * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp
+ *
+ * This distribution is licensed to you under the terms described in
+ * the LICENSE file included in this distribution.
+ *
+ */
+
+#include <iostream>
+#include <cstdlib>
+#include <gbxsickacfr/gbxiceutilacfr/store.h>
+
+using namespace std;
+
+int main(int argc, char * argv[])
+{
+ gbxsickacfr::gbxiceutilacfr::Store<double> store;
+ double data = 20.0;
+ double copy = -1.0;
+
+ cout<<"testing get() ... ";
+ // call get on an empty stomach
+ try
+ {
+ store.get( data );
+ cout<<"failed. empty store, should've caught exception"<<endl;
+ return EXIT_FAILURE;
+ }
+ catch ( const gbxsickacfr::gbxutilacfr::Exception & )
+ {
+ ; // ok
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing getNext() ... ";
+ if ( store.getNext( data, 50 )==0 ) {
+ cout<<"failed. not expecting anybody setting the store"<<endl;
+ return EXIT_FAILURE;
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing isEmpty() and isNewData() ... ";
+ if ( !store.isEmpty() || store.isNewData() ) {
+ cout<<"failed. expecting an empty non-new store."<<endl;
+ return EXIT_FAILURE;
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing set() ... ";
+ for ( int i=0; i<3; ++i ) {
+ store.set( data );
+ }
+ if ( store.isEmpty() || !store.isNewData() ) {
+ cout<<"failed. expecting a non-empty new store."<<endl;
+ return EXIT_FAILURE;
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing get() ... ";
+ try
+ {
+ store.get( copy );
+ }
+ catch ( const gbxsickacfr::gbxutilacfr::Exception & )
+ {
+ cout<<"failed. should be a non-empty store."<<endl;
+ return EXIT_FAILURE;
+ }
+ if ( data!=copy )
+ {
+ cout<<"failed. expecting an exact copy of the data."<<endl;
+ cout<<"\tin="<<data<<" out="<<copy<<endl;
+ return EXIT_FAILURE;
+ }
+ if ( store.isEmpty() || store.isNewData() ) {
+ cout<<"failed. expecting a non-empty non-new store."<<endl;
+ return EXIT_FAILURE;
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing getNext() ... ";
+ store.set( data );
+ if ( store.getNext( data, 50 )!=0 ) {
+ cout<<"failed. expected to get data"<<endl;
+ return EXIT_FAILURE;
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing purge()... ";
+ store.purge();
+ if ( !store.isEmpty() || store.isNewData() ) {
+ cout<<"failed. expecting an empty non-new store."<<endl;
+ return EXIT_FAILURE;
+ }
+ cout<<"ok"<<endl;
+
+
+ return EXIT_SUCCESS;
+}
Added: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/subsystemthreadtest.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/subsystemthreadtest.cpp (rev 0)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/subsystemthreadtest.cpp 2008-03-19 00:16:15 UTC (rev 103)
@@ -0,0 +1,106 @@
+/*
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
+ * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp
+ *
+ * This distribution is licensed to you under the terms described in
+ * the LICENSE file included in this distribution.
+ *
+ */
+
+#include <iostream>
+
+#include <IceUtil/Time.h>
+
+#include <gbxsickacfr/gbxiceutilacfr/subsystemthread.h>
+#include <gbxsickacfr/gbxutilacfr/trivialtracer.h>
+#include <gbxsickacfr/gbxutilacfr/trivialstatus.h>
+
+using namespace std;
+
+class TestThread : public gbxsickacfr::gbxiceutilacfr::SubsystemThread
+{
+public:
+ // it's safe to pass zero pointers
+ TestThread( gbxsickacfr::gbxutilacfr::Tracer& tracer, gbxsickacfr::gbxutilacfr::Status& status ) :
+ SubsystemThread( tracer, status ) {};
+ virtual void walk()
+ {
+ while ( !isStopping() ) {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(50));
+ }
+ };
+};
+
+class TestThreadWithThrow : public gbxsickacfr::gbxiceutilacfr::SubsystemThread
+{
+public:
+ // it's safe to pass zero pointers
+ TestThreadWithThrow( gbxsickacfr::gbxutilacfr::Tracer& tracer, gbxsickacfr::gbxutilacfr::Status& status ) :
+ SubsystemThread( tracer, status ) {};
+ virtual void walk()
+ {
+ throw "throwing from walk";
+ };
+};
+
+class TestThreadWithTools : public gbxsickacfr::gbxiceutilacfr::SubsystemThread
+{
+public:
+ TestThreadWithTools( gbxsickacfr::gbxutilacfr::Tracer& tracer, gbxsickacfr::gbxutilacfr::Status& status ) :
+ SubsystemThread( tracer, status, "MyName" )
+ {
+ };
+ virtual void walk()
+ {
+ throw "throwing from walk";
+ };
+};
+
+int main(int argc, char * argv[])
+{
+ gbxsickacfr::gbxutilacfr::TrivialTracer tracer;
+ gbxsickacfr::gbxutilacfr::TrivialStatus status( tracer );
+
+ cout<<"testing start() and stop()... ";
+ {
+ gbxsickacfr::gbxiceutilacfr::Thread* t=0;
+ try
+ {
+ t = new TestThread( tracer, status );
+ t->start();
+ }
+ catch (...)
+ {
+ cout<<"failed"<<endl<<"should be able to create thread"<<endl;
+ exit(EXIT_FAILURE);
+ }
+ IceUtil::ThreadControl tc = t->getThreadControl();
+ t->stop();
+ tc.join();
+ // do not delete t! it's already self-destructed.
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing SubsystemThread() with exceptions... ";
+ {
+ gbxsickacfr::gbxiceutilacfr::Thread* t=0;
+ try
+ {
+ t = new TestThreadWithThrow( tracer, status );
+ t->start();
+ }
+ catch (...)
+ {
+ cout<<"failed"<<endl<<"all exception should've been caught."<<endl;
+ // ok
+ }
+ IceUtil::ThreadControl tc = t->getThreadControl();
+ t->stop();
+ tc.join();
+ // do not delete t! it's already self-destructed.
+ }
+ cout<<"ok"<<endl;
+
+ return EXIT_SUCCESS;
+}
Added: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/threadtest.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/threadtest.cpp (rev 0)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/threadtest.cpp 2008-03-19 00:16:15 UTC (rev 103)
@@ -0,0 +1,277 @@
+/*
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
+ * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp
+ *
+ * This distribution is licensed to you under the terms described in
+ * the LICENSE file included in this distribution.
+ *
+ */
+
+#include <iostream>
+
+#include <IceUtil/Time.h>
+
+#include <gbxsickacfr/gbxiceutilacfr/thread.h>
+#include <gbxsickacfr/gbxutilacfr/exceptions.h>
+
+using namespace std;
+
+class TestThread : public gbxsickacfr::gbxiceutilacfr::Thread
+{
+public:
+ virtual void run()
+ {
+ while ( !isStopping() ) {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(50));
+ }
+ };
+};
+
+class TestThreadWithThrow : public gbxsickacfr::gbxiceutilacfr::Thread
+{
+public:
+ TestThreadWithThrow( bool shouldIThrow )
+ {
+ if ( shouldIThrow ) {
+ throw "throwing from constructor";
+ }
+ };
+
+ virtual void run()
+ {
+ while ( !isStopping() ) {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(50));
+ }
+ };
+};
+
+class TestThreadWithExit : public gbxsickacfr::gbxiceutilacfr::Thread
+{
+public:
+ TestThreadWithExit() :
+ isExiting_(false) {};
+
+ void exit()
+ {
+ IceUtil::Mutex::Lock lock(exitMutex_);
+ isExiting_ = true;
+ };
+
+ bool isExiting()
+ {
+ IceUtil::Mutex::Lock lock(exitMutex_);
+ return isExiting_;
+ };
+
+ virtual void run()
+ {
+ // this is the standard loop
+ while ( !isStopping() ) {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(50));
+ }
+
+ // this is a special loop for testing only
+ while ( !isExiting_ ) {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(50));
+ }
+ };
+
+private:
+ bool isExiting_;
+ IceUtil::Mutex exitMutex_;
+};
+
+class TestThreadWithWait : public gbxsickacfr::gbxiceutilacfr::Thread
+{
+public:
+ virtual void run()
+ {
+ waitForStop();
+ };
+};
+
+class TestThreadWithNap : public gbxsickacfr::gbxiceutilacfr::Thread
+{
+public:
+ virtual void run()
+ {
+ gbxsickacfr::gbxiceutilacfr::checkedSleep( this, IceUtil::Time::seconds(5), 100 );
+ };
+};
+
+int main(int argc, char * argv[])
+{
+ cout<<"testing start() and stop()... ";
+ {
+ gbxsickacfr::gbxiceutilacfr::Thread* t=0;
+ try
+ {
+ t = new TestThread;
+ t->start();
+ }
+ catch (...)
+ {
+ cout<<"failed"<<endl<<"should be able to create thread"<<endl;
+ exit(EXIT_FAILURE);
+ }
+ IceUtil::ThreadControl tc = t->getThreadControl();
+ t->stop();
+ tc.join();
+ // do not delete t! it's already self-destructed.
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing start() and stop() with smart pointer ... ";
+ {
+ gbxsickacfr::gbxiceutilacfr::ThreadPtr t;
+ try
+ {
+ t = new TestThread;
+ t->start();
+ }
+ catch (...)
+ {
+ cout<<"failed"<<endl<<"should be able to create thread"<<endl;
+ exit(EXIT_FAILURE);
+ }
+ IceUtil::ThreadControl tc = t->getThreadControl();
+ t->stop();
+ tc.join();
+ }
+ cout<<"ok"<<endl;
+
+ // alexm: is this test still needed?
+ cout<<"testing Thread() with exceptions... ";
+ {
+ TestThreadWithThrow* t=0;
+ try
+ {
+ t = new TestThreadWithThrow( true );
+ cout<<"failed"<<endl<<"should not be able to create thread"<<endl;
+ exit(EXIT_FAILURE);
+ }
+ catch (...)
+ {
+ // ok
+ }
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing state machine ... ";
+ {
+ // works only with smart pointers because with dumb ones the threads self-destruct
+ // and we can't examine their final state.
+ gbxsickacfr::gbxiceutilacfr::ThreadPtr t = new TestThreadWithExit;
+
+ if ( t->isStopping()!=false || t->isAlive()!=false || t->isStarted()!=false ) {
+ cout<<"failed"<<endl
+ <<"should be in Starting state but internal states do not match:"<<endl
+ <<"isStopping="<<(int)t->isStopping()<<" isAlive="<<(int)t->isAlive()<<" isStarted()="<<(int)t->isStarted()<<endl;
+ exit(EXIT_FAILURE);
+ }
+
+ t->start();
+ if ( t->isStopping()!=false || t->isAlive()!=true || t->isStarted()!=true ) {
+ cout<<"failed"<<endl
+ <<"should be in Started state but internal states do not match:"<<endl
+ <<"isStopping="<<(int)t->isStopping()<<" isAlive="<<(int)t->isAlive()<<" isStarted()="<<(int)t->isStarted()<<endl;
+ exit(EXIT_FAILURE);
+ }
+
+ t->stop();
+ if ( t->isStopping()!=true || t->isAlive()!=true || t->isStarted()!=true ) {
+ cout<<"failed"<<endl
+ <<"should be in Stopping state but internal states do not match:"<<endl
+ <<"isStopping="<<(int)t->isStopping()<<" isAlive="<<(int)t->isAlive()<<" isStarted()="<<(int)t->isStarted()<<endl;
+ exit(EXIT_FAILURE);
+ }
+
+ IceUtil::ThreadControl tc = t->getThreadControl();
+ // this ugly shit is to call one special function
+ TestThreadWithExit* dumb = (TestThreadWithExit*)&(*t);
+ dumb->exit();
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(150));
+ // alexm: I think it self-destructs here. what can we tell about it?
+ if ( t->isStopping()!=true || t->isAlive()!=false || t->isStarted()!=true ) {
+ cout<<"failed"<<endl
+ <<"should be in Stopped state but internal states do not match:"<<endl
+ <<"isStopping="<<(int)t->isStopping()<<" isAlive="<<(int)t->isAlive()<<" isStarted()="<<(int)t->isStarted()<<endl;
+ exit(EXIT_FAILURE);
+ }
+ tc.join();
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing waitForStop() ... ";
+ {
+ gbxsickacfr::gbxiceutilacfr::ThreadPtr t = new TestThreadWithWait;
+ t->start();
+ if ( t->isAlive()!=true ) {
+ cout<<"failed"<<endl
+ <<"should be in Started state but internal states do not match:"<<endl
+ <<"isStopping="<<(int)t->isStopping()<<" isAlive="<<(int)t->isAlive()<<" isStarted()="<<(int)t->isStarted()<<endl;
+ exit(EXIT_FAILURE);
+ }
+
+ t->stop();
+ IceUtil::ThreadControl tc = t->getThreadControl();
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(150));
+ if ( t->isAlive()!=false ) {
+ cout<<"failed"<<endl
+ <<"should be in Stopped state but internal states do not match:"<<endl
+ <<"isStopping="<<(int)t->isStopping()<<" isAlive="<<(int)t->isAlive()<<" isStarted()="<<(int)t->isStarted()<<endl;
+ exit(EXIT_FAILURE);
+ }
+ tc.join();
+ }
+ cout<<"ok"<<endl;
+
+ // alexm: don't know how to test this, because of self-destruction
+// cout<<"testing stopAndJoin() ... ";
+// {
+// }
+// cout<<"ok"<<endl;
+
+ cout<<"testing stopAndJoin() with smart pointer ... ";
+ {
+ gbxsickacfr::gbxiceutilacfr::ThreadPtr t = new TestThread;
+ t->start();
+ if ( t->isAlive()!=true ) {
+ cout<<"failed"<<endl
+ <<"should be in Started state but internal states do not match:"<<endl
+ <<"isStopping="<<(int)t->isStopping()<<" isAlive="<<(int)t->isAlive()<<" isStarted()="<<(int)t->isStarted()<<endl;
+ exit(EXIT_FAILURE);
+ }
+
+ gbxsickacfr::gbxiceutilacfr::stopAndJoin( t );
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(150));
+ if ( t->isAlive()!=false ) {
+ cout<<"failed"<<endl
+ <<"should be in Stopped state but internal states do not match:"<<endl
+ <<"isStopping="<<(int)t->isStopping()<<" isAlive="<<(int)t->isAlive()<<" isStarted()="<<(int)t->isStarted()<<endl;
+ exit(EXIT_FAILURE);
+ }
+ }
+ cout<<"ok"<<endl;
+
+ cout<<"testing checkedSleep() ... ";
+ {
+ gbxsickacfr::gbxiceutilacfr::ThreadPtr t = new TestThreadWithNap;
+ t->start();
+
+ IceUtil::Time stopTime = IceUtil::Time::now();
+ gbxsickacfr::gbxiceutilacfr::stopAndJoin( t );
+ IceUtil::Time joinTime = IceUtil::Time::now();
+ cout<<"time to stop = "<<(joinTime-stopTime).toDuration()<<endl;
+
+ if ( joinTime-stopTime > IceUtil::Time::seconds(1) ) {
+ cout<<"failed"<<endl
+ <<"should stop faster than in 1 second, time to stop ="<<(joinTime-stopTime).toDuration()<<endl;
+ exit(EXIT_FAILURE);
+ }
+ }
+ cout<<"ok"<<endl;
+
+ return EXIT_SUCCESS;
+}
Modified: gearbox/trunk/src/gbxsickacfr/gbxutilacfr/CMakeLists.txt
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxutilacfr/CMakeLists.txt 2008-03-18 06:43:26 UTC (rev 102)
+++ gearbox/trunk/src/gbxsickacfr/gbxutilacfr/CMakeLists.txt 2008-03-19 00:16:15 UTC (rev 103)
@@ -19,8 +19,8 @@
GBX_ADD_HEADERS( gbxsickacfr/gbxutilacfr ${hdrs} )
-# IF ( GBX_BUILD_TESTS )
-# ADD_SUBDIRECTORY ( test )
-# ENDIF ( GBX_BUILD_TESTS )
+ IF ( GBX_BUILD_TESTS )
+ ADD_SUBDIRECTORY ( test )
+ ENDIF ( GBX_BUILD_TESTS )
ENDIF ( build )
Added: gearbox/trunk/src/gbxsickacfr/gbxutilacfr/test/CMakeLists.txt
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxutilacfr/test/CMakeLists.txt (rev 0)
+++ gearbox/trunk/src/gbxsickacfr/gbxutilacfr/test/CMakeLists.txt 2008-03-19 00:16:15 UTC (rev 103)
@@ -0,0 +1,6 @@
+# INCLUDE( ${GBX_CMAKE_DIR}/UseBasicRules.cmake )
+
+LINK_LIBRARIES( GbxUtilAcfr )
+
+ADD_EXECUTABLE( mathtest mathtest.cpp )
+GBX_ADD_TEST( GbxUtilAcfrMathTest mathtest )
Added: gearbox/trunk/src/gbxsickacfr/gbxutilacfr/test/mathtest.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxutilacfr/test/mathtest.cpp (rev 0)
+++ gearbox/trunk/src/gbxsickacfr/gbxutilacfr/test/mathtest.cpp 2008-03-19 00:16:15 UTC (rev 103)
@@ -0,0 +1,61 @@
+/*
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
+ * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp
+ *
+ * This distribution is licensed to you under the terms described in
+ * the LICENSE file included in this distribution.
+ *
+ */
+
+#include <iostream>
+#include <gbxsickacfr/gbxutilacfr/mathdefs.h>
+#include <iomanip>
+#include <assert.h>
+
+#ifdef NDEBUG
+#undef NDEBUG
+#endif
+
+using namespace std;
+
+#define EPS 1e-8;
+
+template<typename T>
+void
+testNormalise()
+{
+ T angle;
+
+ angle = -M_PI;
+ NORMALISE_ANGLE(angle);
+ assert( angle >= -M_PI && angle < M_PI );
+
+ angle = -M_PI+EPS;
+ NORMALISE_ANGLE(angle);
+ assert( angle >= -M_PI && angle < M_PI );
+
+ angle = -M_PI-EPS;
+ NORMALISE_ANGLE(angle);
+ assert( angle >= -M_PI && angle < M_PI );
+
+ angle = M_PI;
+ NORMALISE_ANGLE(angle);
+ assert( angle >= -M_PI && angle < M_PI );
+
+ angle = M_PI+EPS;
+ NORMALISE_ANGLE(angle);
+ assert( angle >= -M_PI && angle < M_PI );
+
+ angle = M_PI-EPS;
+ NORMALISE_ANGLE(angle);
+ assert( angle >= -M_PI && angle < M_PI );
+}
+
+int main()
+{
+ testNormalise<float>();
+ testNormalise<double>();
+
+ cout << "Test PASSED" << endl;
+}
Modified: gearbox/trunk/src/gbxsickacfr/sickdefines.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/sickdefines.cpp 2008-03-18 06:43:26 UTC (rev 102)
+++ gearbox/trunk/src/gbxsickacfr/sickdefines.cpp 2008-03-19 00:16:15 UTC (rev 103)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
* Copyright (c) 2004-2008 Alex Brooks
*
* This distribution is licensed to you under the terms described in
Modified: gearbox/trunk/src/gbxsickacfr/sickdefines.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/sickdefines.h 2008-03-18 06:43:26 UTC (rev 102)
+++ gearbox/trunk/src/gbxsickacfr/sickdefines.h 2008-03-19 00:16:15 UTC (rev 103)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
* Copyright (c) 2004-2008 Alex Brooks
*
* This distribution is licensed to you under the terms described in
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-03-18 06:43:26
|
Revision: 102
http://gearbox.svn.sourceforge.net/gearbox/?rev=102&view=rev
Author: russo2503v
Date: 2008-03-17 23:43:26 -0700 (Mon, 17 Mar 2008)
Log Message:
-----------
fixed uint warning.
Modified Paths:
--------------
gearbox/trunk/src/gbxsickacfr/driver.cpp
Modified: gearbox/trunk/src/gbxsickacfr/driver.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/driver.cpp 2008-03-18 06:41:19 UTC (rev 101)
+++ gearbox/trunk/src/gbxsickacfr/driver.cpp 2008-03-18 06:43:26 UTC (rev 102)
@@ -412,7 +412,7 @@
// Perhaps there's some crap left in the buffer after the thing
// was previously in continuous mode?
const int MAX_TRIES=3;
- for ( uint i=0; i < MAX_TRIES; i++ )
+ for ( int i=0; i < MAX_TRIES; i++ )
{
try {
constructRequestMeasuredOnRequestMode( commandAndData_ );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-03-18 06:41:20
|
Revision: 101
http://gearbox.svn.sourceforge.net/gearbox/?rev=101&view=rev
Author: russo2503v
Date: 2008-03-17 23:41:19 -0700 (Mon, 17 Mar 2008)
Log Message:
-----------
Modified Paths:
--------------
gearbox/trunk/doc/index.dox
Modified: gearbox/trunk/doc/index.dox
===================================================================
--- gearbox/trunk/doc/index.dox 2008-03-18 06:39:14 UTC (rev 100)
+++ gearbox/trunk/doc/index.dox 2008-03-18 06:41:19 UTC (rev 101)
@@ -45,6 +45,7 @@
@section gbx_doc_index_news News
+- 18-Mar-08 Accepted ACFR's implementation of SICK laser driver and the serial library used by it.
- 08-Feb-08 Accepted the first library: a driver for the URG laser.
- 01-Feb-08 Project created. @ref gbx_doc_announce "A half-page announcement".
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-03-18 06:39:12
|
Revision: 100
http://gearbox.svn.sourceforge.net/gearbox/?rev=100&view=rev
Author: russo2503v
Date: 2008-03-17 23:39:14 -0700 (Mon, 17 Mar 2008)
Log Message:
-----------
accepted sickacfr and serialacfr
Modified Paths:
--------------
gearbox/trunk/src/CMakeLists.txt
Added Paths:
-----------
gearbox/trunk/src/gbxserialacfr/
gearbox/trunk/src/gbxsickacfr/
Modified: gearbox/trunk/src/CMakeLists.txt
===================================================================
--- gearbox/trunk/src/CMakeLists.txt 2008-03-18 06:36:49 UTC (rev 99)
+++ gearbox/trunk/src/CMakeLists.txt 2008-03-18 06:39:14 UTC (rev 100)
@@ -5,6 +5,8 @@
# When adding new directories, please maintain order of inter-dependencies.
# Otherwise, maintain alphabetical order.
-ADD_SUBDIRECTORY ( basicexample )
-ADD_SUBDIRECTORY ( gbxadvancedexample )
-ADD_SUBDIRECTORY ( urg_nz )
+ADD_SUBDIRECTORY( basicexample )
+ADD_SUBDIRECTORY( gbxadvancedexample )
+ADD_SUBDIRECTORY( gbxserialacfr )
+ADD_SUBDIRECTORY( gbxsickacfr )
+ADD_SUBDIRECTORY( urg_nz )
Copied: gearbox/trunk/src/gbxserialacfr (from rev 98, gearbox/trunk/submitted/gbxserialacfr)
Copied: gearbox/trunk/src/gbxsickacfr (from rev 98, gearbox/trunk/submitted/gbxsickacfr)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-03-18 06:36:43
|
Revision: 99
http://gearbox.svn.sourceforge.net/gearbox/?rev=99&view=rev
Author: russo2503v
Date: 2008-03-17 23:36:49 -0700 (Mon, 17 Mar 2008)
Log Message:
-----------
accepted sickacfr and serialacfr
Modified Paths:
--------------
gearbox/trunk/submitted/CMakeLists.txt
Removed Paths:
-------------
gearbox/trunk/submitted/gbxserialacfr/
gearbox/trunk/submitted/gbxsickacfr/
Modified: gearbox/trunk/submitted/CMakeLists.txt
===================================================================
--- gearbox/trunk/submitted/CMakeLists.txt 2008-03-06 07:13:26 UTC (rev 98)
+++ gearbox/trunk/submitted/CMakeLists.txt 2008-03-18 06:36:49 UTC (rev 99)
@@ -10,7 +10,4 @@
# When adding new directories, please maintain order of inter-dependencies.
# Otherwise, maintain alphabetical order.
- ADD_SUBDIRECTORY( gbxserialacfr )
- ADD_SUBDIRECTORY( gbxsickacfr )
-
ENDIF ( GBX_BUILD_SUBMITTED )
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-03-06 07:13:23
|
Revision: 98
http://gearbox.svn.sourceforge.net/gearbox/?rev=98&view=rev
Author: borax00
Date: 2008-03-05 23:13:26 -0800 (Wed, 05 Mar 2008)
Log Message:
-----------
tried to make connection while continuous mode is on more reliable.
Modified Paths:
--------------
gearbox/trunk/submitted/gbxsickacfr/driver.cpp
Modified: gearbox/trunk/submitted/gbxsickacfr/driver.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/driver.cpp 2008-03-06 07:03:36 UTC (rev 97)
+++ gearbox/trunk/submitted/gbxsickacfr/driver.cpp 2008-03-06 07:13:26 UTC (rev 98)
@@ -408,8 +408,26 @@
// Turn continuous mode off
//
tracer_.debug("Driver: Turning continuous mode off");
- constructRequestMeasuredOnRequestMode( commandAndData_ );
- sendAndExpectResponse( commandAndData_ );
+ // For some reason this isn't always reliable, not too sure why.
+ // Perhaps there's some crap left in the buffer after the thing
+ // was previously in continuous mode?
+ const int MAX_TRIES=3;
+ for ( uint i=0; i < MAX_TRIES; i++ )
+ {
+ try {
+ constructRequestMeasuredOnRequestMode( commandAndData_ );
+ sendAndExpectResponse( commandAndData_ );
+ break;
+ }
+ catch ( NoResponseException &e )
+ {
+ if ( i == MAX_TRIES-1 )
+ {
+ // Give up
+ throw;
+ }
+ }
+ }
//
// Set Desired BaudRate
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-03-06 07:03:37
|
Revision: 97
http://gearbox.svn.sourceforge.net/gearbox/?rev=97&view=rev
Author: borax00
Date: 2008-03-05 23:03:36 -0800 (Wed, 05 Mar 2008)
Log Message:
-----------
Modified Paths:
--------------
gearbox/trunk/submitted/gbxsickacfr/driver.cpp
gearbox/trunk/submitted/gbxsickacfr/driver.h
gearbox/trunk/submitted/gbxsickacfr/test/test.cpp
Modified: gearbox/trunk/submitted/gbxsickacfr/driver.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/driver.cpp 2008-03-02 03:14:51 UTC (rev 96)
+++ gearbox/trunk/submitted/gbxsickacfr/driver.cpp 2008-03-06 07:03:36 UTC (rev 97)
@@ -70,9 +70,16 @@
}
bool
-Config::validate() const
+Config::isValid() const
{
- // Don't bother verifying baudRate or device, the user will find out soon enough when the Driver bitches.
+ // Don't bother verifying device, the user will find out soon enough when the Driver bitches.
+ if ( !( baudRate == 9600 ||
+ baudRate == 19200 ||
+ baudRate == 38400 ||
+ baudRate == 500000 ) )
+ {
+ return false;
+ }
if ( minRange < 0.0 ) return false;
if ( maxRange <= 0.0 ) return false;
if ( fieldOfView <= 0.0 || fieldOfView > DEG2RAD(360.0) ) return false;
@@ -111,6 +118,13 @@
tracer_(tracer),
status_(status)
{
+ if ( !config.isValid() )
+ {
+ stringstream ss;
+ ss << __func__ << "(): Invalid config: " << config.toString();
+ throw gbxutilacfr::Exception( ERROR_INFO, ss.str() );
+ }
+
stringstream ssDebug;
ssDebug << "Connecting to laser on serial port " << config_.device;
tracer_.debug( ssDebug.str() );
Modified: gearbox/trunk/submitted/gbxsickacfr/driver.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/driver.h 2008-03-02 03:14:51 UTC (rev 96)
+++ gearbox/trunk/submitted/gbxsickacfr/driver.h 2008-03-06 07:03:36 UTC (rev 97)
@@ -23,7 +23,7 @@
{
public:
Config();
- bool validate() const;
+ bool isValid() const;
std::string toString() const;
bool operator==( const Config & other );
bool operator!=( const Config & other );
Modified: gearbox/trunk/submitted/gbxsickacfr/test/test.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/test/test.cpp 2008-03-02 03:14:51 UTC (rev 96)
+++ gearbox/trunk/submitted/gbxsickacfr/test/test.cpp 2008-03-06 07:03:36 UTC (rev 97)
@@ -46,7 +46,7 @@
default:
cout << "Usage: " << argv[0] << " [-p port] [-b baud]" << endl << endl
<< "-p port\tPort the laser scanner is connected to. E.g. /dev/ttyS0" << endl
- << "-b baud\tBaud rate to connect at (19200, 57600 or 115200)." << endl;
+ << "-b baud\tBaud rate to connect at (9600, 19200, 38400, oro 500000)." << endl;
return 1;
}
}
@@ -60,8 +60,9 @@
config.numberOfSamples = 181;
config.baudRate = baud;
config.device = port;
- if ( !config.validate() ) {
+ if ( !config.isValid() ) {
cout << "Test: Invalid laser configuration: " << config.toString() << endl;
+ exit(1);
}
cout << "Using configuration: " << config.toString() << endl;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-03-02 03:14:46
|
Revision: 96
http://gearbox.svn.sourceforge.net/gearbox/?rev=96&view=rev
Author: borax00
Date: 2008-03-01 19:14:51 -0800 (Sat, 01 Mar 2008)
Log Message:
-----------
docco only.
Modified Paths:
--------------
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/tracer.h
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/tracer.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/tracer.h 2008-02-28 02:52:26 UTC (rev 95)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/tracer.h 2008-03-02 03:14:51 UTC (rev 96)
@@ -40,9 +40,9 @@
//
// @verbatim
// Tracer* tracer = context().tracer();
-// if ( tracer->verbocity( gbxutilacfr::Tracer::ErrorTrace, gbxutilacfr::Tracer::ToAny ) ) {
+// if ( tracer.verbosity( gbxutilacfr::Tracer::ErrorTrace, gbxutilacfr::Tracer::ToAny ) > 0 ) {
// std::string s = expensiveOperation();
-// tracer->error( s );
+// tracer.error( s );
// }
// @endverbatim
//
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gb...@us...> - 2008-02-28 02:52:26
|
Revision: 95
http://gearbox.svn.sourceforge.net/gearbox/?rev=95&view=rev
Author: gbiggs
Date: 2008-02-27 18:52:26 -0800 (Wed, 27 Feb 2008)
Log Message:
-----------
Added Player to the list of users.
Modified Paths:
--------------
gearbox/trunk/doc/users.dox
Modified: gearbox/trunk/doc/users.dox
===================================================================
--- gearbox/trunk/doc/users.dox 2008-02-27 01:16:53 UTC (rev 94)
+++ gearbox/trunk/doc/users.dox 2008-02-28 02:52:26 UTC (rev 95)
@@ -17,6 +17,7 @@
@par Frameworks
- <a href="http://orca-robotics.sf.net">Orca</a>
+- <a href="http://playerstage.sf.net">Player</a>
@par Projects
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-02-27 01:16:49
|
Revision: 94
http://gearbox.svn.sourceforge.net/gearbox/?rev=94&view=rev
Author: borax00
Date: 2008-02-26 17:16:53 -0800 (Tue, 26 Feb 2008)
Log Message:
-----------
added pkg-config stuff.
Modified Paths:
--------------
gearbox/trunk/submitted/gbxserialacfr/CMakeLists.txt
gearbox/trunk/submitted/gbxsickacfr/CMakeLists.txt
Modified: gearbox/trunk/submitted/gbxserialacfr/CMakeLists.txt
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/CMakeLists.txt 2008-02-27 00:18:33 UTC (rev 93)
+++ gearbox/trunk/submitted/gbxserialacfr/CMakeLists.txt 2008-02-27 01:16:53 UTC (rev 94)
@@ -23,6 +23,7 @@
GBX_ADD_LIBRARY( ${lib_name} SHARED ${srcs} )
TARGET_LINK_LIBRARIES( ${lib_name} ${dep_libs} )
+ GBX_ADD_PKGCONFIG( ${lib_name} "C++ class wrapping a serial port." "" dep_libs "" "" )
GBX_ADD_HEADERS( gbxserialacfr ${hdrs} )
Modified: gearbox/trunk/submitted/gbxsickacfr/CMakeLists.txt
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/CMakeLists.txt 2008-02-27 00:18:33 UTC (rev 93)
+++ gearbox/trunk/submitted/gbxsickacfr/CMakeLists.txt 2008-02-27 01:16:53 UTC (rev 94)
@@ -29,6 +29,7 @@
GBX_ADD_LIBRARY( ${lib_name} SHARED ${srcs} )
TARGET_LINK_LIBRARIES( ${lib_name} ${dep_libs} )
+ GBX_ADD_PKGCONFIG( ${lib_name} "Drives SICK hardware, directly connected to the computer." proj_libs int_libs "" "" )
GBX_ADD_HEADERS( gbxsickacfr ${hdrs} )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gb...@us...> - 2008-02-27 00:18:29
|
Revision: 93
http://gearbox.svn.sourceforge.net/gearbox/?rev=93&view=rev
Author: gbiggs
Date: 2008-02-26 16:18:33 -0800 (Tue, 26 Feb 2008)
Log Message:
-----------
Fixed some typos.
Modified Paths:
--------------
gearbox/trunk/src/urg_nz/urg_nz.h
Modified: gearbox/trunk/src/urg_nz/urg_nz.h
===================================================================
--- gearbox/trunk/src/urg_nz/urg_nz.h 2008-02-26 23:33:55 UTC (rev 92)
+++ gearbox/trunk/src/urg_nz/urg_nz.h 2008-02-27 00:18:33 UTC (rev 93)
@@ -166,7 +166,7 @@
The scan is a series of discrete values. They can be indexed, starting at 0 and going up to
@ref MAX_READINGS. A subset of these values only can be returned using min_i and max_i.
- @param readings Pointer to a @ref urg_laser_readings_t structure to store the data in.
+ @param readings Pointer to a @ref urg_nz_laser_readings_t structure to store the data in.
@param min_i The minimum scan index to retrieve. Must be at least 0. Default is 0.
@param max_i The maximum scan index to retrieve. Must be no greater than @ref MAX_READINGS. Default is @ref MAX_READINGS.
@return The number of range readings read. */
@@ -179,7 +179,7 @@
/** @brief Get the laser scanner configuration (resolution, scan angles, etc.)
- @param cfg Pointer to a @ref urg_laser_config_t structure to store the configuration in. */
+ @param cfg Pointer to a @ref urg_nz_laser_config_t structure to store the configuration in. */
void GetSensorConfig (urg_nz_laser_config_t *cfg);
/** @brief Get the protocol version used by the connected laser scanner.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-02-26 23:34:23
|
Revision: 92
http://gearbox.svn.sourceforge.net/gearbox/?rev=92&view=rev
Author: borax00
Date: 2008-02-26 15:33:55 -0800 (Tue, 26 Feb 2008)
Log Message:
-----------
Modified Paths:
--------------
gearbox/trunk/submitted/gbxserialacfr/serial.cpp
gearbox/trunk/submitted/gbxserialacfr/serial.h
gearbox/trunk/submitted/gbxsickacfr/driver.cpp
gearbox/trunk/submitted/gbxsickacfr/driver.h
Modified: gearbox/trunk/submitted/gbxserialacfr/serial.cpp
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/serial.cpp 2008-02-26 08:58:08 UTC (rev 91)
+++ gearbox/trunk/submitted/gbxserialacfr/serial.cpp 2008-02-26 23:33:55 UTC (rev 92)
@@ -623,7 +623,7 @@
int
-Serial::readLine(void *buf, int count, char termchar)
+Serial::readUntil(void *buf, int count, char termchar)
{
if ( debugLevel_ > 0 ){
cout<<"TRACE(serial.cpp): "<<__func__<<"(): ";
Modified: gearbox/trunk/submitted/gbxserialacfr/serial.h
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/serial.h 2008-02-26 08:58:08 UTC (rev 91)
+++ gearbox/trunk/submitted/gbxserialacfr/serial.h 2008-02-26 23:33:55 UTC (rev 92)
@@ -96,13 +96,13 @@
//!
int readFull(void *buf, int count);
- //! Reads a line of data up to @ref count bytes-1 (including @ref termchar), terminated by @ref termchar.
+ //! Reads up to @ref count bytes-1 (including @ref termchar), terminated by @ref termchar.
//! Returns the number of bytes read.
- //! After reading the line then the string will be NULL terminated.
+ //! After reading the data, the string will be NULL terminated.
//!
//! Example: if you expect to read the string "1234\n", you need something like:
//! char buf[6];
- //! serial.readLine( buf, 6 );
+ //! serial.readUntil( buf, 6, '\n' );
//!
//! where the two extra characters are for the "\n" and the terminating "\0".
//!
@@ -113,8 +113,12 @@
//! NOTE: The timeout applies for each individual read() call. We might have to make lots of them,
//! so the total time for which this function blocks might be longer than the specified timeout.
//!
- int readLine(void *buf, int count, char termchar='\n');
+ int readUntil(void *buf, int count, char termchar);
+ //! Short-hand for "readUntil(buf,count,'\n');"
+ int readLine(void *buf, int count)
+ { return readUntil(buf,count,'\n'); }
+
//! Returns the number of bytes available for reading (non-blocking).
int bytesAvailable();
Modified: gearbox/trunk/submitted/gbxsickacfr/driver.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/driver.cpp 2008-02-26 08:58:08 UTC (rev 91)
+++ gearbox/trunk/submitted/gbxsickacfr/driver.cpp 2008-02-26 23:33:55 UTC (rev 92)
@@ -546,9 +546,12 @@
}
void
-Driver::read( Data &data, int timeoutMs )
+Driver::read( Data &data )
{
TimedLmsResponse response;
+
+ // This timeout is greater than the scan inter-arrival time for all baudrates.
+ const int timeoutMs = 1000;
bool received = waitForResponseType( ACK_REQUEST_MEASURED_VALUES, response, timeoutMs );
if ( !received )
{
Modified: gearbox/trunk/submitted/gbxsickacfr/driver.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/driver.h 2008-02-26 08:58:08 UTC (rev 91)
+++ gearbox/trunk/submitted/gbxsickacfr/driver.h 2008-02-26 23:33:55 UTC (rev 92)
@@ -67,14 +67,22 @@
public:
//! Constructor
- Driver( const Config &config, gbxutilacfr::Tracer& tracer, gbxutilacfr::Status& status );
+ //!
+ //! gbxutilacfr::Tracer and gbxutilacfr::Status allow
+ //! (human-readable and machine-readable respectively) external
+ //! monitorining of the driver's internal state.
+ Driver( const Config &config,
+ gbxutilacfr::Tracer &tracer,
+ gbxutilacfr::Status &status );
- //! Blocks till new data is available, but not for longer than timeoutMs.
+ //! Blocks till new data is available, but times out (and throws a gbxutilacfr::Exception)
+ //! if it has waited an abnormally long time without receiving a scan.
+ //!
//! The ranges and intensities in 'data' are expected to have been pre-sized correctly.
- //! Throws exceptions on un-recoverable faults.
//!
- //! The default timeout is greater than the scan inter-arrival time for all baudrates.
- void read( Data &data, int timeoutMs=1000 );
+ //! Throws gbxutilacfr::Exception's on un-recoverable faults.
+ //!
+ void read( Data &data );
private:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gb...@us...> - 2008-02-26 08:58:09
|
Revision: 91
http://gearbox.svn.sourceforge.net/gearbox/?rev=91&view=rev
Author: gbiggs
Date: 2008-02-26 00:58:08 -0800 (Tue, 26 Feb 2008)
Log Message:
-----------
Added a macro to create pkg-config files. Passing in the lists of dependency libs was a pain, so if anyone knows of a tidier way...
Modified Paths:
--------------
gearbox/trunk/cmake/internal/TargetUtils.cmake
gearbox/trunk/src/urg_nz/CMakeLists.txt
Added Paths:
-----------
gearbox/trunk/cmake/pkgconfig.in
Modified: gearbox/trunk/cmake/internal/TargetUtils.cmake
===================================================================
--- gearbox/trunk/cmake/internal/TargetUtils.cmake 2008-02-26 03:45:12 UTC (rev 90)
+++ gearbox/trunk/cmake/internal/TargetUtils.cmake 2008-02-26 08:58:08 UTC (rev 91)
@@ -57,7 +57,34 @@
INSTALL( FILES ${ARGN} DESTINATION share/gearbox/${install_subdir} )
ENDMACRO( GBX_ADD_EXAMPLE install_subdir makefile )
+#
+# GBX_ADD_PKGCONFIG( name cflags libflags [DEPENDENCY0 DEPENDENCY1 ...] )
+#
+# Creates a pkg-config file for library "name".
+# desc is a description of the library.
+# ext_deps is a list containing all the external libraries this one requires (pass by reference).
+# int_deps is a list containing all the internal libraries this library depends on (pass by reference).
+# cflags is appended to the "Cflags" value.
+# libflags is appended to the "Libs" value.
+# that should be linked with at the same time as linking to this library.
+#
+MACRO( GBX_ADD_PKGCONFIG name desc ext_deps int_deps cflags libflags )
+ SET( PKG_NAME ${name} )
+ SET( PKG_DESC ${desc} )
+ SET( PKG_CFLAGS ${cflags} )
+ SET( PKG_LIBFLAGS ${libflags} )
+ SET( PKG_EXTERNAL_DEPS ${${ext_deps}} )
+ SET( PKG_INTERNAL_DEPS "" )
+ IF( ${int_deps} )
+ FOREACH( A ${${int_deps}} )
+ SET( PKG_INTERNAL_DEPS "${PKG_INTERNAL_DEPS} -l${A}" )
+ ENDFOREACH( A ${${int_deps}} )
+ 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/gearbox/ )
+ENDMACRO( GBX_ADD_PKGCONFIG name desc cflags deps libflags libs )
+
#
# This is a mechanism to register special items which are not
# components or libraries. This function only records the name of
Added: gearbox/trunk/cmake/pkgconfig.in
===================================================================
--- gearbox/trunk/cmake/pkgconfig.in (rev 0)
+++ gearbox/trunk/cmake/pkgconfig.in 2008-02-26 08:58:08 UTC (rev 91)
@@ -0,0 +1,8 @@
+# This file was generated by CMake for @PROJECT_NAME@ library @PKG_NAME@
+
+Name: @PKG_NAME@
+Description: @PKG_DESC@
+Version: @GBX_PROJECT_VERSION@
+Requires: @PKG_EXTERNAL_DEPS@
+Libs: -L@CMAKE_INSTALL_PREFIX@/lib/gearbox @PKG_LIBFLAGS@ -l@PKG_NAME@ @PKG_INTERNAL_DEPS@
+Cflags: -I@CMAKE_INSTALL_PREFIX@/include/gearbox @PKG_CFLAGS@
\ No newline at end of file
Modified: gearbox/trunk/src/urg_nz/CMakeLists.txt
===================================================================
--- gearbox/trunk/src/urg_nz/CMakeLists.txt 2008-02-26 03:45:12 UTC (rev 90)
+++ gearbox/trunk/src/urg_nz/CMakeLists.txt 2008-02-26 08:58:08 UTC (rev 91)
@@ -1,4 +1,5 @@
SET ( lib_name urg_nz )
+set ( lib_desc "Hokuyo URG laser scanner driver" )
GBX_ADD_LICENSE( GPL )
SET ( build TRUE )
@@ -13,6 +14,7 @@
SET( srcs urg_nz.cpp )
GBX_ADD_LIBRARY( ${lib_name} SHARED ${srcs} )
+ GBX_ADD_PKGCONFIG( ${lib_name} ${lib_desc} "" "" "" "" )
GBX_ADD_HEADERS( ${lib_name} ${hdrs} )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gb...@us...> - 2008-02-26 03:45:08
|
Revision: 90
http://gearbox.svn.sourceforge.net/gearbox/?rev=90&view=rev
Author: gbiggs
Date: 2008-02-25 19:45:12 -0800 (Mon, 25 Feb 2008)
Log Message:
-----------
Fixed the variable replacement syntax to be consistent.
Modified Paths:
--------------
gearbox/trunk/cmake/internal/TargetUtils.cmake
Modified: gearbox/trunk/cmake/internal/TargetUtils.cmake
===================================================================
--- gearbox/trunk/cmake/internal/TargetUtils.cmake 2008-02-26 03:43:37 UTC (rev 89)
+++ gearbox/trunk/cmake/internal/TargetUtils.cmake 2008-02-26 03:45:12 UTC (rev 90)
@@ -6,7 +6,7 @@
MACRO( GBX_ADD_EXECUTABLE name )
ADD_EXECUTABLE( ${name} ${ARGN} )
SET_TARGET_PROPERTIES( ${name} PROPERTIES
- INSTALL_RPATH "${INSTALL_RPATH};@CMAKE_INSTALL_PREFIX@/lib/gearbox"
+ INSTALL_RPATH "${INSTALL_RPATH};${CMAKE_INSTALL_PREFIX}/lib/gearbox"
BUILD_WITH_INSTALL_RPATH TRUE )
INSTALL( TARGETS ${name} RUNTIME DESTINATION bin )
SET( templist ${COMPONENT_LIST} )
@@ -24,7 +24,7 @@
MACRO( GBX_ADD_LIBRARY name )
ADD_LIBRARY( ${name} ${ARGN} )
SET_TARGET_PROPERTIES( ${name} PROPERTIES
- INSTALL_RPATH "${INSTALL_RPATH};@CMAKE_INSTALL_PREFIX@/lib/gearbox"
+ INSTALL_RPATH "${INSTALL_RPATH};${CMAKE_INSTALL_PREFIX}/lib/gearbox"
BUILD_WITH_INSTALL_RPATH TRUE )
INSTALL( TARGETS ${name} LIBRARY DESTINATION lib/gearbox )
SET( templist ${LIBRARY_LIST} )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gb...@us...> - 2008-02-26 03:43:33
|
Revision: 89
http://gearbox.svn.sourceforge.net/gearbox/?rev=89&view=rev
Author: gbiggs
Date: 2008-02-25 19:43:37 -0800 (Mon, 25 Feb 2008)
Log Message:
-----------
Added RPATH to the properties of libraries and executables - without this, they can't find other gearbox libs they depend on when executed.
Modified Paths:
--------------
gearbox/trunk/cmake/internal/TargetUtils.cmake
Modified: gearbox/trunk/cmake/internal/TargetUtils.cmake
===================================================================
--- gearbox/trunk/cmake/internal/TargetUtils.cmake 2008-02-26 01:49:30 UTC (rev 88)
+++ gearbox/trunk/cmake/internal/TargetUtils.cmake 2008-02-26 03:43:37 UTC (rev 89)
@@ -4,13 +4,16 @@
# Usage: GBX_ADD_EXECUTABLE( name src1 src2 src3 )
#
MACRO( GBX_ADD_EXECUTABLE name )
- ADD_EXECUTABLE( ${name} ${ARGN} )
- INSTALL( TARGETS ${name} RUNTIME DESTINATION bin )
- SET( templist ${COMPONENT_LIST} )
- LIST ( APPEND templist ${name} )
+ ADD_EXECUTABLE( ${name} ${ARGN} )
+ SET_TARGET_PROPERTIES( ${name} PROPERTIES
+ INSTALL_RPATH "${INSTALL_RPATH};@CMAKE_INSTALL_PREFIX@/lib/gearbox"
+ BUILD_WITH_INSTALL_RPATH TRUE )
+ INSTALL( TARGETS ${name} RUNTIME DESTINATION bin )
+ SET( templist ${COMPONENT_LIST} )
+ LIST ( APPEND templist ${name} )
# MESSAGE ( STATUS "DEBUG: ${templist}" )
- SET( COMPONENT_LIST ${templist} CACHE INTERNAL "Global list of components to build" FORCE )
- MESSAGE( STATUS "Planning to Build Executable: ${name}" )
+ SET( COMPONENT_LIST ${templist} CACHE INTERNAL "Global list of components to build" FORCE )
+ MESSAGE( STATUS "Planning to Build Executable: ${name}" )
ENDMACRO( GBX_ADD_EXECUTABLE name )
#
@@ -20,6 +23,9 @@
#
MACRO( GBX_ADD_LIBRARY name )
ADD_LIBRARY( ${name} ${ARGN} )
+ SET_TARGET_PROPERTIES( ${name} PROPERTIES
+ INSTALL_RPATH "${INSTALL_RPATH};@CMAKE_INSTALL_PREFIX@/lib/gearbox"
+ BUILD_WITH_INSTALL_RPATH TRUE )
INSTALL( TARGETS ${name} LIBRARY DESTINATION lib/gearbox )
SET( templist ${LIBRARY_LIST} )
LIST ( APPEND templist ${name} )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-02-26 01:49:28
|
Revision: 88
http://gearbox.svn.sourceforge.net/gearbox/?rev=88&view=rev
Author: borax00
Date: 2008-02-25 17:49:30 -0800 (Mon, 25 Feb 2008)
Log Message:
-----------
formatting.
Modified Paths:
--------------
gearbox/trunk/submitted/gbxsickacfr/test/test.cpp
Modified: gearbox/trunk/submitted/gbxsickacfr/test/test.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/test/test.cpp 2008-02-26 01:40:17 UTC (rev 87)
+++ gearbox/trunk/submitted/gbxsickacfr/test/test.cpp 2008-02-26 01:49:30 UTC (rev 88)
@@ -33,7 +33,7 @@
string port = "/dev/ttyS0";
// Get some options from the command line
- while ((opt = getopt (argc, argv, "p:b:")) != -1)
+ while ((opt = getopt(argc, argv, "p:b:")) != -1)
{
switch ( opt )
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gb...@us...> - 2008-02-26 01:40:16
|
Revision: 87
http://gearbox.svn.sourceforge.net/gearbox/?rev=87&view=rev
Author: gbiggs
Date: 2008-02-25 17:40:17 -0800 (Mon, 25 Feb 2008)
Log Message:
-----------
Renamed example.cmake, added license.
Modified Paths:
--------------
gearbox/trunk/src/urg_nz/CMakeLists.txt
gearbox/trunk/src/urg_nz/urg_nz.dox
Added Paths:
-----------
gearbox/trunk/src/urg_nz/example.cmake.in
Removed Paths:
-------------
gearbox/trunk/src/urg_nz/example.cmake
Modified: gearbox/trunk/src/urg_nz/CMakeLists.txt
===================================================================
--- gearbox/trunk/src/urg_nz/CMakeLists.txt 2008-02-25 22:24:06 UTC (rev 86)
+++ gearbox/trunk/src/urg_nz/CMakeLists.txt 2008-02-26 01:40:17 UTC (rev 87)
@@ -16,6 +16,6 @@
GBX_ADD_HEADERS( ${lib_name} ${hdrs} )
- GBX_ADD_EXAMPLE( ${lib_name} example.cmake example.cmake example.cpp example.readme )
+ GBX_ADD_EXAMPLE( ${lib_name} example.cmake.in example.cmake example.cpp example.readme )
ENDIF ( build )
Deleted: gearbox/trunk/src/urg_nz/example.cmake
===================================================================
--- gearbox/trunk/src/urg_nz/example.cmake 2008-02-25 22:24:06 UTC (rev 86)
+++ gearbox/trunk/src/urg_nz/example.cmake 2008-02-26 01:40:17 UTC (rev 87)
@@ -1,10 +0,0 @@
-PROJECT( urg_nz_example )
-
-INCLUDE_DIRECTORIES( @CMAKE_INSTALL_PREFIX@ )
-
-ADD_EXECUTABLE( urg_nz_example example.cpp )
-TARGET_LINK_LIBRARIES( urg_nz_example urg_nz )
-SET_TARGET_PROPERTIES( urg_nz_example PROPERTIES
- LINK_FLAGS "-L@CMAKE_INSTALL_PREFIX@/lib/gearbox"
- INSTALL_RPATH "${INSTALL_RPATH};@CMAKE_INSTALL_PREFIX@/lib/gearbox"
- BUILD_WITH_INSTALL_RPATH TRUE )
Copied: gearbox/trunk/src/urg_nz/example.cmake.in (from rev 86, gearbox/trunk/src/urg_nz/example.cmake)
===================================================================
--- gearbox/trunk/src/urg_nz/example.cmake.in (rev 0)
+++ gearbox/trunk/src/urg_nz/example.cmake.in 2008-02-26 01:40:17 UTC (rev 87)
@@ -0,0 +1,10 @@
+PROJECT( urg_nz_example )
+
+INCLUDE_DIRECTORIES( @CMAKE_INSTALL_PREFIX@ )
+
+ADD_EXECUTABLE( urg_nz_example example.cpp )
+TARGET_LINK_LIBRARIES( urg_nz_example urg_nz )
+SET_TARGET_PROPERTIES( urg_nz_example PROPERTIES
+ LINK_FLAGS "-L@CMAKE_INSTALL_PREFIX@/lib/gearbox"
+ INSTALL_RPATH "${INSTALL_RPATH};@CMAKE_INSTALL_PREFIX@/lib/gearbox"
+ BUILD_WITH_INSTALL_RPATH TRUE )
Modified: gearbox/trunk/src/urg_nz/urg_nz.dox
===================================================================
--- gearbox/trunk/src/urg_nz/urg_nz.dox 2008-02-25 22:24:06 UTC (rev 86)
+++ gearbox/trunk/src/urg_nz/urg_nz.dox 2008-02-26 01:40:17 UTC (rev 87)
@@ -20,6 +20,9 @@
@par Copyright
Toby Collett, Nico Blodow, Geoffrey Biggs
+@par License
+ GPL
+
@par Style guidelines
- Naming conventions:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-02-25 22:25:08
|
Revision: 86
http://gearbox.svn.sourceforge.net/gearbox/?rev=86&view=rev
Author: borax00
Date: 2008-02-25 14:24:06 -0800 (Mon, 25 Feb 2008)
Log Message:
-----------
Modified Paths:
--------------
gearbox/trunk/submitted/gbxsickacfr/doc.dox
Modified: gearbox/trunk/submitted/gbxsickacfr/doc.dox
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/doc.dox 2008-02-25 12:59:40 UTC (rev 85)
+++ gearbox/trunk/submitted/gbxsickacfr/doc.dox 2008-02-25 22:24:06 UTC (rev 86)
@@ -50,6 +50,13 @@
- This is a Linux-only implementation.
- It works with those serial devices which @ref gbx_library_gbxserialacfr supports.
+- Currently, timestamps are generated whenever a _full_ message
+ arrives. This is sub-optimal, since the message may take a
+ significant amount of time to be transmitted over the serial
+ interface. eg. 181 samples at 38400 baud takes about 75ms.
+ An improvement would be to timestamp the start of each message,
+ remembering that timestamp for subsequent reads from the serial port
+ until the end of the message finally arrives.
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-02-25 12:59:35
|
Revision: 85
http://gearbox.svn.sourceforge.net/gearbox/?rev=85&view=rev
Author: borax00
Date: 2008-02-25 04:59:40 -0800 (Mon, 25 Feb 2008)
Log Message:
-----------
Modified Paths:
--------------
gearbox/trunk/submitted/gbxserialacfr/test/CMakeLists.txt
gearbox/trunk/submitted/gbxserialacfr/test/example.readme
gearbox/trunk/submitted/gbxsickacfr/test/CMakeLists.txt
Added Paths:
-----------
gearbox/trunk/submitted/gbxsickacfr/test/example.cmake.in
gearbox/trunk/submitted/gbxsickacfr/test/example.readme
Modified: gearbox/trunk/submitted/gbxserialacfr/test/CMakeLists.txt
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/test/CMakeLists.txt 2008-02-25 12:32:59 UTC (rev 84)
+++ gearbox/trunk/submitted/gbxserialacfr/test/CMakeLists.txt 2008-02-25 12:59:40 UTC (rev 85)
@@ -5,5 +5,4 @@
GBX_ADD_EXECUTABLE( serialechotest serialechotest.cpp )
GBX_ADD_EXECUTABLE( serialloopbacktest serialloopbacktest.cpp )
-MESSAGE( "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}" )
GBX_ADD_EXAMPLE( gbxserialacfr example.cmake.in example.cmake serialechotest.cpp serialloopbacktest.cpp )
\ No newline at end of file
Modified: gearbox/trunk/submitted/gbxserialacfr/test/example.readme
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/test/example.readme 2008-02-25 12:32:59 UTC (rev 84)
+++ gearbox/trunk/submitted/gbxserialacfr/test/example.readme 2008-02-25 12:59:40 UTC (rev 85)
@@ -7,6 +7,6 @@
have installed GearBox into /usr/local, you could do the following:
$ cd ~
-$ mkdir urg_nz_example
-$ cd urg_nz_example
+$ mkdir gbxserialacfr_example
+$ cd gbxserialacfr_example
$ ccmake /usr/local/share/gearbox/gbxserialacfr
Modified: gearbox/trunk/submitted/gbxsickacfr/test/CMakeLists.txt
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/test/CMakeLists.txt 2008-02-25 12:32:59 UTC (rev 84)
+++ gearbox/trunk/submitted/gbxsickacfr/test/CMakeLists.txt 2008-02-25 12:59:40 UTC (rev 85)
@@ -2,3 +2,5 @@
GBX_ADD_EXECUTABLE( gbxsickacfrtest test.cpp )
TARGET_LINK_LIBRARIES( gbxsickacfrtest GbxSickAcfr )
+
+GBX_ADD_EXAMPLE( gbxsickacfr example.cmake.in example.cmake test.cpp example.readme )
\ No newline at end of file
Added: gearbox/trunk/submitted/gbxsickacfr/test/example.cmake.in
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/test/example.cmake.in (rev 0)
+++ gearbox/trunk/submitted/gbxsickacfr/test/example.cmake.in 2008-02-25 12:59:40 UTC (rev 85)
@@ -0,0 +1,10 @@
+PROJECT( gbxserialacfr_example )
+
+INCLUDE_DIRECTORIES( @CMAKE_INSTALL_PREFIX@/include/gearbox )
+
+ADD_EXECUTABLE( gbxsickacfrtest test.cpp )
+TARGET_LINK_LIBRARIES( gbxsickacfrtest GbxSickAcfr )
+SET_TARGET_PROPERTIES( gbxsickacfrtest PROPERTIES
+ LINK_FLAGS "-L@CMAKE_INSTALL_PREFIX@/lib/gearbox"
+ INSTALL_RPATH "${INSTALL_RPATH};@CMAKE_INSTALL_PREFIX@/lib/gearbox"
+ BUILD_WITH_INSTALL_RPATH TRUE )
Added: gearbox/trunk/submitted/gbxsickacfr/test/example.readme
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/test/example.readme (rev 0)
+++ gearbox/trunk/submitted/gbxsickacfr/test/example.readme 2008-02-25 12:59:40 UTC (rev 85)
@@ -0,0 +1,12 @@
+Building
+--------
+
+The example can be built by making a directory (anywhere on your system where
+you have write permissions will do), changing to that directory and executing
+CMake with the example's source directory as an argument. For example, if you
+have installed GearBox into /usr/local, you could do the following:
+
+$ cd ~
+$ mkdir gbxsickacfr_example
+$ cd gbxsickacfr_example
+$ ccmake /usr/local/share/gearbox/gbxsickacfr
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-02-25 12:32:54
|
Revision: 84
http://gearbox.svn.sourceforge.net/gearbox/?rev=84&view=rev
Author: borax00
Date: 2008-02-25 04:32:59 -0800 (Mon, 25 Feb 2008)
Log Message:
-----------
changed GBX_ADD_EXAMPLE
Modified Paths:
--------------
gearbox/trunk/src/urg_nz/CMakeLists.txt
Modified: gearbox/trunk/src/urg_nz/CMakeLists.txt
===================================================================
--- gearbox/trunk/src/urg_nz/CMakeLists.txt 2008-02-25 12:32:27 UTC (rev 83)
+++ gearbox/trunk/src/urg_nz/CMakeLists.txt 2008-02-25 12:32:59 UTC (rev 84)
@@ -16,6 +16,6 @@
GBX_ADD_HEADERS( ${lib_name} ${hdrs} )
- GBX_ADD_EXAMPLE( ${lib_name} example.cmake example.cpp example.readme )
+ GBX_ADD_EXAMPLE( ${lib_name} example.cmake example.cmake example.cpp example.readme )
ENDIF ( build )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-02-25 12:32:22
|
Revision: 83
http://gearbox.svn.sourceforge.net/gearbox/?rev=83&view=rev
Author: borax00
Date: 2008-02-25 04:32:27 -0800 (Mon, 25 Feb 2008)
Log Message:
-----------
Modified Paths:
--------------
gearbox/trunk/cmake/internal/TargetUtils.cmake
Modified: gearbox/trunk/cmake/internal/TargetUtils.cmake
===================================================================
--- gearbox/trunk/cmake/internal/TargetUtils.cmake 2008-02-25 12:32:07 UTC (rev 82)
+++ gearbox/trunk/cmake/internal/TargetUtils.cmake 2008-02-25 12:32:27 UTC (rev 83)
@@ -38,16 +38,16 @@
ENDMACRO( GBX_ADD_HEADERS install_subdir )
#
-# GBX_ADD_EXAMPLE( install_subdir makefile [FILE0 FILE1 FILE2 ...] )
+# GBX_ADD_EXAMPLE( install_subdir makefile.in makefile.out [FILE0 FILE1 FILE2 ...] )
#
# Specialisation of INSTALL(FILES ...) for GearBox project to to install examples.
# All files are installed into PREFIX/share/gearbox/${install_subdir}.
# makefile is passed through CONFIGURE_FILE to add in correct include and library
# paths based on the install prefix.
#
-MACRO( GBX_ADD_EXAMPLE install_subdir makefile )
- CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/${makefile} ${CMAKE_CURRENT_BINARY_DIR}/${makefile} @ONLY)
- INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/${makefile} DESTINATION share/gearbox/${install_subdir} RENAME CMakeLists.txt )
+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/gearbox/${install_subdir} RENAME CMakeLists.txt )
INSTALL( FILES ${ARGN} DESTINATION share/gearbox/${install_subdir} )
ENDMACRO( GBX_ADD_EXAMPLE install_subdir makefile )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|