Skip to content

Commit

Permalink
Merge remote-tracking branch 'autobuild/master' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
doudou committed Sep 10, 2013
2 parents 8c4077c + 4359266 commit df5c8b1
Show file tree
Hide file tree
Showing 67 changed files with 933 additions and 671 deletions.
40 changes: 3 additions & 37 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ LIST( GET RTT_VERSIONS 0 RTT_VERSION_MAJOR)
LIST( GET RTT_VERSIONS 1 RTT_VERSION_MINOR)
LIST( GET RTT_VERSIONS 2 RTT_VERSION_PATCH)

SET(ROS_ROOT $ENV{ROS_ROOT})

MESSAGE( "Orocos RTT version ${VERSION} (${RTT_VERSION_MAJOR}.${RTT_VERSION_MINOR}.${RTT_VERSION_PATCH})" )

SET( PROJ_SOURCE_DIR ${orocos-rtt_SOURCE_DIR} )
Expand Down Expand Up @@ -52,41 +50,9 @@ IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
ENDIF(MSVC)
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)

# We force it in case of ROS builds because the UseOrocos.cmake scripts will always look
# in this path, also during an autoproj/bootstrap build.
IF(ROS_ROOT)
SET(CMAKE_INSTALL_PREFIX
${PROJECT_SOURCE_DIR}/../install CACHE PATH "Orocos install prefix for ROS builds" FORCE
)
# Necessary when building Debian packages:
set(ROS_STACK_DIR_FINAL $ENV{ROS_STACK_DIR_FINAL})
if (ROS_STACK_DIR_FINAL)
set(DEFAULT_PLUGIN_PATH "${ROS_STACK_DIR_FINAL}/orocos_toolchain/install/lib/orocos")
endif(ROS_STACK_DIR_FINAL)
# Necessary for backwards compatibility such that packages find RTT's cmake macros:
if (NOT IS_SYMLINK ${CMAKE_CURRENT_SOURCE_DIR}/install )
# Note: we use WORKING_DIRECTORY
execute_process (
COMMAND ${CMAKE_COMMAND} -E remove_directory install
COMMAND ${CMAKE_COMMAND} -E create_symlink ../install install
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_QUIET ERROR_QUIET
)
endif()
# We had to split the if statement above in two parts because cmake 2.8.0 would choke on a single-liner:
if ( NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/install )
# Note: we use WORKING_DIRECTORY
execute_process (
COMMAND ${CMAKE_COMMAND} -E create_symlink ../install install
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_QUIET ERROR_QUIET
)
endif()

# Tell deployer to use ROSlib support.
set(ROSLIB_SUPPORT TRUE)
include(config/FindRoslib.cmake)
ENDIF(ROS_ROOT)
# Tell deployer to use ROSlib support.
set(ROSLIB_SUPPORT TRUE)
include(config/FindRoslib.cmake)

#Use these variables to store build-local flags.
#They are used when the targets are configured.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ifdef ROS_ROOT
EXTRA_CMAKE_FLAGS=-DENABLE_CORBA=ON -DCORBA_IMPLEMENTATION=OMNIORB
EXTRA_CMAKE_FLAGS=-DENABLE_CORBA=ON -DCORBA_IMPLEMENTATION=OMNIORB -DCMAKE_INSTALL_PREFIX=$(shell rospack find rtt)/../install
default: install_rtt
include $(shell rospack find mk)/cmake.mk
install_rtt: all
Expand Down
92 changes: 78 additions & 14 deletions UseOROCOS-RTT-helpers.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,55 @@

#
# Parses arguments or options
#
# From: http://www.cmake.org/Wiki/CMakeMacroParseArguments
#
# For each item in options, PARSE_ARGUMENTS will create a variable
# with that name, prefixed with prefix_. So, for example, if prefix is
# MY_MACRO and options is OPTION1;OPTION2, then PARSE_ARGUMENTS will
# create the variables MY_MACRO_OPTION1 and MY_MACRO_OPTION2. These
# variables will be set to true if the option exists in the command
# line or false otherwise.
#
# For each item in arg_names, PARSE_ARGUMENTS will create a variable
# with that name, prefixed with prefix_. Each variable will be filled
# with the arguments that occur after the given arg_name is encountered
# up to the next arg_name or the end of the arguments. All options are
# removed from these lists. PARSE_ARGUMENTS also creates a
# prefix_DEFAULT_ARGS variable containing the list of all arguments up
# to the first arg_name encountered.
#
MACRO(ORO_PARSE_ARGUMENTS prefix arg_names option_names)
SET(DEFAULT_ARGS)
FOREACH(arg_name ${arg_names})
SET(${prefix}_${arg_name})
ENDFOREACH(arg_name)
FOREACH(option ${option_names})
SET(${prefix}_${option} FALSE)
ENDFOREACH(option)

