Skip to content

Commit

Permalink
Splitted rosidl_generator_c and rosidl_generator_cpp in two: rosidl_g…
Browse files Browse the repository at this point in the history
…enerator_x and rosidl_runtime_x (#442)

* Splitted rosidl_generator_c and rosidl_generator_cpp in two: rosidl_generator_x and rosidl_runtime_x

Signed-off-by: ahcorde <ahcorde@gmail.com>

* added comments

Signed-off-by: ahcorde <ahcorde@gmail.com>

* rosidl_runtime_cpp removed rosidl_parser dependency

Signed-off-by: ahcorde <ahcorde@gmail.com>

* removed c++ flags

Signed-off-by: ahcorde <ahcorde@gmail.com>

* included more feedback

Signed-off-by: ahcorde <ahcorde@gmail.com>

* Restoring rosidl_typesupport_interface in the package.xml

Signed-off-by: ahcorde <ahcorde@gmail.com>

* rosidl_typesupport_interface from build_depend to build_export_depend

Signed-off-by: ahcorde <ahcorde@gmail.com>

* Restored tabs

Signed-off-by: ahcorde <ahcorde@gmail.com>

* rosidl_generator_c including headers in CMakeLists.txt

Signed-off-by: ahcorde <ahcorde@gmail.com>

* Fixed rosidl_generator_cpp cmakelists

Signed-off-by: ahcorde <ahcorde@gmail.com>

* Exported the right rosidl_generator and rosidl_runtime

Signed-off-by: ahcorde <ahcorde@gmail.com>

* replaced include_directories for target_include_directories

Signed-off-by: ahcorde <ahcorde@gmail.com>

* moved rosidl_generator_x dependencies from build_depend to test_depend

Signed-off-by: ahcorde <ahcorde@gmail.com>

* Removed member_of_group rosidl_runtime_packages from rosidl_generator_c

Signed-off-by: ahcorde <ahcorde@gmail.com>

* changed target_include_libraries and directory for ament_target_dependencies

Signed-off-by: ahcorde <ahcorde@gmail.com>

* restored add dependency in rosidl_generator_cpp

Signed-off-by: ahcorde <ahcorde@gmail.com>

* Removed rosidl_generator_x from rosidl_typesupport_introspection_x

Signed-off-by: ahcorde <ahcorde@gmail.com>

* Removed comments

Signed-off-by: ahcorde <ahcorde@gmail.com>

* Restored C standard and compiler flags

Signed-off-by: ahcorde <ahcorde@gmail.com>

* keep the originally used dependency type

Signed-off-by: ahcorde <ahcorde@gmail.com>

* Fixed rosidl_runtime_c cmakelists.txt

Signed-off-by: ahcorde <ahcorde@gmail.com>

* Removed ament_export_dependencies rosidl_cmake

Signed-off-by: ahcorde <ahcorde@gmail.com>

* fixed test_msg_builder directories

Signed-off-by: ahcorde <ahcorde@gmail.com>
  • Loading branch information
ahcorde committed Apr 10, 2020
1 parent 5d44772 commit 2cda518
Show file tree
Hide file tree
Showing 41 changed files with 213 additions and 66 deletions.
67 changes: 26 additions & 41 deletions rosidl_generator_c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,10 @@ endif()

find_package(ament_cmake_python REQUIRED)
find_package(ament_cmake_ros REQUIRED)
find_package(rosidl_typesupport_interface REQUIRED)

include_directories(include)
add_library(${PROJECT_NAME}
"src/message_bounds.c"
"src/message_type_support.c"
"src/primitives_sequence_functions.c"
"src/service_type_support.c"
"src/string_functions.c"
"src/u16string_functions.c"
)
ament_target_dependencies(${PROJECT_NAME}
"rosidl_typesupport_interface")
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set_target_properties(${PROJECT_NAME} PROPERTIES
COMPILE_OPTIONS -Wall -Wextra -Wpedantic)
endif()
if(WIN32)
target_compile_definitions(${PROJECT_NAME}
PRIVATE "ROSIDL_GENERATOR_C_BUILDING_DLL")
endif()
find_package(rosidl_runtime_c REQUIRED)

ament_export_dependencies(rosidl_cmake)
ament_export_dependencies(rosidl_typesupport_interface)
ament_export_include_directories(include)
ament_export_libraries(${PROJECT_NAME})

ament_index_register_resource("rosidl_generator_packages")

ament_python_install_package(${PROJECT_NAME})
Expand All @@ -59,7 +36,6 @@ if(BUILD_TESTING)
# Trick ament_target_dependencies() into thinking this package has been found
set(rosidl_generator_c_FOUND "1")
set(rosidl_generator_c_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(rosidl_generator_c_LIBRARIES "${PROJECT_NAME}")

rosidl_generator_c_extras(
"${CMAKE_CURRENT_SOURCE_DIR}/bin/rosidl_generator_c"
Expand All @@ -76,8 +52,7 @@ if(BUILD_TESTING)
add_executable(test_compilation_c test/test_compilation.c test/separate_compilation.c)
add_executable(test_interfaces_c test/test_interfaces.c)
add_executable(test_invalid_initialization_c test/test_invalid_initialization.c)
add_dependencies(test_interfaces_c ${PROJECT_NAME})
add_dependencies(test_invalid_initialization_c ${PROJECT_NAME})

ament_add_test(
test_compilation_c
COMMAND "$<TARGET_FILE:test_compilation_c>"
Expand All @@ -95,10 +70,30 @@ if(BUILD_TESTING)
)

# include the built files directly, instead of their install location
include_directories("${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}")
target_link_libraries(test_compilation_c ${PROJECT_NAME} ${PROJECT_NAME}_interfaces__${PROJECT_NAME})
target_link_libraries(test_interfaces_c ${PROJECT_NAME} ${PROJECT_NAME}_interfaces__${PROJECT_NAME})
target_link_libraries(test_invalid_initialization_c ${PROJECT_NAME} ${PROJECT_NAME}_interfaces__${PROJECT_NAME})
target_link_libraries(test_compilation_c
${PROJECT_NAME}_interfaces__${PROJECT_NAME}
${rosidl_runtime_c_LIBRARIES}
)
target_include_directories(test_compilation_c PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}
${rosidl_runtime_c_INCLUDE_DIRS}
)
target_link_libraries(test_interfaces_c
${PROJECT_NAME}_interfaces__${PROJECT_NAME}
${rosidl_runtime_c_LIBRARIES}
)
target_include_directories(test_interfaces_c PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}
${rosidl_runtime_c_INCLUDE_DIRS}
)
target_link_libraries(test_invalid_initialization_c
${PROJECT_NAME}_interfaces__${PROJECT_NAME}
${rosidl_runtime_c_LIBRARIES}
)
target_include_directories(test_invalid_initialization_c PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}
${rosidl_runtime_c_INCLUDE_DIRS}
)
endif()

