rclcpp/rclcpp/CMakeLists.txt

200 lines
6 KiB
Text
Raw Normal View History

2016-06-15 11:35:56 -07:00
cmake_minimum_required(VERSION 3.5)
project(rclcpp)
find_package(ament_cmake REQUIRED)
find_package(builtin_interfaces REQUIRED)
2016-04-24 21:25:19 +00:00
find_package(rcl REQUIRED)
find_package(rcl_interfaces REQUIRED)
find_package(rmw REQUIRED)
2015-12-07 18:04:19 -08:00
find_package(rmw_implementation REQUIRED)
find_package(rosidl_generator_cpp REQUIRED)
2016-12-28 12:12:05 -08:00
find_package(rosidl_typesupport_c REQUIRED)
2016-11-18 11:45:18 -08:00
find_package(rosidl_typesupport_cpp REQUIRED)
if(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wextra -Wpedantic")
endif()
include_directories(include)
set(${PROJECT_NAME}_SRCS
src/rclcpp/any_executable.cpp
src/rclcpp/callback_group.cpp
src/rclcpp/client.cpp
src/rclcpp/context.cpp
src/rclcpp/contexts/default_context.cpp
src/rclcpp/event.cpp
src/rclcpp/exceptions.cpp
src/rclcpp/executor.cpp
src/rclcpp/executors.cpp
src/rclcpp/executors/multi_threaded_executor.cpp
src/rclcpp/executors/single_threaded_executor.cpp
src/rclcpp/graph_listener.cpp
src/rclcpp/intra_process_manager.cpp
src/rclcpp/intra_process_manager_impl.cpp
src/rclcpp/memory_strategies.cpp
src/rclcpp/memory_strategy.cpp
break Node into several separate interfaces (#277) * add the NodeBaseInterface and impl NodeBase * refactor rclcpp to use NodeBaseInterface * triggering a guard condition is not const * remove unnecessary pure virtual destructor * remove unused private member, style * create NodeTopics interface, refactor pub/sub * add convenience functions to fix API breaks * fix compilation errors from NodeTopics refactor * move "Event" based exceptions to exceptions.hpp * add the NodeGraphInterface and related API's * update node and graph_listener to use NodeGraph API * initialize node_topics_ and node_graph_ in Node * remove methods from Node and reorganize the order the removed methods are really low level and still available via their respective Node*Interface class * add the NodeServices API and implementation * add the NodeParameters API and refactor Node * mixups * fixup NodeParameters constructor * added NodeTimers API and refactor Node * make new create_publisher and create_subscription free template functions * fixup * fixup * fixup * fixup share pointer to node in any_executable * free env value before throwing on Windows * uncrustify and cpplint * address constness issues * do not store the topic name as a std::string in subscription * fixes to support const char * topic name * fix incomplete type specification, which fails on Windows * refactor after rebase from type support changes * fixup Windows build * fix template issues on Windows * uncrustify * remove the unnecessary callback group argument from the add_publisher func * remove unnecessary using = directive * do not store node name in C++ * fix client and service creation in Node constructor * fix include orders
2016-12-09 17:09:29 -08:00
src/rclcpp/node.cpp
src/rclcpp/node_interfaces/node_base.cpp
src/rclcpp/node_interfaces/node_graph.cpp
src/rclcpp/node_interfaces/node_parameters.cpp
src/rclcpp/node_interfaces/node_services.cpp
src/rclcpp/node_interfaces/node_timers.cpp
src/rclcpp/node_interfaces/node_topics.cpp
src/rclcpp/parameter.cpp
src/rclcpp/parameter_client.cpp
src/rclcpp/parameter_service.cpp
src/rclcpp/publisher.cpp
src/rclcpp/service.cpp
src/rclcpp/subscription.cpp
src/rclcpp/timer.cpp
2015-12-07 18:04:19 -08:00
src/rclcpp/type_support.cpp
src/rclcpp/utilities.cpp
)
2015-12-07 18:04:19 -08:00
2017-01-05 12:13:58 -08:00
add_library(${PROJECT_NAME} SHARED
${${PROJECT_NAME}_SRCS})
ament_target_dependencies(${PROJECT_NAME}
"builtin_interfaces"
2017-01-05 12:13:58 -08:00
"rcl"
"rosidl_generator_cpp"
"rosidl_typesupport_cpp")
2015-12-07 18:04:19 -08:00
2017-01-05 12:13:58 -08:00
# Causes the visibility macros to use dllexport rather than dllimport,
# which is appropriate when building the dll but not consuming it.
target_compile_definitions(${PROJECT_NAME}
PRIVATE "RCLCPP_BUILDING_LIBRARY")
2015-12-07 18:04:19 -08:00
2017-01-05 12:13:58 -08:00
install(
TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
2016-02-11 08:24:30 -08:00
ament_export_dependencies(ament_cmake)
ament_export_dependencies(builtin_interfaces)
2016-04-24 21:25:19 +00:00
ament_export_dependencies(rcl)
ament_export_dependencies(rosidl_generator_cpp)
2016-12-28 12:12:05 -08:00
ament_export_dependencies(rosidl_typesupport_c)
2016-11-18 11:45:18 -08:00
ament_export_dependencies(rosidl_typesupport_cpp)
2014-08-01 16:59:55 -07:00
ament_export_include_directories(include)
ament_export_libraries(${PROJECT_NAME})
2016-04-28 18:45:08 -07:00
if(BUILD_TESTING)
2015-03-07 01:24:52 +01:00
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
2017-01-05 12:13:58 -08:00
find_package(rmw_implementation_cmake REQUIRED)
ament_add_gtest(test_function_traits test/test_function_traits.cpp)
if(TARGET test_function_traits)
target_include_directories(test_function_traits PUBLIC
${rcl_interfaces_INCLUDE_DIRS}
${rmw_INCLUDE_DIRS}
${rosidl_generator_cpp_INCLUDE_DIRS}
2016-11-18 11:45:18 -08:00
${rosidl_typesupport_cpp_INCLUDE_DIRS}
)
endif()
ament_add_gtest(test_mapped_ring_buffer test/test_mapped_ring_buffer.cpp)
if(TARGET test_mapped_ring_buffer)
target_include_directories(test_mapped_ring_buffer PUBLIC
2016-04-24 21:25:19 +00:00
${rcl_INCLUDE_DIRS}
${rcl_interfaces_INCLUDE_DIRS}
${rmw_INCLUDE_DIRS}
${rosidl_generator_cpp_INCLUDE_DIRS}
2016-11-18 11:45:18 -08:00
${rosidl_typesupport_cpp_INCLUDE_DIRS}
)
endif()
2015-08-18 18:42:00 -07:00
ament_add_gtest(test_intra_process_manager test/test_intra_process_manager.cpp)
if(TARGET test_intra_process_manager)
2015-08-27 14:07:18 -07:00
target_include_directories(test_intra_process_manager PUBLIC
2016-04-24 21:25:19 +00:00
${rcl_INCLUDE_DIRS}
${rcl_interfaces_INCLUDE_DIRS}
${rmw_INCLUDE_DIRS}
${rosidl_generator_cpp_INCLUDE_DIRS}
2016-11-18 11:45:18 -08:00
${rosidl_typesupport_cpp_INCLUDE_DIRS}
)
endif()
2016-05-17 15:35:44 -07:00
ament_add_gtest(test_rate test/test_rate.cpp
ENV RCL_ASSERT_RMW_ID_MATCHES=${rmw_implementation})
2015-12-15 00:27:46 -08:00
if(TARGET test_rate)
target_include_directories(test_rate PUBLIC
${rcl_interfaces_INCLUDE_DIRS}
${rmw_INCLUDE_DIRS}
${rosidl_generator_cpp_INCLUDE_DIRS}
2016-11-18 11:45:18 -08:00
${rosidl_typesupport_cpp_INCLUDE_DIRS}
2015-12-15 00:27:46 -08:00
)
target_link_libraries(test_rate
${PROJECT_NAME}
2015-12-15 00:27:46 -08:00
)
endif()
ament_add_gtest(test_find_weak_nodes test/test_find_weak_nodes.cpp)
if(TARGET test_find_weak_nodes)
target_include_directories(test_find_weak_nodes PUBLIC
${rcl_INCLUDE_DIRS}
)
target_link_libraries(test_find_weak_nodes ${PROJECT_NAME})
endif()
get_default_rmw_implementation(default_rmw)
find_package(${default_rmw} REQUIRED)
get_rmw_typesupport(typesupport_impls_cpp "${default_rmw}" LANGUAGE "cpp")
get_rmw_typesupport(typesupport_impls_c "${default_rmw}" LANGUAGE "c")
set(mock_msg_files
"test/mock_msgs/srv/Mock.srv")
rosidl_generate_interfaces(mock_msgs
${mock_msg_files}
2016-12-06 14:54:31 -08:00
LIBRARY_NAME "rclcpp"
SKIP_INSTALL)
2016-11-18 11:45:18 -08:00
set(append_library_dirs "${CMAKE_CURRENT_BINARY_DIR}")
if(WIN32)
set(append_library_dirs "${append_library_dirs}/$<CONFIG>")
2016-11-18 11:45:18 -08:00
endif()
ament_add_gtest(test_externally_defined_services test/test_externally_defined_services.cpp
APPEND_LIBRARY_DIRS "${append_library_dirs}")
if(TARGET test_externally_defined_services)
target_include_directories(test_externally_defined_services PUBLIC
${rcl_INCLUDE_DIRS}
)
target_link_libraries(test_externally_defined_services ${PROJECT_NAME})
foreach(typesupport_impl_cpp ${typesupport_impls_cpp})
rosidl_target_interfaces(test_externally_defined_services
mock_msgs ${typesupport_impl_cpp})
endforeach()
foreach(typesupport_impl_c ${typesupport_impls_c})
rosidl_target_interfaces(test_externally_defined_services
mock_msgs ${typesupport_impl_c})
endforeach()
endif()
ament_add_gtest(test_time test/test_time.cpp
APPEND_LIBRARY_DIRS "${append_library_dirs}")
if(TARGET test_time)
ament_target_dependencies(test_time
"rcl")
target_link_libraries(test_time ${PROJECT_NAME})
endif()
2015-03-07 01:24:52 +01:00
endif()
ament_package(
CONFIG_EXTRAS rclcpp-extras.cmake
)
2015-12-07 18:04:19 -08:00
install(
DIRECTORY cmake
DESTINATION share/${PROJECT_NAME}
)
install(
DIRECTORY include/
DESTINATION include
)