[openrtm-commit:01536] r530 - trunk/rtmtools

openrtm @ openrtm.org openrtm @ openrtm.org
2015年 6月 6日 (土) 17:02:09 JST


Author: n-ando
Date: 2015-06-06 17:02:09 +0900 (Sat, 06 Jun 2015)
New Revision: 530

Modified:
   trunk/rtmtools/openrtp
Log:
[compat, installation] openrtp launcher script has been updated to execute eclipse in OpenRTM lib dir.

Modified: trunk/rtmtools/openrtp
===================================================================
--- trunk/rtmtools/openrtp	2015-05-27 00:25:58 UTC (rev 529)
+++ trunk/rtmtools/openrtp	2015-06-06 08:02:09 UTC (rev 530)
@@ -15,9 +15,14 @@
 #
 
 
-#============================================================
-# functions
-#============================================================
+debug_echo () {
+    if test "x$DEBUG" = "xTRUE"; then
+        echo "$*"
+    fi
+}
+#------------------------------------------------------------
+# Usage
+#------------------------------------------------------------
 SCRIPT_NAME=$(basename $0)
 tmp=$(readlink $0)
 if test "x$tmp" = "x" ; then
@@ -25,22 +30,36 @@
 else
     SCRIPT_DIR=$(dirname $tmp)
 fi
-DEBUG=""
-debug_echo () {
-    if test "x$DEBUG" = "xTRUE"; then
-        echo $*
-    fi
-}
-
-#------------------------------------------------------------
-# Usage
-#------------------------------------------------------------
 usage()
 {
-    echo "Usage: $script_name [Eclipse options]"
     echo ""
+    echo "Usage: $SCRIPT_NAME [--help|--debug] [Eclipse options]"
+    echo ""
+    echo "  --help: print this help message"
+    echo "  --debug: Print debug message"
+    echo ""
 }
 
+#============================================================
+# functions
+#============================================================
+
+ECLIPSE_ARGS=""
+for arg in $* ; do
+    if test "x$arg" = "x--help" ; then
+        usage
+        exit 0
+    fi
+    if test "x$arg" = "x--debug" ; then
+        DEBUG="TRUE"
+    else
+        ECLIPSE_ARGS="$ECLIPSE_ARGS $arg"
+    fi
+done
+debug_echo "Debug mode enable."
+debug_echo "ECLIPSE_ARGS: $ECLIPSE_ARGS"
+
+
 #------------------------------------------------------------
 # set_RTM_ROOT
 #
