2018-11-21 09:16:51 -08:00
|
|
|
cmake_minimum_required(VERSION 3.5)
|
|
|
|
|
|
|
|
project(rclcpp_action)
|
|
|
|
|
|
|
|
find_package(ament_cmake_ros REQUIRED)
|
|
|
|
find_package(action_msgs REQUIRED)
|
|
|
|
find_package(rclcpp REQUIRED)
|
|
|
|
find_package(rcl_action REQUIRED)
|
2020-04-10 12:25:16 +02:00
|
|
|
find_package(rosidl_runtime_c REQUIRED)
|
2018-11-21 09:16:51 -08:00
|
|
|
|
|
|
|
# Default to C++14
|
|
|
|
if(NOT CMAKE_CXX_STANDARD)
|
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
|
|
endif()
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
|
|
add_compile_options(-Wall -Wextra -Wpedantic)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(${PROJECT_NAME}_SRCS
|
|
|
|
src/client.cpp
|
2019-05-08 14:24:40 -07:00
|
|
|
src/qos.cpp
|
2018-11-21 09:16:51 -08:00
|
|
|
src/server.cpp
|
|
|
|
src/server_goal_handle.cpp
|
2018-12-06 09:38:01 -08:00
|
|
|
src/types.cpp
|
2018-11-21 09:16:51 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
add_library(${PROJECT_NAME}
|
|
|
|
${${PROJECT_NAME}_SRCS})
|
|
|
|
|
2020-04-27 10:30:33 -07:00
|
|
|
target_include_directories(${PROJECT_NAME}
|
|
|
|
PUBLIC
|
|
|
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
|
|
|
|
"$<INSTALL_INTERFACE:include>")
|
|
|
|
|
2018-11-21 09:16:51 -08:00
|
|
|
ament_target_dependencies(${PROJECT_NAME}
|
|
|
|
"action_msgs"
|
|
|
|
"rcl_action"
|
|
|
|
"rclcpp"
|
2020-04-10 12:25:16 +02:00
|
|
|
"rosidl_runtime_c"
|
2020-02-27 18:25:10 +01:00
|
|
|
)
|
2018-11-21 09:16:51 -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_ACTION_BUILDING_LIBRARY")
|
|
|
|
|
|
|
|
install(
|
|
|
|
DIRECTORY include/
|
|
|
|
DESTINATION include)
|
|
|
|
|
|
|
|
install(
|
|
|
|
TARGETS ${PROJECT_NAME}
|
2020-04-27 10:30:33 -07:00
|
|
|
EXPORT ${PROJECT_NAME}
|
2018-11-21 09:16:51 -08:00
|
|
|
ARCHIVE DESTINATION lib
|
|
|
|
LIBRARY DESTINATION lib
|
|
|
|
RUNTIME DESTINATION bin
|
|
|
|
)
|
|
|
|
|
|
|
|
# specific order: dependents before dependencies
|
|
|
|
ament_export_include_directories(include)
|
|
|
|
ament_export_libraries(${PROJECT_NAME})
|
2020-04-27 10:30:33 -07:00
|
|
|
ament_export_targets(${PROJECT_NAME})
|
2018-11-21 09:16:51 -08:00
|
|
|
|
|
|
|
ament_export_dependencies(ament_cmake)
|
|
|
|
ament_export_dependencies(action_msgs)
|
|
|
|
ament_export_dependencies(rclcpp)
|
|
|
|
ament_export_dependencies(rcl_action)
|
2020-04-10 12:25:16 +02:00
|
|
|
ament_export_dependencies(rosidl_runtime_c)
|
2018-11-21 09:16:51 -08:00
|
|
|
|
|
|
|
if(BUILD_TESTING)
|
|
|
|
find_package(ament_cmake_gtest REQUIRED)
|
|
|
|
find_package(ament_lint_auto REQUIRED)
|
2020-03-04 09:05:21 -08:00
|
|
|
# Give cppcheck hints about macro definitions coming from outside this package
|
|
|
|
set(ament_cmake_cppcheck_ADDITIONAL_INCLUDE_DIRS ${rclcpp_INCLUDE_DIRS})
|
2018-11-21 09:16:51 -08:00
|
|
|
ament_lint_auto_find_test_dependencies()
|
|
|
|
|
2019-11-12 19:15:38 -03:00
|
|
|
ament_add_gtest(test_client test/test_client.cpp TIMEOUT 120)
|
2018-11-21 09:16:51 -08:00
|
|
|
if(TARGET test_client)
|
|
|
|
ament_target_dependencies(test_client
|
|
|
|
"test_msgs"
|
|
|
|
)
|
|
|
|
target_link_libraries(test_client
|
|
|
|
${PROJECT_NAME}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
ament_add_gtest(test_server test/test_server.cpp)
|
|
|
|
if(TARGET test_server)
|
|
|
|
ament_target_dependencies(test_server
|
|
|
|
"test_msgs"
|
|
|
|
)
|
|
|
|
target_link_libraries(test_server
|
|
|
|
${PROJECT_NAME}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2019-10-15 13:51:57 -05:00
|
|
|
ament_add_gtest(test_traits test/test_traits.cpp)
|
|
|
|
if(TARGET test_traits)
|
|
|
|
ament_target_dependencies(test_traits
|
|
|
|
"test_msgs"
|
|
|
|
)
|
|
|
|
target_link_libraries(test_traits
|
|
|
|
${PROJECT_NAME}
|
|
|
|
)
|
|
|
|
endif()
|
2020-04-29 14:25:52 -07:00
|
|
|
|
|
|
|
ament_add_gtest(test_types test/test_types.cpp)
|
|
|
|
if(TARGET test_types)
|
|
|
|
ament_target_dependencies(test_types
|
|
|
|
"test_msgs"
|
|
|
|
)
|
|
|
|
target_link_libraries(test_types
|
|
|
|
${PROJECT_NAME}
|
|
|
|
)
|
|
|
|
endif()
|
2018-11-21 09:16:51 -08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
ament_package()
|