Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/basic_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
ros_distribution:
- humble
- iron
- jazzy
- rolling

# Define the Docker image(s) associated with each ROS distribution.
Expand All @@ -30,6 +31,10 @@ jobs:
- docker_image: ubuntu:jammy
ros_distribution: iron

# Jazzy Jalisco (May 2024 - May 2029)
- docker_image: ubuntu:jammy
ros_distribution: jazzy

# Rolling Ridley (No End-Of-Life)
- docker_image: ubuntu:jammy
ros_distribution: rolling
Expand All @@ -47,3 +52,4 @@ jobs:
package-name: rosidl_adapter_proto rosidl_typesupport_protobuf rosidl_typesupport_protobuf_cpp rosidl_typesupport_protobuf_c rosidl_typeadapter_protobuf_test
target-ros2-distro: ${{ matrix.ros_distribution }}
vcs-repo-file-url: https://raw.githubusercontent.com/ros2/ros2/${{ matrix.ros_distribution }}/ros2.repos
import-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion rosidl_adapter_proto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
#
# ================================= Apache 2.0 =================================
cmake_minimum_required(VERSION 3.12)
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)

project(rosidl_adapter_proto)

Expand Down
42 changes: 38 additions & 4 deletions rosidl_adapter_proto/cmake/rosidl_adapt_proto_interfaces.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,40 @@
#
# ================================= Apache 2.0 =================================

find_package(PythonInterp REQUIRED)
if(NOT PYTHON_EXECUTABLE)
if(POLICY CMP0148)
cmake_policy(SET CMP0148 OLD)
endif()

find_package(Protobuf CONFIG QUIET)
if(NOT Protobuf_FOUND)
find_package(Protobuf REQUIRED)
endif()

# Set the protoc Executable
# Protoc path retrieval from target taken from the CMake find module code of Protobuf
if(NOT Protobuf_PROTOC_EXECUTABLE AND TARGET protobuf::protoc)
get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc
IMPORTED_LOCATION_RELEASE)
if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}")
get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc
IMPORTED_LOCATION_RELWITHDEBINFO)
endif()
if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}")
get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc
IMPORTED_LOCATION_MINSIZEREL)
endif()
if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}")
get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc
IMPORTED_LOCATION_DEBUG)
endif()
if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}")
get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc
IMPORTED_LOCATION_NOCONFIG)
endif()
endif()

find_package(Python COMPONENTS Interpreter)
if(NOT Python_FOUND)
message(FATAL_ERROR "Variable 'PYTHON_EXECUTABLE' must not be empty")
endif()

Expand Down Expand Up @@ -53,8 +85,10 @@ rosidl_write_generator_arguments(
TARGET_DEPENDENCIES ${_target_dependencies}
ADDITIONAL_FILES "${_proto_include_dirs}")

include(CMakePrintHelpers)