@@ -53,25 +72,28 @@
 {
     if test "x$RTM_ROOT" = "x"; then
         debug_echo "RTM_ROOT is not set."
-        if ! find_RTM_ROOT ; then
-            echo "No OpenRTM-aist (C++) installed found."
-            echo "Please install OpenRTM-aist (C++) and set RTM_ROOT"
-            echo "  ex. export RTM_ROOT=/usr/include/openrtm-1.1/"
-            echo ""
+        find_RTM_ROOT
+        if test "x$RTM_ROOT" = "x" ; then
+            debug_echo "No OpenRTM-aist (C++) installed found."
+            debug_echo "Please install OpenRTM-aist (C++) and set RTM_ROOT"
+            debug_echo "  ex. export RTM_ROOT=/usr/include/openrtm-1.1/"
+            debug_echo ""
             return 1
         fi
     fi
 
     # Now RTM_ROOT is set
-
-    if ! check_RTM_ROOT ; then
-        echo "Environmental variable RTM_ROOT = $RTM_ROOT is invalid."
-        echo "Please check RTM_JAVA_ROOT and OpenRTM-aist C++ installation."
-        echo ""
-        echo "  ex."
-        echo " If /usr/include/openrtm-1.1/rtm/idl/BasicDataType.idl exists,"
-        echo " RTM_ROOT should be /usr/include/openrtm-1.1"
-        echo ""
+    check_RTM_ROOT
+    if test $? != 0 ; then
+        debug_echo ""
+        debug_echo "WARNING: Invalid RTM_ROOT"
+        debug_echo "    Environmental variable RTM_ROOT = $RTM_ROOT is invalid."
+        debug_echo "    Please check OpenRTM-aist C++ installation."
+        debug_echo "  ex."
+        debug_echo "    If BasicDataType.idl exists under:"
+        debug_echo "                       /usr/include/openrtm-1.1/rtm/idl/"
+        debug_echo "    RTM_ROOT should be /usr/include/openrtm-1.1"
+        debug_echo ""
         return 1
     fi
     debug_echo "Result: RTM_ROOT = " $RTM_ROOT
@@ -124,8 +146,8 @@
         idl_path=`find $RTM_ROOT -name $idl`
         debug_echo "idl_path: " $idl_path
         if test "x$idl_path" = "x" ; then
-            echo "IDL file: " $idl " not found under \$RTM_ROOT"
-            echo "\$RTM_ROOT = " $RTM_ROOT
+            debug_echo "IDL file: " $idl " not found under \$RTM_ROOT"
+            debug_echo "\$RTM_ROOT = " $RTM_ROOT
             return 1
         fi
     done
@@ -141,24 +163,26 @@
 #------------------------------------------------------------
 set_RTM_JAVA_ROOT ()
 {
+    debug_echo "TRACE: set_RTM_JAVA_ROOT"
     if test "x$RTM_JAVA_ROOT" = "x"; then
         debug_echo "RTM_JAVA_ROOT is not set."
-        if ! find_RTM_JAVA_ROOT ; then
-            echo "No OpenRTM-aist (Java) installed found."
-            echo "Please install OpenRTM-aist (Java) and set RTM_JAVA_ROOT"
-            echo "  ex. export RTM_JAVA_ROOT=/usr/include/openrtm-1.1/"
-            echo ""
+        find_RTM_JAVA_ROOT
+        if test $? != 0 ; then
+            debug_echo "No OpenRTM-aist (Java) installed found."
+            debug_echo "Please install OpenRTM-aist (Java) and set RTM_JAVA_ROOT"
+            debug_echo "  ex. export RTM_JAVA_ROOT=/usr/include/openrtm-1.1/"
+            debug_echo ""
             return 1
         fi
     fi
 
     # Now RTM_JAVA_ROOT is set
-
-    if ! check_RTM_JAVA_ROOT ; then
-        echo "env RTM_JAVA_ROOT is invalid"
-        echo "Please set RTM_JAVA_ROOT correctly."
-        echo "  ex. export RTM_JAVA_ROOT=/usr/include/openrtm-1.1/"
-        echo ""
+    check_RTM_JAVA_ROOT
+    if test $? != 0 ; then
+        debug_echo "env RTM_JAVA_ROOT is invalid"
+        debug_echo "Please set RTM_JAVA_ROOT correctly."
+        debug_echo "  ex. export RTM_JAVA_ROOT=/usr/include/openrtm-1.1/"
+        debug_echo ""
         return 1
     fi
     debug_echo "Result: RTM_JAVA_ROOT = " $RTM_JAVA_ROOT
@@ -202,7 +226,7 @@
 
     if test "x$openrtm_jar" = "x" ; then
         debug_echo "jar file not found"
-        echo "No OpenRTM-aist (Java)installation found."
+        debug_echo "No OpenRTM-aist (Java) installation found."
         return 1
     fi
     debug_echo "jar file found: " $openrtm_jar
@@ -210,7 +234,6 @@
     RTM_JAVA_ROOT=`dirname $openrtm_jar | sed -e 's/\/jar$//'`
     debug_echo "RTM_JAVA_ROOT: " $RTM_JAVA_ROOT
     return 0
-
 }
 
 #------------------------------------------------------------
@@ -226,32 +249,77 @@
     debug_echo "jar_file: " $jar_file
 
     if test "x$jar_file" = "x" ; then
-        echo "Environmental variable RTM_JAVA_ROOT = $RTM_JAVA_ROOT is invalid."
-        echo "Please check RTM_JAVA_ROOT and OpenRTM-aist Java installation."
-        echo ""
-        echo "ex."
-        echo "If /usr/lib/OpenRTM-aist/1.0/jar/OpenRTM-1.0.0.jar exists,"
-        echo "RTM_JAVA_ROOT should be /usr/lib/OpenRTM-aist/1.0"
-        echo ""
+        debug_echo ""
+        debug_echo "WARNING: Environmental variable RTM_JAVA_ROOT is invalid."
+        debug_echo "    RTM_JAVA_ROOT = $RTM_JAVA_ROOT"
+        debug_echo "    Please check OpenRTM-aist Java installation."
+        debug_echo "  ex."
+        debug_echo "    If /OpenRTM-1.0.0.jar exists under:"
+        debug_echo "                        /usr/lib/OpenRTM-aist/1.0/jar"
+        debug_echo "    RTM_JAVA_ROOT should be /usr/lib/OpenRTM-aist/1.0"
+        debug_echo ""
         return 1
     fi
     return 0
 }
 