SET(current_arg_name DEFAULT_ARGS)
SET(current_arg_list)
FOREACH(arg ${ARGN})
SET(larg_names ${arg_names})
LIST(FIND larg_names "${arg}" is_arg_name)
IF (is_arg_name GREATER -1)
SET(${prefix}_${current_arg_name} ${current_arg_list})
SET(current_arg_name ${arg})
SET(current_arg_list)
ELSE (is_arg_name GREATER -1)
SET(loption_names ${option_names})
LIST(FIND loption_names "${arg}" is_option)
IF (is_option GREATER -1)
SET(${prefix}_${arg} TRUE)
ELSE (is_option GREATER -1)
SET(current_arg_list ${current_arg_list} ${arg})
ENDIF (is_option GREATER -1)
ENDIF (is_arg_name GREATER -1)
ENDFOREACH(arg)
SET(${prefix}_${current_arg_name} ${current_arg_list})
ENDMACRO(ORO_PARSE_ARGUMENTS)

#
# Parses the manifest.xml file and stores the dependencies in RESULT.
# Relies on xpath. If no manifest is found, returns an empty RESULT.
Expand Down Expand Up @@ -28,16 +80,16 @@ function( orocos_get_manifest_deps RESULT)
string(REGEX REPLACE "${REGEX_STR}" "\\1;" RR_RESULT ${DEPS})

#message("Deps are: '${DEPS}'")
#message("Dependencies are: '${RR_RESULT}'")
set(${RESULT} ${RR_RESULT})
set(${RESULT} ${RR_RESULT} PARENT_SCOPE)
#message("Dependencies are: '${${RESULT}}'")
endif (NOT XPATH_EXE)

endfunction( orocos_get_manifest_deps RESULT)

#
# Find a package, pick up its include dirs and link with its libraries.
# It does this by locating and reading the .pc file generated by that package.
# In case no such .pc file exists (or is not found), tt is assumed that no
# In case no such .pc file exists (or is not found), it is assumed that no
# flags are necessary.
#
# This macro is called for you by UseOrocos-RTT.cmake
Expand All @@ -58,9 +110,8 @@ endfunction( orocos_get_manifest_deps RESULT)
# Usage: orocos_use_package( myrobot )
#
macro( orocos_use_package PACKAGE )
if (PACKAGE STREQUAL "rtt")
return()
endif (PACKAGE STREQUAL "rtt")
if ( "${PACKAGE}" STREQUAL "rtt")
else()
if (IS_ROS_PACKAGE)
if (NOT USE_FOUND_${PACKAGE}_PACKAGE_PATH)
# use rospack to find package directories of *all* dependencies.
Expand Down Expand Up @@ -101,24 +152,39 @@ macro( orocos_use_package PACKAGE )
# Use find_libraries to find each library:
unset(${PACKAGE}_LIBRARIES CACHE)
foreach(COMP_LIB ${${PACKAGE}_COMP_${OROCOS_TARGET}_LIBRARIES})
find_library(${PACKAGE}_${COMP_LIB}_LIBRARY NAMES ${COMP_LIB} HINTS ${${PACKAGE}_COMP_${OROCOS_TARGET}_LIBRARY_DIRS})
# Two options: COMP_LIB is an absolute path-to-lib (must start with ':') or just a libname:
if ( ${COMP_LIB} MATCHES "^:(.+)" OR EXISTS ${COMP_LIB})
if (EXISTS "${CMAKE_MATCH_1}" )
# absolute path (shared lib):
set( ${PACKAGE}_${COMP_LIB}_LIBRARY "${CMAKE_MATCH_1}" )
endif()
if (EXISTS "${COMP_LIB}" )
# absolute path (static lib):
set( ${PACKAGE}_${COMP_LIB}_LIBRARY "${COMP_LIB}" )
endif()
else()
# libname:
find_library(${PACKAGE}_${COMP_LIB}_LIBRARY NAMES ${COMP_LIB} HINTS ${${PACKAGE}_COMP_${OROCOS_TARGET}_LIBRARY_DIRS})
endif()
if(${PACKAGE}_${COMP_LIB}_LIBRARY)
else(${PACKAGE}_${COMP_LIB}_LIBRARY)
message(SEND_ERROR "In package >>>${PACKAGE}<<< : could not find library ${COMP_LIB} in directory ${${PACKAGE}_COMP_${OROCOS_TARGET}_LIBRARY_DIRS}, although its .pc file says it should be there.\n\n Try to do 'make clean; rm -rf lib' and then 'make' in the package >>>${PACKAGE}<<<.\n\n")
endif(${PACKAGE}_${COMP_LIB}_LIBRARY)
list(APPEND ${PACKAGE}_LIBRARIES ${${PACKAGE}_${COMP_LIB}_LIBRARY})
list(APPEND ${PACKAGE}_LIBRARIES "${${PACKAGE}_${COMP_LIB}_LIBRARY}")
endforeach(COMP_LIB ${${PACKAGE}_COMP_${OROCOS_TARGET}_LIBRARIES})