execute_process(
COMMAND "${PYTHON_EXECUTABLE}" "${rosidl_adapter_proto_BIN}"
COMMAND "${Python_EXECUTABLE}" "${rosidl_adapter_proto_BIN}"
--generator-arguments-file "${generator_arguments_file}"
--protoc-path "${Protobuf_PROTOC_EXECUTABLE}"
ERROR_VARIABLE error
Expand Down Expand Up @@ -93,4 +127,4 @@ install(
DIRECTORY ${rosidl_adapter_proto_OUTPUT_DIR}
DESTINATION "share/${PROJECT_NAME}"
PATTERN "*.proto"
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
# rosidl_adapter_proto/
# rosidl_adapter_proto-extras.cmake.in

find_package(Protobuf REQUIRED)
find_package(Protobuf CONFIG QUIET)
if(NOT Protobuf_FOUND)
find_package(Protobuf REQUIRED)
endif()

if(NOT Protobuf_FOUND)
message(STATUS "Could not find Protobuf - skip rosidl_adapter_proto")
Expand Down
11 changes: 5 additions & 6 deletions rosidl_typeadapter_protobuf_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@ cmake_minimum_required(VERSION 3.5)

project(rosidl_typeadapter_protobuf_test)

# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
add_compile_options(-Wall -Wextra -Wpedantic -Wno-missing-field-initializers)
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND MSVC)
# /bigobj is needed to avoid error C1128:
Expand Down Expand Up @@ -109,6 +104,7 @@ if(BUILD_TESTING)

function(custom_executable target)
add_executable(${target} ${ARGN})
target_compile_features(${target} PRIVATE cxx_std_14)
ament_target_dependencies(${target}
"rclcpp"
"rclcpp_action"
Expand All @@ -124,9 +120,12 @@ if(BUILD_TESTING)
"rclcpp"
"test_msgs")

target_compile_features(subscribe_types PRIVATE cxx_std_14)

# publisher combined with a subscriber
custom_executable(test_proto_typeadapt_cpp
"test/test_proto_typeadapt.cpp")
target_compile_features(test_proto_typeadapt_cpp PRIVATE cxx_std_14)
target_link_libraries(test_proto_typeadapt_cpp subscribe_types rcpputils::rcpputils)


Expand Down
13 changes: 2 additions & 11 deletions rosidl_typesupport_protobuf_c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,8 @@ else()
CACHE BOOL "If Protobuf Static should be disabled.")
endif()

# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()

# 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)
add_compile_options(-Wall -Wextra -Wpedantic -Wno-missing-field-initializers)
endif()

if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
Expand Down Expand Up @@ -84,6 +74,7 @@ if(WIN32)
target_compile_definitions(${PROJECT_NAME}
PRIVATE "ROSIDL_TYPESUPPORT_PROTOBUF_C_BUILDING_DLL")
endif()
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14 c_std_99)

# TODO(tfoote) This needs cpp to build due to
# https://github.com/tfoote/rosidl_typesupport_protobuf/blob/132668ae385163ee8b45ce45a9022654e5c77666/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# generated from
# rosidl_typesupport_protobuf_c/rosidl_typesupport_protobuf_c-extras.cmake.in

find_package(Protobuf REQUIRED)
find_package(Protobuf CONFIG QUIET)
if(NOT Protobuf_FOUND)
find_package(Protobuf REQUIRED)
endif()

if(NOT Protobuf_FOUND)
message(STATUS "Could not find Protobuf: skipping rosidl_typesupport_protobuf_c")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
#
# ================================= Apache 2.0 =================================

find_package(Protobuf REQUIRED)
find_package(Protobuf CONFIG QUIET)
if(NOT Protobuf_FOUND)
find_package(Protobuf REQUIRED)
endif()

find_package(rosidl_adapter_proto REQUIRED)
find_package(rosidl_typesupport_protobuf REQUIRED)
Expand Down Expand Up @@ -93,8 +96,8 @@ if(rosidl_generate_interfaces_LIBRARY_NAME)
PROPERTIES OUTPUT_NAME "${rosidl_generate_interfaces_LIBRARY_NAME}${_target_suffix}")
endif()

set_target_properties(${rosidl_generate_interfaces_TARGET}${_target_suffix}
PROPERTIES CXX_STANDARD 14
target_compile_features(${rosidl_generate_interfaces_TARGET}${_target_suffix}
PRIVATE cxx_std_14
)

# Set flag for visibility macro
Expand All @@ -105,7 +108,7 @@ if(WIN32)
endif()

if(NOT WIN32)
set(_target_compile_flags "-Wall -Wextra -Wpedantic")
set(_target_compile_flags "-Wall -Wextra -Wpedantic -Wno-missing-field-initializers")
else()
set(_target_compile_flags "/W4")
endif()
Expand Down Expand Up @@ -152,9 +155,15 @@ foreach(_pkg_name ${rosidl_generate_interfaces_DEPENDENCY_PACKAGE_NAMES})
${${_pkg_name}_LIBRARIES${_target_suffix}})
endforeach()