ament_package(
Expand All @@ -113,13 +108,3 @@ install(
DIRECTORY cmake resource
DESTINATION share/${PROJECT_NAME}
)
install(
DIRECTORY include/
DESTINATION include
)
install(
TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ foreach(_pkg_name ${rosidl_generate_interfaces_DEPENDENCY_PACKAGE_NAMES})
${_pkg_name})
endforeach()
ament_target_dependencies(${rosidl_generate_interfaces_TARGET}${_target_suffix}
"rosidl_generator_c"
"rosidl_runtime_c"
"rosidl_typesupport_interface")

add_dependencies(
Expand Down
5 changes: 2 additions & 3 deletions rosidl_generator_c/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
<maintainer email="william@osrfoundation.org">William Woodall</maintainer>
<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake_python</buildtool_depend>
<buildtool_depend>ament_cmake_ros</buildtool_depend>

<build_depend>rosidl_typesupport_interface</build_depend>

<buildtool_export_depend>ament_cmake</buildtool_export_depend>
<buildtool_export_depend>rosidl_cmake</buildtool_export_depend>

Expand All @@ -22,10 +21,10 @@
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<test_depend>rosidl_cmake</test_depend>
<test_depend>rosidl_runtime_c</test_depend>
<test_depend>test_interface_files</test_depend>

<member_of_group>rosidl_generator_packages</member_of_group>
<member_of_group>rosidl_runtime_packages</member_of_group>

<export>
<build_type>ament_cmake</build_type>
Expand Down
58 changes: 45 additions & 13 deletions rosidl_generator_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@ find_package(ament_cmake REQUIRED)
find_package(ament_cmake_python REQUIRED)

ament_export_dependencies(rosidl_cmake)
ament_export_dependencies(rosidl_generator_c)
ament_export_include_directories(include)

ament_index_register_resource("rosidl_generator_packages")
ament_index_register_resource("rosidl_runtime_packages")

ament_python_install_package(${PROJECT_NAME})

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
find_package(rosidl_generator_c REQUIRED)
find_package(rosidl_runtime_c REQUIRED)
find_package(rosidl_runtime_cpp REQUIRED)
find_package(test_interface_files REQUIRED)
ament_lint_auto_find_test_dependencies()

Expand Down Expand Up @@ -45,36 +43,74 @@ if(BUILD_TESTING)
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

include_directories(include
${rosidl_generator_c_INCLUDE_DIRS})

ament_add_gtest(test_bounded_vector test/test_bounded_vector.cpp)
if(TARGET test_bounded_vector)
add_dependencies(test_bounded_vector ${PROJECT_NAME})
target_include_directories(test_bounded_vector PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME})
ament_target_dependencies(test_bounded_vector
rosidl_runtime_cpp
rosidl_runtime_c)
endif()
ament_add_gtest(test_msg_builder test/test_msg_builder.cpp)
if(TARGET test_msg_builder)
add_dependencies(test_msg_builder ${PROJECT_NAME})
target_include_directories(test_msg_builder PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME})
ament_target_dependencies(test_msg_builder
rosidl_runtime_cpp
rosidl_runtime_c)
endif()
ament_add_gtest(test_msg_initialization test/test_msg_initialization.cpp)
if(TARGET test_msg_initialization)
add_dependencies(test_msg_initialization ${PROJECT_NAME})
ament_target_dependencies(test_msg_initialization
rosidl_runtime_cpp
rosidl_runtime_c)
target_include_directories(test_msg_initialization PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}
)
endif()
ament_add_gtest(test_srv_initialization test/test_srv_initialization.cpp)
if(TARGET test_srv_initialization)
add_dependencies(test_srv_initialization ${PROJECT_NAME})
ament_target_dependencies(test_srv_initialization
rosidl_runtime_cpp
rosidl_runtime_c)
target_include_directories(test_srv_initialization PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}
)
endif()
ament_add_gtest(test_interfaces_cpp test/test_interfaces.cpp)
if(TARGET test_interfaces_cpp)
add_dependencies(test_interfaces_cpp ${PROJECT_NAME})
ament_target_dependencies(test_interfaces_cpp
rosidl_runtime_cpp
rosidl_runtime_c)
target_include_directories(test_interfaces_cpp PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}
)
endif()
ament_add_gtest(test_msg_datatype test/test_msg_datatype.cpp)
if(TARGET test_msg_datatype)
add_dependencies(test_msg_datatype ${PROJECT_NAME})
ament_target_dependencies(test_msg_datatype
rosidl_runtime_cpp
rosidl_runtime_c)
target_include_directories(test_msg_datatype PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}
)
endif()
ament_add_gtest(test_traits test/test_traits.cpp)
if(TARGET test_traits)
add_dependencies(test_traits ${PROJECT_NAME})
ament_target_dependencies(test_traits
rosidl_runtime_cpp
rosidl_runtime_c)
target_include_directories(test_traits PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}
)
endif()
# include the built files directly, instead of their install location
include_directories("${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}")
endif()

