Revision: 6428
          http://playerstage.svn.sourceforge.net/playerstage/?rev=6428&view=rev
Author:   gbiggs
Date:     2008-05-11 19:21:34 -0700 (Sun, 11 May 2008)

Log Message:
-----------
Applied patch 1957475: Fixes for the AmtecM5-actarray and PhidgetRFID drivers

Modified Paths:
--------------
    code/player/trunk/cmake/internal/DriverUtils.cmake
    code/player/trunk/server/CMakeLists.txt
    code/player/trunk/server/drivers/actarray/CMakeLists.txt
    code/player/trunk/server/drivers/actarray/amtecM5.cc
    code/player/trunk/server/drivers/rfid/phidgetRFID.cc

Modified: code/player/trunk/cmake/internal/DriverUtils.cmake
===================================================================
--- code/player/trunk/cmake/internal/DriverUtils.cmake  2008-05-12 01:43:38 UTC 
(rev 6427)
+++ code/player/trunk/cmake/internal/DriverUtils.cmake  2008-05-12 02:21:34 UTC 
(rev 6428)
@@ -225,6 +225,39 @@
 
 
 ###############################################################################
+# PLAYERDRIVER_REQUIRE_HEADER_CPP (_name _cumulativeVar _header)
+# Check if a required C++ header file is available. (CMake will try to compile
+#  a small program using c++ with an include<_header> line)
+#
+# See the CheckIncludeFileCXX.cmake module for extra variables that may modify
+# how this macro runs.
+#
+# _name:            Driver name.
+# _cumulativeVar:   The option used in the calling CMakeLists.txt to check if
+#                   the driver has been enabled.
+# _header:          Name of the header file to look for.
+INCLUDE (CheckIncludeFileCXX)
+MACRO (PLAYERDRIVER_REQUIRE_HEADER_CPP _name _cumulativeVar _header)
+    STRING (TOUPPER ${_header} headerUpper)
+    STRING (REGEX REPLACE "[./\\]" "_" headerUpper "${headerUpper}")
+    SET (resultVar "HAVE_HDR_${headerUpper}")
+    CHECK_INCLUDE_FILE_CXX("${_header}" ${resultVar})
+    # If not found, disable this driver
+    # Dereference cumulativeVar only once because IF will dereference the 
variable name stored inside itself
+    IF (${_cumulativeVar} AND ${resultVar})
+        # Driver will be built and header found - add a #define
+        # Append to a list instead of setting an option so we can 
auto-generate driver_config.h
+        APPEND_TO_CACHED_LIST (PLAYERDRIVER_HAVE_DEFINES 
${PLAYERDRIVER_HAVE_DEFINES_DESC} "HAVE_HDR_${headerUpper}")
+    ELSEIF (${_cumulativeVar})
+        # Case where cumulativeVar is set but header wasn't found - don't build
+        SET (${_cumulativeVar} FALSE)
+        PLAYERDRIVER_ADD_TO_NOT_BUILT (${_name} "Could not find header 
${_header}")
+        PLAYERDRIVER_ADD_DRIVEROPTION (${_name} OFF TRUE)
+    ENDIF (${_cumulativeVar} AND ${resultVar})
+ENDMACRO (PLAYERDRIVER_REQUIRE_HEADER_CPP)
+
+
+###############################################################################
 # PLAYERDRIVER_REQUIRE_FUNCTION (_name _cumulativeVar _function)
 # Check if a required function is available.
 #
@@ -439,4 +472,4 @@
     SET (PLAYER_NOT_BUILT_REASONS "" CACHE INTERNAL 
${PLAYER_NOT_BUILT_REASONS_DESC} FORCE)
 
     SET (PLAYERDRIVER_DEFINES "" CACHE INTERNAL ${PLAYERDRIVER_DEFINES_DESC} 
FORCE)
-ENDMACRO (PLAYERDRIVER_RESET_LISTS)
\ No newline at end of file
+ENDMACRO (PLAYERDRIVER_RESET_LISTS)

Modified: code/player/trunk/server/CMakeLists.txt
===================================================================
--- code/player/trunk/server/CMakeLists.txt     2008-05-12 01:43:38 UTC (rev 
6427)
+++ code/player/trunk/server/CMakeLists.txt     2008-05-12 02:21:34 UTC (rev 
6428)
@@ -25,9 +25,9 @@
     TARGET_LINK_LIBRARIES (player playersd)
 ENDIF (HAVE_PLAYERSD)
 IF (PLAYER_DRIVERSLIB_LINKFLAGS)
-    SET_TARGET_PROPERTIES (player PROPERTIES LINK_FLAGS 
${PLAYER_DRIVERSLIB_LINKFLAGS})
+    TARGET_LINK_LIBRARIES (player ${PLAYER_DRIVERSLIB_LINKFLAGS})
 ENDIF (PLAYER_DRIVERSLIB_LINKFLAGS)
 INSTALL (TARGETS player DESTINATION bin/)
 
 # Clean up stuff from the drivers
-PLAYERDRIVER_RESET_LISTS ()
\ No newline at end of file
+PLAYERDRIVER_RESET_LISTS ()

Modified: code/player/trunk/server/drivers/actarray/CMakeLists.txt
===================================================================
--- code/player/trunk/server/drivers/actarray/CMakeLists.txt    2008-05-12 
01:43:38 UTC (rev 6427)
+++ code/player/trunk/server/drivers/actarray/CMakeLists.txt    2008-05-12 
02:21:34 UTC (rev 6428)
@@ -1,12 +1,19 @@
 PLAYERDRIVER_OPTION (amtecm5 build_amtecm5 ON)
 SET (AMTECM5_DIR "" CACHE STRING "Directory containing the Amtec M5 libraries")
 MARK_AS_ADVANCED (AMTECM5_DIR)
+
 IF (NOT "${AMTECM5_DIR}" STREQUAL "")
     SET (amtecExtraIncludeDirs ${AMTECM5_DIR}/include ${AMTECM5_DIR}/Device)
-    SET (amtecExtraLibs "${AMTECM5_DIR}/lib/device.a 
${AMTECM5_DIR}/lib/ntcan.a ${AMTECM5_DIR}/lib/util.a")
-ELSE (NOT "${AMTECM5_DIR}" STREQUAL "")
-    SET (amtecExtraLibs "device.a ntcan.a util.a")
 ENDIF (NOT "${AMTECM5_DIR}" STREQUAL "")
-PLAYERDRIVER_REQUIRE_HEADER (amtecm5 build_amtecm5 Device.h 
${extraIncludeDirs})
+SET (amtecExtraLibs "-ldevice -lntcan -lutil")
+SET (amtecCFlags "-D__LINUX__ -DUNIX -DLINUX")
+
+SET (CMAKE_REQUIRED_INCLUDES "${amtecExtraIncludeDirs}")
+SET (CMAKE_REQUIRED_DEFINITIONS "${amtecCFlags}")
+PLAYERDRIVER_REQUIRE_HEADER_CPP (amtecm5 build_amtecm5 Device.h)
+SET (CMAKE_REQUIRED_INCLUDES)
+SET (CMAKE_REQUIRED_DEFINITIONS)
+
 PLAYERDRIVER_REJECT_OS (amtecm5 build_amtecm5 PLAYER_OS_WIN)
-PLAYERDRIVER_ADD_DRIVER (amtecm5 build_amtecm5 "" "" ${amtecExtraLibs} 
"-D__LINUX__ -DUNIX -DLINUX" amtecM5.cc)
+PLAYERDRIVER_ADD_DRIVER (amtecm5 build_amtecm5 "${amtecExtraIncludeDirs}" 
"${AMTECM5_DIR}/lib" "${amtecExtraLibs}" "${amtecCFlags}" amtecM5.cc)
+

Modified: code/player/trunk/server/drivers/actarray/amtecM5.cc
===================================================================
--- code/player/trunk/server/drivers/actarray/amtecM5.cc        2008-05-12 
01:43:38 UTC (rev 6427)
+++ code/player/trunk/server/drivers/actarray/amtecM5.cc        2008-05-12 
02:21:34 UTC (rev 6428)
@@ -28,15 +28,6 @@
  * For precise timing, use a recent Linux kernel (2.6.19 should have the 
hrtimers code inside)
  */
 
-// ONLY if you need something that was #define'd as a result of configure
-// (e.g., HAVE_CFMAKERAW), then #include <config.h>, like so:
-/*
-#include <config.h>
-*/
-
-//#include <unistd.h>
-//#include <string.h>
-
 #include <libplayercore/playercore.h>
 
 #include <algorithm>
@@ -45,13 +36,9 @@
 #include <vector>
 #include <set>
 
-// These flags are needed by Device.h
-// They should probably be moved to -D flags on the compile of this program
-// As they are, they assume a Linux system
-#define __LINUX__
-#define UNIX
-#define LINUX
-
+//Device.h needs some definitions choosing the operating system, it has only 
been tested
+// on Linux systems, so the default flags are __LINUX__ , UNIX , and LINUX
+//Currently, they are set explicitely in the CMakeLists.txt file
 #include "Device.h"
 
 const float initSpeed=0.2; //Rads/s
@@ -70,6 +57,7 @@
 
 
 using namespace std;
+const unsigned int PLAYER_ACTARRAY_NUM_ACTUATORS=16;
 
 
 //This function returns the difference in mS between two timeval structures
@@ -302,7 +290,7 @@
        highpriority = cf->ReadInt(section, "highpriority", 0);
 
        actuators = NULL;
-       acuatorsGeom = NULL;
+       actuatorsGeom = NULL;
 }
 
 
////////////////////////////////////////////////////////////////////////////////

Modified: code/player/trunk/server/drivers/rfid/phidgetRFID.cc
===================================================================
--- code/player/trunk/server/drivers/rfid/phidgetRFID.cc        2008-05-12 
01:43:38 UTC (rev 6427)
+++ code/player/trunk/server/drivers/rfid/phidgetRFID.cc        2008-05-12 
02:21:34 UTC (rev 6428)
@@ -470,7 +470,7 @@
 // that it can be invoked without object context.  In this function, we add
 // the driver into the given driver table, indicating which interface the
 // driver can support and how to create a driver instance.
-void phidgetrfid_Register(DriverTable* table) {
+void phidgetRFID_Register(DriverTable* table) {
        table->AddDriver("phidgetRFID", PhidgetRFID_Init);
 }
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to