From c2918f6552db46357c826d5a16648693a11d263b Mon Sep 17 00:00:00 2001
From: Ken Tossell <ken@tossell.net>
Date: Sat, 24 Nov 2012 18:45:42 -0500
Subject: [PATCH] catkin build

---
 CMakeLists.txt                  | 17 -----------
 libuvc/Makefile                 | 24 ---------------
 libuvc/manifest.xml             | 18 -----------
 libuvc_camera/CMakeLists.txt    | 54 +++++++++++++--------------------
 libuvc_camera/cfg/UVCCamera.cfg |  2 +-
 libuvc_camera/manifest.xml      | 24 ---------------
 stack.xml                       | 16 ----------
 7 files changed, 22 insertions(+), 133 deletions(-)
 delete mode 100644 CMakeLists.txt
 delete mode 100644 libuvc/Makefile
 delete mode 100644 libuvc/manifest.xml
 delete mode 100644 libuvc_camera/manifest.xml
 delete mode 100644 stack.xml

diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100644
index 28105dd..0000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-cmake_minimum_required(VERSION 2.4.6)
-include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
-
-# Append to CPACK_SOURCE_IGNORE_FILES a semicolon-separated list of
-# directories (or patterns, but directories should suffice) that should
-# be excluded from the distro.  This is not the place to put things that
-# should be ignored everywhere, like "build" directories; that happens in
-# rosbuild/rosbuild.cmake.  Here should be listed packages that aren't
-# ready for inclusion in a distro.
-#
-# This list is combined with the list in rosbuild/rosbuild.cmake.  Note
-# that CMake 2.6 may be required to ensure that the two lists are combined
-# properly.  CMake 2.4 seems to have unpredictable scoping rules for such
-# variables.
-#list(APPEND CPACK_SOURCE_IGNORE_FILES /core/experimental)
-
-rosbuild_make_distribution(0.1.0)
diff --git a/libuvc/Makefile b/libuvc/Makefile
deleted file mode 100644
index 84ebd4d..0000000
--- a/libuvc/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-#include $(shell rospack find mk)/cmake.mk
-.PHONY: clean download
-
-BUILD_TYPE?=Release
-CMAKE=cmake
-CMAKE_ARGS=-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-	   -DCMAKE_INSTALL_PREFIX=`rospack find libuvc`/libuvc
-
-all:
-	mkdir -p build
-	@git clone git://github.com/ktossell/libuvc.git build/git || (echo "INFO: skipping clone"; true)
-	cd build/git && git pull
-	mkdir -p build/build
-	cd build/build && $(CMAKE) ../git $(CMAKE_ARGS)
-	cd build/build && make && make install
-	
-	# you shouldn't have to do this, but it works for the Mac
-	if [ `uname` = Darwin ]; then \
-		install_name_tool -id `rospack find libuvc`/libuvc/lib/libuvc.dylib `rospack find libuvc`/libuvc/lib/libuvc.dylib; \
-	fi
-
-clean:
-	rm -rf build/build libuvc
-
diff --git a/libuvc/manifest.xml b/libuvc/manifest.xml
deleted file mode 100644
index 254a697..0000000
--- a/libuvc/manifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<package>
-  <description brief="low-level driver for USB video cameras">
-
-     This package pulls in the libuvc library for USB Video Class devices.
-
-  </description>
-  <author>Ken Tossell</author>
-  <license>BSD</license>
-  <review status="unreviewed" notes=""/>
-  <url>http://ros.org/wiki/libuvc</url>
-  <export>
-    <cpp cflags="-I${prefix}/libuvc/include" lflags="-L${prefix}/libuvc/lib -Wl,-rpath,-L${prefix}/libuvc/lib"/>
-    <cpp os="osx" cflags="-I${prefix}/libuvc/include" lflags="-L${prefix}/libuvc/lib -Wl,-rpath,-L${prefix}/libuvc/lib -framework CoreServices"/>
-  </export>
-  <rosdep name="libusb-1.0"/>
-</package>
-
-
diff --git a/libuvc_camera/CMakeLists.txt b/libuvc_camera/CMakeLists.txt
index ce17734..dcabded 100644
--- a/libuvc_camera/CMakeLists.txt
+++ b/libuvc_camera/CMakeLists.txt
@@ -1,40 +1,28 @@
-cmake_minimum_required(VERSION 2.4.6)
-include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
+# http://ros.org/doc/groovy/api/catkin/html/user_guide/supposed.html
+cmake_minimum_required(VERSION 2.8.3)
+project(libuvc_camera)
+# Load catkin and all dependencies required for this package
+find_package(catkin REQUIRED COMPONENTS libuvc)
 
