Skip to content

Commit

Permalink
Create distro.hpp config header for distro #defines
Browse files Browse the repository at this point in the history
Signed-off-by: Christophe Bedard <[email protected]>
  • Loading branch information
christophebedard committed Dec 21, 2024
1 parent 79fc5ce commit 61e1a4c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
16 changes: 16 additions & 0 deletions rmw_zenoh_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,22 @@ target_link_libraries(rmw_zenoh_cpp
zenohcxx::zenohc
)

# Get distro from ros_environment and create config header
set(ROS_DISTRO "$ENV{ROS_DISTRO}")
set(ROS_DISTRO_JAZZY OFF)
set(ROS_DISTRO_ROLLING OFF)
if(ROS_DISTRO STREQUAL "jazzy")
set(ROS_DISTRO_JAZZY ON)
elseif(ROS_DISTRO STREQUAL "rolling")
set(ROS_DISTRO_ROLLING ON)
else()
message(WARNING "Unexpected ROS_DISTRO: ${ROS_DISTRO}")
endif()
configure_file(include/${PROJECT_NAME}/distro.hpp.in include/${PROJECT_NAME}/distro.hpp)
target_include_directories(rmw_zenoh_cpp PRIVATE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>"
)

configure_rmw_library(rmw_zenoh_cpp)

target_compile_definitions(rmw_zenoh_cpp
Expand Down
21 changes: 21 additions & 0 deletions rmw_zenoh_cpp/include/rmw_zenoh_cpp/distro.hpp.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2024 Open Source Robotics Foundation, Inc.
//
// 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.

#ifndef RMW_ZENOH_CPP_DISTRO_HPP_
#define RMW_ZENOH_CPP_DISTRO_HPP_

#cmakedefine ROS_DISTRO_JAZZY
#cmakedefine ROS_DISTRO_ROLLING

#endif // RMW_ZENOH_CPP_DISTRO_HPP_
1 change: 1 addition & 0 deletions rmw_zenoh_cpp/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

<buildtool_depend>ament_cmake</buildtool_depend>

<build_depend>ros_environment</build_depend>
<build_depend>zenoh_cpp_vendor</build_depend>
<build_export_depend>zenoh_cpp_vendor</build_export_depend>

Expand Down

0 comments on commit 61e1a4c

Please sign in to comment.