Skip to content

Commit

Permalink
hybrid rosbuild/catkin buildsystem
Browse files Browse the repository at this point in the history
  • Loading branch information
jbohren committed Mar 7, 2013
1 parent 7062380 commit d1da69a
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 35 deletions.
84 changes: 50 additions & 34 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,34 +1,50 @@
cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

# 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)

rosbuild_init()

#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)

#uncomment if you have defined messages
#rosbuild_genmsg()
#uncomment if you have defined services
#rosbuild_gensrv()

#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})

include_directories(/usr/include/gstreamer-0.10 /usr/include/glib-2.0 /usr/lib/glib-2.0/include /usr/lib/i386-linux-gnu/glib-2.0/include /usr/lib/x86_64-linux-gnu/glib-2.0/include /usr/include/libxml2)
rosbuild_add_executable(gscam src/gscam.cpp)
target_link_libraries(gscam gstreamer-0.10 gstbase-0.10 gobject-2.0 gmodule-2.0 gthread-2.0 rt xml2 glib-2.0 gstapp-0.10 pthread)
cmake_minimum_required(VERSION 2.8.3)

# 3rd-party Dependencies
find_package(PkgConfig)
pkg_check_modules(LIBXML2 REQUIRED libxml-2.0)
pkg_check_modules(GSTREAMER REQUIRED gstreamer-0.10)
pkg_check_modules(GLIB REQUIRED glib-2.0)


if(USE_ROSBUILD)
# Use rosbuild
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

rosbuild_init()

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

include_directories(${GLIB_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${GSTREAMER_INCLUDE_DIRS})
rosbuild_add_executable(gscam src/gscam.cpp)
target_link_libraries(gscam
gstreamer-0.10 gstbase-0.10
gobject-2.0 gmodule-2.0 gthread-2.0
rt xml2 glib-2.0 gstapp-0.10
pthread)
else()
# Use Catkin
project(gscam)

find_package(catkin REQUIRED
COMPONENTS roscpp image_transport sensor_msgs camera_calibration_parsers opencv)

catkin_package(
INCLUDE_DIRS include
#LIBRARIES ${PROJECT_NAME}
CATKIN_DEPENDS roscpp image_transport sensor_msgs camera_calibration_parsers opencv
#DEPENDS opencv
)

include_directories(${catkin_INCLUDE_DIRS} ${GLIB_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${GSTREAMER_INCLUDE_DIRS})
add_executable(gscam src/gscam.cpp)
target_link_libraries(gscam
${catkin_LIBRARIES}
gstreamer-0.10 gstbase-0.10
gobject-2.0 gmodule-2.0 gthread-2.0
rt xml2 glib-2.0 gstapp-0.10
pthread)

endif()

3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
include $(shell rospack find mk)/cmake.mk
EXTRA_CMAKE_FLAGS = -DUSE_ROSBUILD:BOOL=1
include $(shell rospack find mk)/cmake.mk
22 changes: 22 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<package>
<name>gscam</name>
<version>0.1.0</version>
<description>
A ROS camera driver that uses gstreamer to connect to
devices such as webcams.
</description>
<maintainer email="[email protected]">Jonathan Bohren</maintainer>
<license>BSD</license>

<author email="[email protected]">Graylin Trevor Jay</author>
<author email="[email protected]">Christopher Crick</author>

<build_depend>libgstreamer0.10-dev</build_depend>
<build_depend>libgstreamer-plugins-base0.10-dev</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>image_transport</build_depend>
<build_depend>sensor_msgs</build_depend>
<build_depend>camera_calibration_parsers</build_depend>

</package>

0 comments on commit d1da69a

Please sign in to comment.