+find_OPENRTP_DIR()
+{
+    rtm_config=`which rtm-config`
+    if test "x$rtm_config" != "x" ; then
+        OPENRTP_DIR=`rtm-config --libdir`/openrtp
+        debug_echo "OPENRTP_DIR: $OPENRTP_DIR"
+        if test -f $OPENRTP_DIR/eclipse ; then
+            OPENRTP_EXECUTABLE=$OPENRTP_DIR/eclipse
+        else
+            echo "WARNING: No OpenRTP installation under OpenRTM libdir."
+        fi
+    fi
+    openrtp_dir=`find /usr/lib /usr/lib32 /usr/lib64 -name 'openrtp'  2>/dev/null`
+    if test "x$openrtp_dir" = "x" ; then
+        echo "ERROR: No OpenRTP installation found. Aborting."
+        exit 1
+    fi
+    for d in $openrtp_dir ; do
+        if test -f $d/eclipse ; then
+            OPENRTP_DIR=$d
+            OPENRTP_EXECUTABLE=$d/eclipse
+            debug_echo "OPENRTP_DIR: $OPENRTP_DIR"
+            debug_echo "OPENRTP_EXECUTABLE: $OPENRTP_EXECUTABLE"
+            return 0
+        fi
+    done
+    echo "ERROR: No OpenRTP installation found. Aborting."
+    exit 1
+}
 #------------------------------
 # main
 #------------------------------
+
 set_RTM_ROOT
+if test $? != 0 ; then
+    echo "WARNING: RTM_ROOT not set."
+    echo "    This might cause failure of data type acquisition for"
+    echo "    data ports definition in RTCBuilder."
+    echo "    If you want use RTCBuilder, please install C++ version"
+    echo "    of OpenRTM-aist on this system."
+else
+    debug_echo "  RTM_ROOT     : " $RTM_ROOT
+fi
+
 set_RTM_JAVA_ROOT
+if test $? != 0 ; then
+    echo "WARNING: RTM_JAVA_ROOT not set."
+    echo "    This might cause failure of data type acquisition for"
+    echo "    data ports definition in RTCBuilder."
+    echo "    If you want use RTCBuilder, please install C++ version"
+    echo "    of OpenRTM-aist on this system."
+else
+    debug_echo "  RTM_JAVA_ROOT     : " $RTM_JAVA_ROOT
+fi
 
-echo "Launching eclipse with the following environmental variables."
-echo "  RTM_ROOT     : " $RTM_ROOT
-echo "  RTM_JAVA_ROOT: " $RTM_JAVA_ROOT
+find_OPENRTP_DIR
 
-cd $SCRIPT_DIR
-if test ! -x eclipse ; then
-    echo "No eclipse executable found. Aborting."
-    exit 1
-fi
+cd $OPENRTP_DIR
 export GDK_NATIVE_WINDOWS=1
-./eclipse $*
+./eclipse $ECLIPSE_ARGS



More information about the openrtm-commit mailing list