commit
c429f2e18c
9 changed files with 54 additions and 289 deletions
|
@ -6,7 +6,6 @@ find_package(ament_cmake REQUIRED)
|
||||||
find_package(rcl_interfaces REQUIRED)
|
find_package(rcl_interfaces REQUIRED)
|
||||||
find_package(rmw REQUIRED)
|
find_package(rmw REQUIRED)
|
||||||
find_package(rmw_implementation REQUIRED)
|
find_package(rmw_implementation REQUIRED)
|
||||||
find_package(rmw_implementation_cmake REQUIRED)
|
|
||||||
find_package(rosidl_generator_c REQUIRED)
|
find_package(rosidl_generator_c REQUIRED)
|
||||||
|
|
||||||
include_directories(include)
|
include_directories(include)
|
||||||
|
@ -33,33 +32,29 @@ set(${PROJECT_NAME}_sources
|
||||||
src/rcl/wait.c
|
src/rcl/wait.c
|
||||||
)
|
)
|
||||||
|
|
||||||
macro(target)
|
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_sources})
|
||||||
add_library(${PROJECT_NAME}${target_suffix} SHARED ${${PROJECT_NAME}_sources})
|
ament_target_dependencies(${PROJECT_NAME}
|
||||||
ament_target_dependencies(${PROJECT_NAME}${target_suffix}
|
|
||||||
"rcl_interfaces"
|
"rcl_interfaces"
|
||||||
"rmw"
|
"rmw"
|
||||||
|
"rmw_implementation"
|
||||||
"rosidl_generator_c"
|
"rosidl_generator_c"
|
||||||
"${rmw_implementation}"
|
)
|
||||||
)
|
|
||||||
|
|
||||||
# Causes the visibility macros to use dllexport rather than dllimport,
|
# Causes the visibility macros to use dllexport rather than dllimport,
|
||||||
# which is appropriate when building the dll but not consuming it.
|
# which is appropriate when building the dll but not consuming it.
|
||||||
target_compile_definitions(${PROJECT_NAME}${target_suffix} PRIVATE "RCL_BUILDING_DLL")
|
target_compile_definitions(${PROJECT_NAME} PRIVATE "RCL_BUILDING_DLL")
|
||||||
|
|
||||||
install(
|
install(
|
||||||
TARGETS ${PROJECT_NAME}${target_suffix}
|
TARGETS ${PROJECT_NAME}
|
||||||
ARCHIVE DESTINATION lib
|
ARCHIVE DESTINATION lib
|
||||||
LIBRARY DESTINATION lib
|
LIBRARY DESTINATION lib
|
||||||
RUNTIME DESTINATION bin)
|
RUNTIME DESTINATION bin)
|
||||||
|
|
||||||
# rcl_lib_dir is passed as APPEND_LIBRARY_DIRS for each ament_add_gtest call so
|
# rcl_lib_dir is passed as APPEND_LIBRARY_DIRS for each ament_add_gtest call so
|
||||||
# the librcl that they link against is on the library path.
|
# the librcl that they link against is on the library path.
|
||||||
# This is especially important on Windows.
|
# This is especially important on Windows.
|
||||||
# This is overwritten each loop, but which one it points to doesn't really matter.
|
# This is overwritten each loop, but which one it points to doesn't really matter.
|
||||||
set(rcl_lib_dir "$<TARGET_FILE_DIR:${PROJECT_NAME}${target_suffix}>")
|
set(rcl_lib_dir "$<TARGET_FILE_DIR:${PROJECT_NAME}>")
|
||||||
endmacro()
|
|
||||||
|
|
||||||
call_for_each_rmw_implementation(target GENERATE_DEFAULT)
|
|
||||||
|
|
||||||
ament_export_dependencies(ament_cmake)
|
ament_export_dependencies(ament_cmake)
|
||||||
ament_export_dependencies(rcl_interfaces)
|
ament_export_dependencies(rcl_interfaces)
|
||||||
|
@ -78,14 +73,7 @@ if(BUILD_TESTING)
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
ament_package(
|
ament_package()
|
||||||
CONFIG_EXTRAS rcl-extras.cmake
|
|
||||||
)
|
|
||||||
|
|
||||||
install(
|
|
||||||
DIRECTORY cmake
|
|
||||||
DESTINATION share/${PROJECT_NAME}
|
|
||||||
)
|
|
||||||
|
|
||||||
install(
|
install(
|
||||||
DIRECTORY include/
|
DIRECTORY include/
|
||||||
|
|
|
@ -1,90 +0,0 @@
|
||||||
# Copyright 2016 Open Source Robotics Foundation, Inc.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
#
|
|
||||||
# Get all information about rcl for a specific RMW implementation.
|
|
||||||
#
|
|
||||||
# It sets the common variables _DEFINITIONS, _INCLUDE_DIRS and _LIBRARIES
|
|
||||||
# with the given prefix.
|
|
||||||
#
|
|
||||||
# :param rmw_implementation: the RMW implementation name
|
|
||||||
# :type target: string
|
|
||||||
# :param var_prefix: the prefix of all output variable names
|
|
||||||
# :type var_prefix: string
|
|
||||||
#
|
|
||||||
# Copy/pasted from rclcpp/cmake/get_rclcpp_information.cmake.
|
|
||||||
# Code duplication is evil. Don't do this at home, kids.
|
|
||||||
|
|
||||||
macro(get_rcl_information rmw_implementation var_prefix)
|
|
||||||
# pretend to be a "package"
|
|
||||||
# so that the variables can be used by various functions / macros
|
|
||||||
set(${var_prefix}_FOUND TRUE)
|
|
||||||
|
|
||||||
# include directories
|
|
||||||
normalize_path(${var_prefix}_INCLUDE_DIRS "${rcl_DIR}/../../../include")
|
|
||||||
|
|
||||||
# libraries
|
|
||||||
set(_libs)
|
|
||||||
# search for library relative to this CMake file
|
|
||||||
set(_library_target "rcl")
|
|
||||||
get_available_rmw_implementations(_rmw_impls)
|
|
||||||
list(LENGTH _rmw_impls _rmw_impls_length)
|
|
||||||
if(_rmw_impls_length GREATER 1)
|
|
||||||
set(_library_target "${_library_target}__${rmw_implementation}")
|
|
||||||
endif()
|
|
||||||
set(_lib "NOTFOUND")
|
|
||||||
find_library(
|
|
||||||
_lib NAMES "${_library_target}"
|
|
||||||
PATHS "${rcl_DIR}/../../../lib"
|
|
||||||
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
|
|
||||||
)
|
|
||||||
if(NOT _lib)
|
|
||||||
# warn about not existing library and ignore it
|
|
||||||
message(WARNING "Package 'rcl' doesn't contain the library '${_library_target}'")
|
|
||||||
elseif(NOT IS_ABSOLUTE "${_lib}")
|
|
||||||
# the found library must be an absolute path
|
|
||||||
message(FATAL_ERROR "Package 'rcl' found the library '${_library_target}' at '${_lib}' which is not an absolute path")
|
|
||||||
elseif(NOT EXISTS "${_lib}")
|
|
||||||
# the found library must exist
|
|
||||||
message(FATAL_ERROR "Package 'rcl' found the library '${_lib}' which doesn't exist")
|
|
||||||
else()
|
|
||||||
list(APPEND _libs "${_lib}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# dependencies
|
|
||||||
set(_exported_dependencies
|
|
||||||
"rcl_interfaces"
|
|
||||||
"rmw"
|
|
||||||
"${rmw_implementation}"
|
|
||||||
"rosidl_generator_c")
|
|
||||||
set(${var_prefix}_DEFINITIONS)
|
|
||||||
foreach(_dep ${_exported_dependencies})
|
|
||||||
if(NOT ${_dep}_FOUND)
|
|
||||||
find_package("${_dep}" QUIET REQUIRED)
|
|
||||||
endif()
|
|
||||||
if(${_dep}_DEFINITIONS)
|
|
||||||
list_append_unique(${var_prefix}_DEFINITIONS "${${_dep}_DEFINITIONS}")
|
|
||||||
endif()
|
|
||||||
if(${_dep}_INCLUDE_DIRS)
|
|
||||||
list_append_unique(${var_prefix}_INCLUDE_DIRS "${${_dep}_INCLUDE_DIRS}")
|
|
||||||
endif()
|
|
||||||
if(${_dep}_LIBRARIES)
|
|
||||||
list(APPEND _libs "${${_dep}_LIBRARIES}")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
if(_libs)
|
|
||||||
ament_libraries_deduplicate(_libs "${_libs}")
|
|
||||||
endif()
|
|
||||||
set(${var_prefix}_LIBRARIES "${_libs}")
|
|
||||||
endmacro()
|
|
|
@ -14,7 +14,6 @@
|
||||||
<build_export_depend>rmw</build_export_depend>
|
<build_export_depend>rmw</build_export_depend>
|
||||||
|
|
||||||
<build_depend>rcl_interfaces</build_depend>
|
<build_depend>rcl_interfaces</build_depend>
|
||||||
<build_depend>rmw_implementation_cmake</build_depend>
|
|
||||||
<build_depend>rosidl_generator_c</build_depend>
|
<build_depend>rosidl_generator_c</build_depend>
|
||||||
<build_export_depend>rcl_interfaces</build_export_depend>
|
<build_export_depend>rcl_interfaces</build_export_depend>
|
||||||
<build_export_depend>rosidl_generator_c</build_export_depend>
|
<build_export_depend>rosidl_generator_c</build_export_depend>
|
||||||
|
@ -29,6 +28,7 @@
|
||||||
<test_depend>ament_lint_auto</test_depend>
|
<test_depend>ament_lint_auto</test_depend>
|
||||||
<test_depend>ament_lint_common</test_depend>
|
<test_depend>ament_lint_common</test_depend>
|
||||||
<test_depend>rmw</test_depend>
|
<test_depend>rmw</test_depend>
|
||||||
|
<test_depend>rmw_implementation_cmake</test_depend>
|
||||||
<test_depend>launch</test_depend>
|
<test_depend>launch</test_depend>
|
||||||
<test_depend>example_interfaces</test_depend>
|
<test_depend>example_interfaces</test_depend>
|
||||||
<test_depend>std_msgs</test_depend>
|
<test_depend>std_msgs</test_depend>
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
# Copyright 2016 Open Source Robotics Foundation, Inc.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
# copied from rcl/rcl-extras.cmake
|
|
||||||
|
|
||||||
include("${rcl_DIR}/get_rcl_information.cmake")
|
|
|
@ -4,6 +4,8 @@ find_package(ament_cmake_nose REQUIRED)
|
||||||
find_package(example_interfaces REQUIRED)
|
find_package(example_interfaces REQUIRED)
|
||||||
find_package(std_msgs REQUIRED)
|
find_package(std_msgs REQUIRED)
|
||||||
|
|
||||||
|
find_package(rmw_implementation_cmake REQUIRED)
|
||||||
|
|
||||||
include(rcl_add_custom_executable.cmake)
|
include(rcl_add_custom_executable.cmake)
|
||||||
include(rcl_add_custom_gtest.cmake)
|
include(rcl_add_custom_gtest.cmake)
|
||||||
include(rcl_add_custom_launch_test.cmake)
|
include(rcl_add_custom_launch_test.cmake)
|
||||||
|
@ -22,6 +24,7 @@ endmacro()
|
||||||
|
|
||||||
function(test_target_function)
|
function(test_target_function)
|
||||||
message(STATUS "Creating tests for '${rmw_implementation}'")
|
message(STATUS "Creating tests for '${rmw_implementation}'")
|
||||||
|
list(APPEND extra_test_env RMW_IMPLEMENTATION=${rmw_implementation})
|
||||||
|
|
||||||
# Gtests
|
# Gtests
|
||||||
|
|
||||||
|
@ -29,7 +32,7 @@ function(test_target_function)
|
||||||
SRCS rcl/test_allocator.cpp
|
SRCS rcl/test_allocator.cpp
|
||||||
ENV ${extra_test_env}
|
ENV ${extra_test_env}
|
||||||
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
|
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
|
||||||
LIBRARIES ${PROJECT_NAME}${target_suffix} ${extra_test_libraries}
|
LIBRARIES ${PROJECT_NAME} ${extra_test_libraries}
|
||||||
AMENT_DEPENDENCIES ${rmw_implementation}
|
AMENT_DEPENDENCIES ${rmw_implementation}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -37,7 +40,7 @@ function(test_target_function)
|
||||||
SRCS rcl/test_client.cpp
|
SRCS rcl/test_client.cpp
|
||||||
ENV ${extra_test_env}
|
ENV ${extra_test_env}
|
||||||
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
|
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
|
||||||
LIBRARIES ${PROJECT_NAME}${target_suffix} ${extra_test_libraries}
|
LIBRARIES ${PROJECT_NAME} ${extra_test_libraries}
|
||||||
AMENT_DEPENDENCIES ${rmw_implementation} "example_interfaces"
|
AMENT_DEPENDENCIES ${rmw_implementation} "example_interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -45,7 +48,7 @@ function(test_target_function)
|
||||||
SRCS rcl/test_time.cpp
|
SRCS rcl/test_time.cpp
|
||||||
ENV ${extra_test_env}
|
ENV ${extra_test_env}
|
||||||
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
|
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
|
||||||
LIBRARIES ${PROJECT_NAME}${target_suffix} ${extra_test_libraries}
|
LIBRARIES ${PROJECT_NAME} ${extra_test_libraries}
|
||||||
AMENT_DEPENDENCIES ${rmw_implementation}
|
AMENT_DEPENDENCIES ${rmw_implementation}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -56,7 +59,7 @@ function(test_target_function)
|
||||||
EMPTY_TEST=
|
EMPTY_TEST=
|
||||||
NORMAL_TEST=foo
|
NORMAL_TEST=foo
|
||||||
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
|
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
|
||||||
LIBRARIES ${PROJECT_NAME}${target_suffix} ${extra_test_libraries}
|
LIBRARIES ${PROJECT_NAME} ${extra_test_libraries}
|
||||||
AMENT_DEPENDENCIES ${rmw_implementation}
|
AMENT_DEPENDENCIES ${rmw_implementation}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -73,7 +76,7 @@ function(test_target_function)
|
||||||
SRCS rcl/test_graph.cpp
|
SRCS rcl/test_graph.cpp
|
||||||
ENV ${extra_test_env}
|
ENV ${extra_test_env}
|
||||||
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
|
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
|
||||||
LIBRARIES ${PROJECT_NAME}${target_suffix} ${extra_test_libraries}
|
LIBRARIES ${PROJECT_NAME} ${extra_test_libraries}
|
||||||
AMENT_DEPENDENCIES ${rmw_implementation} "example_interfaces" "std_msgs"
|
AMENT_DEPENDENCIES ${rmw_implementation} "example_interfaces" "std_msgs"
|
||||||
${SKIP_TEST}
|
${SKIP_TEST}
|
||||||
)
|
)
|
||||||
|
@ -82,7 +85,7 @@ function(test_target_function)
|
||||||
SRCS rcl/test_rcl.cpp
|
SRCS rcl/test_rcl.cpp
|
||||||
ENV ${extra_test_env}
|
ENV ${extra_test_env}
|
||||||
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
|
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
|
||||||
LIBRARIES ${PROJECT_NAME}${target_suffix} ${extra_test_libraries}
|
LIBRARIES ${PROJECT_NAME} ${extra_test_libraries}
|
||||||
AMENT_DEPENDENCIES ${rmw_implementation}
|
AMENT_DEPENDENCIES ${rmw_implementation}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -90,7 +93,7 @@ function(test_target_function)
|
||||||
SRCS rcl/test_node.cpp
|
SRCS rcl/test_node.cpp
|
||||||
ENV ${extra_test_env}
|
ENV ${extra_test_env}
|
||||||
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
|
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
|
||||||
LIBRARIES ${PROJECT_NAME}${target_suffix} ${extra_test_libraries}
|
LIBRARIES ${PROJECT_NAME} ${extra_test_libraries}
|
||||||
AMENT_DEPENDENCIES ${rmw_implementation}
|
AMENT_DEPENDENCIES ${rmw_implementation}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -98,7 +101,7 @@ function(test_target_function)
|
||||||
SRCS rcl/test_publisher.cpp
|
SRCS rcl/test_publisher.cpp
|
||||||
ENV ${extra_test_env}
|
ENV ${extra_test_env}
|
||||||
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
|
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
|
||||||
LIBRARIES ${PROJECT_NAME}${target_suffix} ${extra_test_libraries}
|
LIBRARIES ${PROJECT_NAME} ${extra_test_libraries}
|
||||||
AMENT_DEPENDENCIES ${rmw_implementation} "std_msgs"
|
AMENT_DEPENDENCIES ${rmw_implementation} "std_msgs"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -106,7 +109,7 @@ function(test_target_function)
|
||||||
SRCS rcl/test_service.cpp
|
SRCS rcl/test_service.cpp
|
||||||
ENV ${extra_test_env}
|
ENV ${extra_test_env}
|
||||||
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
|
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
|
||||||
LIBRARIES ${PROJECT_NAME}${target_suffix} ${extra_test_libraries}
|
LIBRARIES ${PROJECT_NAME} ${extra_test_libraries}
|
||||||
AMENT_DEPENDENCIES ${rmw_implementation} "example_interfaces"
|
AMENT_DEPENDENCIES ${rmw_implementation} "example_interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -114,7 +117,7 @@ function(test_target_function)
|
||||||
SRCS rcl/test_subscription.cpp
|
SRCS rcl/test_subscription.cpp
|
||||||
ENV ${extra_test_env}
|
ENV ${extra_test_env}
|
||||||
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
|
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
|
||||||
LIBRARIES ${PROJECT_NAME}${target_suffix} ${extra_test_libraries}
|
LIBRARIES ${PROJECT_NAME} ${extra_test_libraries}
|
||||||
AMENT_DEPENDENCIES ${rmw_implementation} "std_msgs"
|
AMENT_DEPENDENCIES ${rmw_implementation} "std_msgs"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -122,7 +125,7 @@ function(test_target_function)
|
||||||
SRCS rcl/test_wait.cpp
|
SRCS rcl/test_wait.cpp
|
||||||
ENV ${extra_test_env}
|
ENV ${extra_test_env}
|
||||||
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
|
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
|
||||||
LIBRARIES ${PROJECT_NAME}${target_suffix} ${extra_test_libraries}
|
LIBRARIES ${PROJECT_NAME} ${extra_test_libraries}
|
||||||
AMENT_DEPENDENCIES ${rmw_implementation}
|
AMENT_DEPENDENCIES ${rmw_implementation}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -130,13 +133,13 @@ function(test_target_function)
|
||||||
|
|
||||||
rcl_add_custom_executable(service_fixture${target_suffix}
|
rcl_add_custom_executable(service_fixture${target_suffix}
|
||||||
SRCS rcl/service_fixture.cpp
|
SRCS rcl/service_fixture.cpp
|
||||||
LIBRARIES ${PROJECT_NAME}${target_suffix} ${extra_test_libraries}
|
LIBRARIES ${PROJECT_NAME} ${extra_test_libraries}
|
||||||
AMENT_DEPENDENCIES ${rmw_implementation} "example_interfaces"
|
AMENT_DEPENDENCIES ${rmw_implementation} "example_interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
rcl_add_custom_executable(client_fixture${target_suffix}
|
rcl_add_custom_executable(client_fixture${target_suffix}
|
||||||
SRCS rcl/client_fixture.cpp
|
SRCS rcl/client_fixture.cpp
|
||||||
LIBRARIES ${PROJECT_NAME}${target_suffix} ${extra_test_libraries}
|
LIBRARIES ${PROJECT_NAME} ${extra_test_libraries}
|
||||||
AMENT_DEPENDENCIES ${rmw_implementation} "example_interfaces"
|
AMENT_DEPENDENCIES ${rmw_implementation} "example_interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ project(rcl_lifecycle)
|
||||||
find_package(ament_cmake REQUIRED)
|
find_package(ament_cmake REQUIRED)
|
||||||
find_package(rcl REQUIRED)
|
find_package(rcl REQUIRED)
|
||||||
find_package(rmw REQUIRED)
|
find_package(rmw REQUIRED)
|
||||||
find_package(rmw_implementation_cmake REQUIRED)
|
|
||||||
find_package(lifecycle_msgs REQUIRED)
|
find_package(lifecycle_msgs REQUIRED)
|
||||||
|
|
||||||
include_directories(include)
|
include_directories(include)
|
||||||
|
@ -19,30 +18,24 @@ set_source_files_properties(
|
||||||
${rcl_lifecycle_sources}
|
${rcl_lifecycle_sources}
|
||||||
PROPERTIES language "C")
|
PROPERTIES language "C")
|
||||||
|
|
||||||
macro(targets)
|
### C-Library depending only on RCL
|
||||||
get_rcl_information("${rmw_implementation}" "rcl${target_suffix}")
|
add_library(
|
||||||
|
rcl_lifecycle
|
||||||
### C-Library depending only on RCL
|
|
||||||
add_library(
|
|
||||||
rcl_lifecycle${target_suffix}
|
|
||||||
SHARED
|
SHARED
|
||||||
${rcl_lifecycle_sources})
|
${rcl_lifecycle_sources})
|
||||||
|
|
||||||
ament_target_dependencies(rcl_lifecycle${target_suffix}
|
ament_target_dependencies(rcl_lifecycle
|
||||||
"lifecycle_msgs"
|
"lifecycle_msgs"
|
||||||
"rcl${target_suffix}")
|
"rcl")
|
||||||
|
|
||||||
# Causes the visibility macros to use dllexport rather than dllimport,
|
# Causes the visibility macros to use dllexport rather than dllimport,
|
||||||
# which is appropriate when building the dll but not consuming it.
|
# which is appropriate when building the dll but not consuming it.
|
||||||
target_compile_definitions(rcl_lifecycle${target_suffix} PRIVATE "RCL_LIFECYCLE_BUILDING_DLL")
|
target_compile_definitions(rcl_lifecycle PRIVATE "RCL_LIFECYCLE_BUILDING_DLL")
|
||||||
|
|
||||||
install(TARGETS rcl_lifecycle${target_suffix}
|
install(TARGETS rcl_lifecycle
|
||||||
ARCHIVE DESTINATION lib
|
ARCHIVE DESTINATION lib
|
||||||
LIBRARY DESTINATION lib
|
LIBRARY DESTINATION lib
|
||||||
RUNTIME DESTINATION bin)
|
RUNTIME DESTINATION bin)
|
||||||
endmacro()
|
|
||||||
|
|
||||||
call_for_each_rmw_implementation(targets GENERATE_DEFAULT)
|
|
||||||
|
|
||||||
if(BUILD_TESTING)
|
if(BUILD_TESTING)
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
|
@ -83,12 +76,7 @@ ament_export_dependencies(ament_cmake)
|
||||||
ament_export_dependencies(lifecycle_msgs)
|
ament_export_dependencies(lifecycle_msgs)
|
||||||
ament_export_include_directories(include)
|
ament_export_include_directories(include)
|
||||||
ament_export_libraries(${PROJECT_NAME})
|
ament_export_libraries(${PROJECT_NAME})
|
||||||
ament_package(
|
ament_package()
|
||||||
CONFIG_EXTRAS rcl_lifecycle-extras.cmake)
|
|
||||||
|
|
||||||
install(
|
|
||||||
DIRECTORY cmake
|
|
||||||
DESTINATION share/${PROJECT_NAME})
|
|
||||||
|
|
||||||
install(
|
install(
|
||||||
DIRECTORY include/
|
DIRECTORY include/
|
||||||
|
|
|
@ -1,89 +0,0 @@
|
||||||
# Copyright 2016 Open Source Robotics Foundation, Inc.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
#
|
|
||||||
# Get all information about rcl_lifecycle for a specific RMW implementation.
|
|
||||||
#
|
|
||||||
# It sets the common variables _DEFINITIONS, _INCLUDE_DIRS and _LIBRARIES
|
|
||||||
# with the given prefix.
|
|
||||||
#
|
|
||||||
# :param rmw_implementation: the RMW implementation name
|
|
||||||
# :type target: string
|
|
||||||
# :param var_prefix: the prefix of all output variable names
|
|
||||||
# :type var_prefix: string
|
|
||||||
#
|
|
||||||
# TODO(karsten1987): Copy/pasted from rclcpp/cmake/get_rclcpp_information.cmake.
|
|
||||||
# Code duplication is evil. Don't do this at home, kids.
|
|
||||||
|
|
||||||
macro(get_rcl_lifecycle_information rmw_implementation var_prefix)
|
|
||||||
# pretend to be a "package"
|
|
||||||
# so that the variables can be used by various functions / macros
|
|
||||||
set(${var_prefix}_FOUND TRUE)
|
|
||||||
|
|
||||||
# include directories
|
|
||||||
normalize_path(${var_prefix}_INCLUDE_DIRS "${rcl_lifecycle_DIR}/../../../include")
|
|
||||||
|
|
||||||
# libraries
|
|
||||||
set(_libs)
|
|
||||||
# search for library relative to this CMake file
|
|
||||||
set(_library_target "rcl_lifecycle")
|
|
||||||
get_available_rmw_implementations(_rmw_impls)
|
|
||||||
list(LENGTH _rmw_impls _rmw_impls_length)
|
|
||||||
if(_rmw_impls_length GREATER 1)
|
|
||||||
set(_library_target "${_library_target}__${rmw_implementation}")
|
|
||||||
endif()
|
|
||||||
set(_lib "NOTFOUND")
|
|
||||||
find_library(
|
|
||||||
_lib NAMES "${_library_target}"
|
|
||||||
PATHS "${rcl_lifecycle_DIR}/../../../lib"
|
|
||||||
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
|
|
||||||
)
|
|
||||||
if(NOT _lib)
|
|
||||||
# warn about not existing library and ignore it
|
|
||||||
message(WARNING "Package 'rcl_lifecycle' doesn't contain the library '${_library_target}'")
|
|
||||||
elseif(NOT IS_ABSOLUTE "${_lib}")
|
|
||||||
# the found library must be an absolute path
|
|
||||||
message(FATAL_ERROR "Package 'rcl_lifecycle' found the library '${_library_target}' at '${_lib}' which is not an absolute path")
|
|
||||||
elseif(NOT EXISTS "${_lib}")
|
|
||||||
# the found library must exist
|
|
||||||
message(FATAL_ERROR "Package 'rcl_lifecycle' found the library '${_lib}' which doesn't exist")
|
|
||||||
else()
|
|
||||||
list(APPEND _libs "${_lib}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# dependencies
|
|
||||||
set(_exported_dependencies
|
|
||||||
"rmw"
|
|
||||||
"${rmw_implementation}"
|
|
||||||
"rosidl_generator_c")
|
|
||||||
set(${var_prefix}_DEFINITIONS)
|
|
||||||
foreach(_dep ${_exported_dependencies})
|
|
||||||
if(NOT ${_dep}_FOUND)
|
|
||||||
find_package("${_dep}" QUIET REQUIRED)
|
|
||||||
endif()
|
|
||||||
if(${_dep}_DEFINITIONS)
|
|
||||||
list_append_unique(${var_prefix}_DEFINITIONS "${${_dep}_DEFINITIONS}")
|
|
||||||
endif()
|
|
||||||
if(${_dep}_INCLUDE_DIRS)
|
|
||||||
list_append_unique(${var_prefix}_INCLUDE_DIRS "${${_dep}_INCLUDE_DIRS}")
|
|
||||||
endif()
|
|
||||||
if(${_dep}_LIBRARIES)
|
|
||||||
list(APPEND _libs "${${_dep}_LIBRARIES}")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
if(_libs)
|
|
||||||
ament_libraries_deduplicate(_libs "${_libs}")
|
|
||||||
endif()
|
|
||||||
set(${var_prefix}_LIBRARIES "${_libs}")
|
|
||||||
endmacro()
|
|
|
@ -13,7 +13,6 @@
|
||||||
<build_depend>lifecycle_msgs</build_depend>
|
<build_depend>lifecycle_msgs</build_depend>
|
||||||
<build_depend>rcl</build_depend>
|
<build_depend>rcl</build_depend>
|
||||||
<build_depend>rmw_implementation</build_depend>
|
<build_depend>rmw_implementation</build_depend>
|
||||||
<build_depend>rmw_implementation_cmake</build_depend>
|
|
||||||
<build_depend>rosidl_default_generators</build_depend>
|
<build_depend>rosidl_default_generators</build_depend>
|
||||||
|
|
||||||
<exec_depend>lifecycle_msgs</exec_depend>
|
<exec_depend>lifecycle_msgs</exec_depend>
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
# Copyright 2016 Open Source Robotics Foundation, Inc.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
# copied from rcl/rcl-extras.cmake
|
|
||||||
|
|
||||||
include("${rcl_lifecycle_DIR}/get_rcl_lifecycle_information.cmake")
|
|
Loading…
Add table
Add a link
Reference in a new issue