[rcl_action] Implement init/fini functions for types (#312)

* Refactored API. Removed init/fini functions for types that do not necessarily need allocation on the heap.
* Added unit tests for implementation.
This commit is contained in:
Jacob Perron 2018-10-31 13:36:48 -07:00 committed by GitHub
parent 29e7dbe156
commit f9dfc5ddd1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 356 additions and 133 deletions

View file

@ -33,6 +33,7 @@ add_executable(test_compile_headers
set(rcl_action_sources
src/${PROJECT_NAME}/goal_state_machine.c
src/${PROJECT_NAME}/types.c
)
set_source_files_properties(
@ -40,16 +41,17 @@ set_source_files_properties(
PROPERTIES language "C"
)
add_library(
${PROJECT_NAME}
add_library(${PROJECT_NAME}
${rcl_action_sources}
)
target_link_libraries(${PROJECT_NAME}
${rcl_LIBRARIES}
)
ament_target_dependencies(${PROJECT_NAME}
"rcl"
"action_msgs"
)
# 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 "RCL_ACTION_BUILDING_DLL")
@ -82,6 +84,18 @@ if(BUILD_TESTING)
${PROJECT_NAME}
)
endif()
ament_add_gtest(test_types
test/rcl_action/test_types.cpp
)
if(TARGET test_types)
target_include_directories(test_types PUBLIC
include
${rcl_INCLUDE_DIRS}
)
target_link_libraries(test_types
${PROJECT_NAME}
)
endif()
endif()
# specific order: dependents before dependencies
@ -90,4 +104,4 @@ ament_export_libraries(${PROJECT_NAME})
ament_export_dependencies(ament_cmake)
ament_export_dependencies(rcl)
ament_export_dependencies(action_msgs)
ament_package()
ament_package()