# Add some output variables to the cache to make them accessible from outside this scope
set(${PACKAGE}_INCLUDE_DIRS ${${PACKAGE}_COMP_${OROCOS_TARGET}_INCLUDE_DIRS} CACHE INTERNAL "")
set(${PACKAGE}_LIBRARY_DIRS ${${PACKAGE}_COMP_${OROCOS_TARGET}_LIBRARY_DIRS} CACHE INTERNAL "")
set(${PACKAGE}_LIBRARIES ${${PACKAGE}_LIBRARIES} CACHE INTERNAL "")
set(${PACKAGE}_INCLUDE_DIRS "${${PACKAGE}_COMP_${OROCOS_TARGET}_INCLUDE_DIRS}" CACHE INTERNAL "")
set(${PACKAGE}_LIBRARY_DIRS "${${PACKAGE}_COMP_${OROCOS_TARGET}_LIBRARY_DIRS}" CACHE INTERNAL "")
set(${PACKAGE}_LIBRARIES "${${PACKAGE}_LIBRARIES}" CACHE INTERNAL "")
# The flags are space separated, so no need to quote here:
set(${PACKAGE}_CFLAGS_OTHER ${${PACKAGE}_COMP_${OROCOS_TARGET}_CFLAGS_OTHER} CACHE INTERNAL "")
set(${PACKAGE}_LDFLAGS_OTHER ${${PACKAGE}_COMP_${OROCOS_TARGET}_LDFLAGS_OTHER} CACHE INTERNAL "")

# Add compiler and linker flags to the USE_OROCOS_XXX_FLAGS variables used in the orocos_add_x macros
set(USE_OROCOS_COMPILE_FLAGS ${USE_OROCOS_COMPILE_FLAGS} ${${PACKAGE}_COMP_${OROCOS_TARGET}_CFLAGS_OTHER})
set(USE_OROCOS_LINK_FLAGS ${USE_OROCOS_LINK_FLAGS} ${${PACKAGE}_COMP_${OROCOS_TARGET}_LDFLAGS_OTHER})
# This probably does not work since lists are ';' separated and not ' ' separated:
list(REMOVE_DUPLICATES USE_OROCOS_COMPILE_FLAGS)
list(REMOVE_DUPLICATES USE_OROCOS_LINK_FLAGS)

Expand All @@ -130,11 +196,9 @@ macro( orocos_use_package PACKAGE )
endif (NOT OROCOS_NO_AUTO_LINKING AND ${PACKAGE}_COMP_${OROCOS_TARGET}_LIBRARIES)

else (${PACKAGE}_COMP_${OROCOS_TARGET}_FOUND)
if (VERBOSE)
message("[UseOrocos] ${PACKAGE} does not provide a .pc file for exporting its build/link flags (or one of it 'Requires' dependencies was not found).")
endif (VERBOSE)
endif (${PACKAGE}_COMP_${OROCOS_TARGET}_FOUND)

endif()
endmacro( orocos_use_package PACKAGE )

macro(_orocos_list_to_string _string _list)
Expand Down
Loading

0 comments on commit df5c8b1

Please sign in to comment.