[rosmake] how to configure your own packages [closed]
Many packages I download in source form are able to be built via a simple
$rosmake <package>
This seems to imply the build system for those packages is already configured. My packages on the contrary need to expressly launch cmake first otherwise there is no makefile. The generated makefile then is not portable in that cmake creates machine specific paths.
So how do I make my packages portable like the others? I want my packages to "just work" once downloaded.
I should also note that I've moved to a stack and that packages within are correctly built in the right dependency sequence, but if there is no makefile already, rosmake would fail.
Rosmake appears unable to generate the Makefile from CMakeLists.txt by itself requiring an explicit cmake before.
I've been requested to post the code, I guess that's the CMakeLists code. Here it is
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(coverage RelWithDebInfo)
set(CMAKE_CXX_FLAGS "-std=c++0x")
rosbuild_init()
rosbuild_find_ros_package(saetta_msgs REQUIRED)
rosbuild_add_boost_directories()
find_package(PkgConfig REQUIRED)
pkg_check_modules(OpenCV REQUIRED opencv)
pkg_check_modules(gtk+ REQUIRED gtk+-2.0)
#set paths
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
set(PATH_SRC ${PROJECT_SOURCE_DIR}/src)
set(PATH_CVBLOBS ${PATH_SRC}/cvblobs8.3_linux)
set(PATH_INC ${PROJECT_SOURCE_DIR}/include)
set(INCLUDE_PATHS ${PATH_INC} ${PATH_CVBLOBS} ${OpenCV_CFLAGS} ${gtk+_CFLAGS})
link_directories(${LIBRARY_OUTPUT_PATH})
# Set the directories where include files can be found.
include_directories (include)
include_directories (${INCLUDE_PATHS})
include_directories (${gtk+_INCLUDE_DIRS})
include_directories (${OpenCV_INCLUDE_DIRS})
include_directories (${saetta_msgs_PACKAGE_PATH}/msg_gen/cpp/include)
# Add dynamic reconfigure API.
#rosbuild_find_ros_package (dynamic_reconfigure)
#include (${dynamic_reconfigure_PACKAGE_PATH}/cmake/cfgbuild.cmake)
#gencfg ()
#common commands for building c++ executables and libraries
rosbuild_add_library(vision ${PATH_SRC}/Vision.cpp)
# add imported target
add_library(blobs STATIC IMPORTED)
# point the imported target at the real file
set_property(TARGET blobs PROPERTY IMPORTED_LOCATION ${PATH_CVBLOBS}/libblob.a)
target_link_libraries(vision ${OpenCV_LIBRARIES} ${PATH_CVBLOBS}/libblob.a)
rosbuild_add_executable(vispos ${PATH_SRC}/main.cpp)
target_link_libraries(vispos vision)
rosbuild_link_boost(vispos system)
And here is the Manifest
<package>
<description brief="saetta_vision">
Saetta vision </description>
<author>Claudio Carbone</author>
<license>BSD</license>
<review status="unreviewed" notes=""/>
<url></url>
<depend package="rospy"/>
<depend package="roscpp"/>
<rosdep name="OpenCV 2.4.0"/>
<depend package="saetta_msgs" />
</package>
Here is the build command
me@mycomputer:~/Apps/ROS/Saetta/saetta_vision$ rosmake Saetta
[ rosmake ] rosmake starting...
[ rosmake ] Packages requested are: ['Saetta']
[ rosmake ] Logging to directory /home/me/.ros/rosmake/rosmake_output-20130220-113614
[ rosmake ] Expanded args ['Saetta'] to:
['saetta_base', 'saetta_vision', 'saetta_msgs']
[...]
[rosmake-1] Finished <<< saetta_msgs [PASS] [ 0.25 seconds ]
[rosmake-1] Starting >>> saetta_base [ make ]
[rosmake-0] Starting >>> saetta_vision [ make ]
[rosmake-0] Finished <<< saetta_vision No Makefile in package saetta_vision
[...]