ament_package(
Expand All @@ -89,7 +125,3 @@ install(
DIRECTORY cmake resource
DESTINATION share/${PROJECT_NAME}
)
install(
DIRECTORY include/
DESTINATION include
)
5 changes: 3 additions & 2 deletions rosidl_generator_cpp/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<maintainer email="dthomas@osrfoundation.org">Dirk Thomas</maintainer>
<license>Apache License 2.0</license>


<buildtool_depend>ament_cmake</buildtool_depend>

<buildtool_export_depend>ament_cmake</buildtool_export_depend>
Expand All @@ -21,11 +22,11 @@
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<test_depend>rosidl_cmake</test_depend>
<test_depend>rosidl_generator_c</test_depend>
<test_depend>rosidl_runtime_cpp</test_depend>
<test_depend>rosidl_runtime_c</test_depend>
<test_depend>test_interface_files</test_depend>

<member_of_group>rosidl_generator_packages</member_of_group>
<member_of_group>rosidl_runtime_packages</member_of_group>

<export>
<build_type>ament_cmake</build_type>
Expand Down
59 changes: 59 additions & 0 deletions rosidl_runtime_c/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
cmake_minimum_required(VERSION 3.5)

project(rosidl_runtime_c C)

# Default to C11
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 11)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(ament_cmake_ros REQUIRED)
find_package(rosidl_typesupport_interface REQUIRED)

