[ros-users] Upgrade to ROS 1.3+

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
+ rosbuild_xcproj.patch (text/x-diff)
+ roscreate_xcproj.patch (text/x-diff)
+ CMakeLists_xcproj.tmpl (application/octet-stream)
Delete this message
Reply to this message
Author: #TAN ZHI PING#
Date:  
To: ros-users@code.ros.org
Subject: [ros-users] Upgrade to ROS 1.3+
Hi,

I'm new in the ROS Software. I would like to upgrade my ROS to 1.3+ and have already downloaded the patch from https://code.ros.org/trac/ros/ticket/2945. But how do i installed the patch to the ROS system?

With thanks,
Zhiping
Index: public.cmake
===================================================================
--- public.cmake    (revision 10573)
+++ public.cmake    (working copy)
@@ -533,6 +533,18 @@
   _rosbuild_add_library(${lib} ${lib} MODULE ${ARGN})
 endmacro(rosbuild_add_library_module)


+# Allow rosbuild to build xcodeprojects. This allows it to be built along 
+# with its dependencies and allows other packages to depend on it. 
+# However this can only be done on Darwin, and the build configuration
+# must be done manually within XCode.
+macro(rosbuild_add_xcproj proj)
+  if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+    execute_process(COMMAND xcodebuild -project ${PROJECT_NAME}.xcodeproj WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})  
+  elseif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+    message(FATAL_ERROR "You are attempting to build an xcodeproj, but you are not on a Darwin system!")
+  endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+endmacro(rosbuild_add_xcproj)
+
 # Explicitly add flags for gtest.  We do this here, instead of using
 # manifest dependencies, because there are situations in which it is
 # undesirable to link in gtest where's it's not being used.  gtest is

Index: src/roscreate/roscreatepkg.py
===================================================================
--- src/roscreate/roscreatepkg.py    (revision 10573)
+++ src/roscreate/roscreatepkg.py    (working copy)
@@ -54,14 +54,15 @@
 def instantiate_template(template, package, brief, description, author, depends):
     return template%locals()


-def create_package(package, author, depends, uses_roscpp=False, uses_rospy=False):
+def create_package(package, author, depends, uses_roscpp=False, uses_rospy=False, is_xcproj=False):
     p = os.path.abspath(package)
-    if os.path.exists(p):
+    if os.path.exists(p) and not is_xcproj:
         print >> sys.stderr, "%s already exists, aborting"%p
         sys.exit(1)


-    os.makedirs(p)
-    print "Created package directory", p
+    if not is_xcproj:
+        os.makedirs(p)
+        print "Created package directory", p


     if uses_roscpp:
         # create package/include/package and package/src for roscpp code
@@ -87,7 +88,9 @@


     templates = get_templates()
     for filename, template in templates.iteritems():
-        contents = instantiate_template(template, package, package, package, author, depends)
+    if is_xcproj and filename == "CMakeLists.txt":
+        template = read_template('CMakeLists_xcproj.tmpl')
+    contents = instantiate_template(template, package, package, package, author, depends)
         try:
             p = os.path.abspath(os.path.join(package, filename))
             f = open(p, 'w')
@@ -99,7 +102,8 @@


 def roscreatepkg_main():
     from optparse import OptionParser    
-    parser = OptionParser(usage="usage: %prog <package-name> [dependencies...]", prog=NAME)
+    parser = OptionParser(usage="usage: %prog [-xcproj] <package-name> [dependencies...]", prog=NAME)
+    parser.add_option("-x", "--xcproj", dest="is_xcproj", default=False, action="store_true", help="Create a package within an XCode Project")
     options, args = parser.parse_args()
     if not args:
         parser.error("you must specify a package name and optionally also list package dependencies")
@@ -123,7 +127,7 @@


     if not on_ros_path(os.getcwd()):
         print >> sys.stderr, '!'*80+"\nWARNING: current working directory is not on ROS_PACKAGE_PATH!\nPlease update your ROS_PACKAGE_PATH environment variable.\n"+'!'*80
-    create_package(package, author_name(), depends, uses_roscpp=uses_roscpp, uses_rospy=uses_rospy)
+    create_package(package, author_name(), depends, uses_roscpp=uses_roscpp, uses_rospy=uses_rospy, is_xcproj=options.is_xcproj)


 if __name__ == "__main__":
     roscreatepkg_main()