From 5f20efa3292b8ef97b324609e28da31fc3d93f13 Mon Sep 17 00:00:00 2001 From: Fei Name Date: Wed, 28 Aug 2024 08:17:52 +0800 Subject: [PATCH] Fix cmake to defein ROS_DISTRO and HUMBLE --- rmw_ecal_dynamic_cpp/CMakeLists.txt | 1 - rmw_ecal_dynamic_cpp/src/rmw/features.cpp | 26 ------------------- rmw_ecal_proto_cpp/CMakeLists.txt | 1 - rmw_ecal_proto_cpp/src/rmw/features.cpp | 26 ------------------- .../cmake/discover-ros-distro-extras.cmake | 3 ++- rmw_ecal_shared_cpp/src/features.cpp | 6 +++-- 6 files changed, 6 insertions(+), 57 deletions(-) delete mode 100644 rmw_ecal_dynamic_cpp/src/rmw/features.cpp delete mode 100644 rmw_ecal_proto_cpp/src/rmw/features.cpp diff --git a/rmw_ecal_dynamic_cpp/CMakeLists.txt b/rmw_ecal_dynamic_cpp/CMakeLists.txt index 202cc9c..895825a 100644 --- a/rmw_ecal_dynamic_cpp/CMakeLists.txt +++ b/rmw_ecal_dynamic_cpp/CMakeLists.txt @@ -58,7 +58,6 @@ add_library(${PROJECT_NAME} SHARED src/rmw/init.cpp src/rmw/qos_profiles.cpp src/rmw/rmw.cpp - src/rmw/features.cpp src/serialization/serializer_cpp.cpp src/serialization/serializer_c.cpp src/serialization/deserializer_cpp.cpp diff --git a/rmw_ecal_dynamic_cpp/src/rmw/features.cpp b/rmw_ecal_dynamic_cpp/src/rmw/features.cpp deleted file mode 100644 index 7efb9ee..0000000 --- a/rmw_ecal_dynamic_cpp/src/rmw/features.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2020 Continental AG -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#if DISTRO >= HUMBLE - -#include - -#include - -bool rmw_feature_supported(rmw_feature_t feature) -{ - return eCAL::rmw::rmw_feature_supported(feature); -} - -#endif diff --git a/rmw_ecal_proto_cpp/CMakeLists.txt b/rmw_ecal_proto_cpp/CMakeLists.txt index 560ab0c..65c0345 100644 --- a/rmw_ecal_proto_cpp/CMakeLists.txt +++ b/rmw_ecal_proto_cpp/CMakeLists.txt @@ -64,7 +64,6 @@ add_library(${PROJECT_NAME} SHARED src/rmw/init.cpp src/rmw/qos_profiles.cpp src/rmw/rmw.cpp - src/rmw/features.cpp ) target_link_libraries(${PROJECT_NAME} diff --git a/rmw_ecal_proto_cpp/src/rmw/features.cpp b/rmw_ecal_proto_cpp/src/rmw/features.cpp deleted file mode 100644 index 7efb9ee..0000000 --- a/rmw_ecal_proto_cpp/src/rmw/features.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2020 Continental AG -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#if DISTRO >= HUMBLE - -#include - -#include - -bool rmw_feature_supported(rmw_feature_t feature) -{ - return eCAL::rmw::rmw_feature_supported(feature); -} - -#endif diff --git a/rmw_ecal_shared_cpp/cmake/discover-ros-distro-extras.cmake b/rmw_ecal_shared_cpp/cmake/discover-ros-distro-extras.cmake index f90d21f..e3224e0 100644 --- a/rmw_ecal_shared_cpp/cmake/discover-ros-distro-extras.cmake +++ b/rmw_ecal_shared_cpp/cmake/discover-ros-distro-extras.cmake @@ -26,6 +26,8 @@ set(supported_distros list(FIND supported_distros $ENV{ROS_DISTRO} index) if(index EQUAL -1) message(FATAL_ERROR "'$ENV{ROS_DISTRO}' is an unsupported ros2 distro.") +else() + add_compile_definitions("ROS_DISTRO=${index}") endif() set(distro_index 0) @@ -34,4 +36,3 @@ foreach(distro ${supported_distros}) MATH(EXPR distro_index "${distro_index}+1") endforeach() -add_compile_definitions("ROS_DISTRO=$") diff --git a/rmw_ecal_shared_cpp/src/features.cpp b/rmw_ecal_shared_cpp/src/features.cpp index 87ed2a8..8b910a2 100644 --- a/rmw_ecal_shared_cpp/src/features.cpp +++ b/rmw_ecal_shared_cpp/src/features.cpp @@ -1,10 +1,12 @@ -#if DISTRO >= HUMBLE +#if ROS_DISTRO >= HUMBLE #include +#include + bool rmw_feature_supported(rmw_feature_t feature) { - return false; + return eCAL::rmw::rmw_feature_supported(feature); } #endif