-# Set the build type.  Options are:
-#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
-#  Debug          : w/ debug symbols, w/o optimization
-#  Release        : w/o debug symbols, w/ optimization
-#  RelWithDebInfo : w/ debug symbols, w/ optimization
-#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
-#set(ROS_BUILD_TYPE RelWithDebInfo)
+#find_package(libuvc REQUIRED)
+catkin_package(DEPENDS roscpp camera_info_manager driver_base dynamic_reconfigure image_transport nodelet sensor_msgs libuvc
+    INCLUDE_DIRS include
+    LIBRARIES ${PROJECT_NAME})
 
-rosbuild_init()
+include_directories(include ${Boost_INCLUDE_DIR} ${catkin_INCLUDE_DIRS})
+link_directories(${catkin_LINK_DIRS})
 
-#set the default path for built executables to the "bin" directory
-set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
-#set the default path for built libraries to the "lib" directory
-set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
+find_package(catkin REQUIRED dynamic_reconfigure)
+generate_dynamic_reconfigure_options(cfg/UVCCamera.cfg)
 
-#uncomment if you have defined messages
-#rosbuild_genmsg()
-#uncomment if you have defined services
-#rosbuild_gensrv()
+find_package(Boost REQUIRED COMPONENTS thread)
+include_directories(${Boost_INCLUDE_DIRS})
 
-rosbuild_find_ros_package(dynamic_reconfigure)
-include(${dynamic_reconfigure_PACKAGE_PATH}/cmake/cfgbuild.cmake)
-gencfg()
+#find_package(libuvc REQUIRED)
+include_directories(${libuvc_INCLUDE_DIRS})
 
-#common commands for building c++ executables and libraries
-#rosbuild_add_library(${PROJECT_NAME} src/example.cpp)
-#target_link_libraries(${PROJECT_NAME} another_library)
-#rosbuild_add_boost_directories()
-#rosbuild_link_boost(${PROJECT_NAME} thread)
-#rosbuild_add_executable(example examples/example.cpp)
-#target_link_libraries(example ${PROJECT_NAME})
+add_executable(camera_node src/main.cpp src/camera_driver.cpp)
+target_link_libraries(camera_node uvc ${Boost_LIBRARIES})
 
-rosbuild_add_executable(camera_node src/main.cpp src/camera_driver.cpp)
-target_link_libraries(camera_node uvc)
-
-rosbuild_add_library(libuvc_camera_nodelet src/nodelet.cpp src/camera_driver.cpp)
-target_link_libraries(libuvc_camera_nodelet uvc)
+add_library(libuvc_camera_nodelet src/nodelet.cpp src/camera_driver.cpp)
+target_link_libraries(libuvc_camera_nodelet uvc ${Boost_LIBRARIES})
diff --git a/libuvc_camera/cfg/UVCCamera.cfg b/libuvc_camera/cfg/UVCCamera.cfg
index 7e5e6ce..d0a7518 100755
--- a/libuvc_camera/cfg/UVCCamera.cfg
+++ b/libuvc_camera/cfg/UVCCamera.cfg
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python2
 # Derived from camera1394 cfg
 
 PACKAGE='libuvc_camera'
diff --git a/libuvc_camera/manifest.xml b/libuvc_camera/manifest.xml
deleted file mode 100644
index 80dd070..0000000
--- a/libuvc_camera/manifest.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<package>
-  <description brief="driver for USB video cameras">
-    This is a ROS driver for USB video cameras (webcams)
-    and other media input devices that support the USB Video Class
-    specification.
-  </description>
-  <author>Ken Tossell</author>
-  <license>BSD</license>
-  <review status="unreviewed" notes=""/>
-  <url>http://ros.org/wiki/libuvc_camera</url>
-  <depend package="roscpp"/>
-  <depend package="camera_info_manager"/>
-  <depend package="driver_base"/>
-  <depend package="dynamic_reconfigure"/>
-  <depend package="image_transport"/>
-  <depend package="nodelet"/>
-  <depend package="sensor_msgs"/>
-  <depend package="libuvc"/>
-  <export>
-    <nodelet plugin="${prefix}/libuvc_camera_nodelet.xml"/>
-  </export>
-</package>
-
-
diff --git a/stack.xml b/stack.xml
deleted file mode 100644
index 7564555..0000000
--- a/stack.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<stack>
-  <description brief="driver for USB cameras">
-    This stack contains a driver for USB video cameras
-    that implement the USB Video Class specification.
-  </description>
-  <author>Maintained by Ken Tossell</author>
-  <license>BSD</license>  
-  <review status="unreviewed" notes=""/>
-  <url>http://ros.org/wiki/libuvc_ros</url>
-  <depend stack="common_msgs" /> <!-- sensor_msgs -->
-  <depend stack="driver_common" /> <!-- dynamic_reconfigure, driver_base -->
-  <depend stack="image_common" /> <!-- camera_info_manager, image_transport -->
-  <depend stack="ros" />
-  <depend stack="ros_comm" /> <!-- roscpp -->
-
-</stack>
-- 
GitLab