target_link_libraries(${rosidl_generate_interfaces_TARGET}${_target_suffix}
${Protobuf_LIBRARY}
)
if(protobuf_MODULE_COMPATIBLE) #Legacy mode
target_link_libraries(${rosidl_generate_interfaces_TARGET}${_target_suffix}
${Protobuf_LIBRARY}
)
else()
target_link_libraries(${rosidl_generate_interfaces_TARGET}${_target_suffix}
protobuf::libprotobuf
)
endif()

add_dependencies(
${rosidl_generate_interfaces_TARGET}${_target_suffix}
Expand Down
8 changes: 3 additions & 5 deletions rosidl_typesupport_protobuf_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,8 @@ else()
CACHE BOOL "If Protobuf Static should be disabled.")
endif()

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)
add_compile_options(-Wall -Wextra -Wpedantic -Wno-missing-field-initializers)
endif()

if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
Expand Down Expand Up @@ -67,6 +63,8 @@ add_library(${PROJECT_NAME} SHARED
src/identifier.cpp
src/wstring_conversion.cpp)

target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)

if(WIN32)
target_compile_definitions(${PROJECT_NAME}
PRIVATE "ROSIDL_TYPESUPPORT_PROTOBUF_CPP_BUILDING_DLL")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
# rosidl_typesupport_protobuf_cpp/
# rosidl_typesupport_protobuf_cpp-extras.cmake.in

find_package(Protobuf REQUIRED)
find_package(Protobuf CONFIG QUIET)
if(NOT Protobuf_FOUND)
find_package(Protobuf REQUIRED)
endif()

if(NOT Protobuf_FOUND)
message(STATUS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
#
# ================================= Apache 2.0 =================================

find_package(Protobuf REQUIRED)
find_package(Protobuf CONFIG QUIET)
if(NOT Protobuf_FOUND)
find_package(Protobuf REQUIRED)
endif()

find_package(rosidl_adapter_proto REQUIRED)
find_package(rosidl_typesupport_protobuf REQUIRED)
Expand Down Expand Up @@ -118,8 +121,8 @@ if(rosidl_generate_interfaces_LIBRARY_NAME)
endif()

# set C++ standard
set_target_properties(${rosidl_generate_interfaces_TARGET}${_target_suffix}
PROPERTIES CXX_STANDARD 14
target_compile_features(${rosidl_generate_interfaces_TARGET}${_target_suffix}
PRIVATE cxx_std_14
)

# Set flag for visibility macro
Expand All @@ -131,7 +134,7 @@ endif()

# Set compiler flags
if(NOT WIN32)
set(_target_compile_flags "-Wall -Wextra -Wpedantic")
set(_target_compile_flags "-Wall -Wextra -Wpedantic -Wno-missing-field-initializers")
else()
set(_target_compile_flags "/W4")
endif()
Expand Down Expand Up @@ -166,7 +169,15 @@ foreach(_pkg_name ${rosidl_generate_interfaces_DEPENDENCY_PACKAGE_NAMES})
${${_pkg_name}_LIBRARIES${_target_suffix}})
endforeach()

target_link_libraries(${rosidl_generate_interfaces_TARGET}${_target_suffix} ${Protobuf_LIBRARY})
if(protobuf_MODULE_COMPATIBLE) #Legacy mode
target_link_libraries(${rosidl_generate_interfaces_TARGET}${_target_suffix}
${Protobuf_LIBRARY}
)
else()
target_link_libraries(${rosidl_generate_interfaces_TARGET}${_target_suffix}
protobuf::libprotobuf
)
endif()

# Make top level generation target depend on this library
add_dependencies(
Expand Down Expand Up @@ -214,4 +225,4 @@ if(NOT rosidl_generate_interfaces_SKIP_INSTALL)
${rosidl_generate_interfaces_TARGET}${_target_suffix})

ament_export_libraries(${rosidl_generate_interfaces_TARGET}${_target_suffix})
endif()
endif()
Loading