include_directories(include)
add_library(${PROJECT_NAME}
"src/message_bounds.c"
"src/message_type_support.c"
"src/primitives_sequence_functions.c"
"src/service_type_support.c"
"src/string_functions.c"
"src/u16string_functions.c"
)
ament_target_dependencies(${PROJECT_NAME}
"rosidl_typesupport_interface")
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set_target_properties(${PROJECT_NAME} PROPERTIES
COMPILE_OPTIONS -Wall -Wextra -Wpedantic)
endif()
if(WIN32)
target_compile_definitions(${PROJECT_NAME}
PRIVATE "ROSIDL_GENERATOR_C_BUILDING_DLL")
endif()

ament_export_dependencies(rosidl_typesupport_interface)
ament_export_include_directories(include)
ament_export_libraries(${PROJECT_NAME})

ament_index_register_resource("rosidl_runtime_packages")

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()

install(
DIRECTORY include/
DESTINATION include
)
install(
TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)

ament_package()
26 changes: 26 additions & 0 deletions rosidl_runtime_c/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>rosidl_runtime_c</name>
<version>0.8.2</version>
<description>Generate the ROS interfaces in C.</description>
<maintainer email="william@osrfoundation.org">William Woodall</maintainer>
<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake_ros</buildtool_depend>

<build_depend>rosidl_typesupport_interface</build_depend>

<buildtool_export_depend>ament_cmake</buildtool_export_depend>

<build_export_depend>rosidl_typesupport_interface</build_export_depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

<member_of_group>rosidl_runtime_packages</member_of_group>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions rosidl_runtime_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
cmake_minimum_required(VERSION 3.5)

project(rosidl_runtime_cpp)

find_package(ament_cmake REQUIRED)

ament_export_include_directories(include)

ament_index_register_resource("rosidl_runtime_packages")

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()

install(
DIRECTORY include/
DESTINATION include
)

ament_package()
22 changes: 22 additions & 0 deletions rosidl_runtime_cpp/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>rosidl_runtime_cpp</name>
<version>0.8.2</version>
<description>Generate the ROS interfaces in C++.</description>
<maintainer email="dthomas@osrfoundation.org">Dirk Thomas</maintainer>
<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake</buildtool_depend>

<buildtool_export_depend>ament_cmake</buildtool_export_depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

<member_of_group>rosidl_runtime_packages</member_of_group>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
Loading

0 comments on commit 2cda518

Please sign in to comment.