Skip to content

Commit

Permalink
Move from ament_vendor to ExternalProject_Add
Browse files Browse the repository at this point in the history
  • Loading branch information
imstevenpmwork committed Jul 18, 2024
1 parent ba3b863 commit d3fabb4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
5 changes: 1 addition & 4 deletions rmw_zenoh_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ endif()

# find dependencies
find_package(ament_cmake REQUIRED)

find_package(zenohc REQUIRED)
find_package(ament_index_cpp REQUIRED)
find_package(fastcdr CONFIG REQUIRED)
find_package(rcpputils REQUIRED)
Expand All @@ -23,9 +23,6 @@ find_package(rosidl_typesupport_fastrtps_cpp REQUIRED)
find_package(rmw REQUIRED)
find_package(zenoh_c_vendor REQUIRED)
find_package(zenohc_debug QUIET)
if(NOT zenohc_debug_FOUND)
find_package(zenohc REQUIRED)
endif()

add_library(rmw_zenoh_cpp SHARED
src/detail/attachment_helpers.cpp
Expand Down
42 changes: 22 additions & 20 deletions zenoh_c_vendor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,28 @@ if(NOT CMAKE_CXX_STANDARD)
endif()

find_package(ament_cmake REQUIRED)
find_package(ament_cmake_vendor_package REQUIRED)

# Disable default features and enable only the most useful ones. This reduces build time and footprint.
# For a complete list of features see: https://github.com/eclipse-zenoh/zenoh/blob/main/zenoh/Cargo.toml
# Note: We separate the two args needed for cargo with "$<SEMICOLON>" and not ";" as the
# latter is a list separater in cmake and hence the string will be split into two
# when expanded.
set(ZENOHC_CARGO_FLAGS "--no-default-features$<SEMICOLON>--features=shared-memory zenoh/transport_compression zenoh/transport_tcp zenoh/transport_tls")

# Set VCS_VERSION to include latest changes from zenoh-c to benefit from :
# - https://github.com/eclipse-zenoh/zenoh-c/pull/340 (fix build issue)
# - https://github.com/eclipse-zenoh/zenoh/pull/1021 (fix timeout issue with queries)
# - https://github.com/eclipse-zenoh/zenoh/pull/1022 (fix empty messages received if payload >btach size)
# - https://github.com/eclipse-zenoh/zenoh-c/pull/358 (fix debian packaging issue: https://github.com/jspricke/ros-deb-builder-action/issues/49)
# - https://github.com/eclipse-zenoh/zenoh/pull/1150 (fix deadlock issue https://github.com/ros2/rmw_zenoh/issues/182)
ament_vendor(zenoh_c_vendor
VCS_URL https://github.com/eclipse-zenoh/zenoh-c
VCS_VERSION dev/1.0.0
CMAKE_ARGS
"-DZENOHC_CARGO_FLAGS=${ZENOHC_CARGO_FLAGS}"

# Include the ExternalProject module
include(ExternalProject)

# Define installation directory
set(ZENOHC_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})

# Add the external project
ExternalProject_Add(zenohc
PREFIX ${CMAKE_BINARY_DIR}/zenohc
GIT_REPOSITORY https://github.com/eclipse-zenoh/zenoh-c.git
GIT_TAG dev/1.0.0
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${ZENOHC_INSTALL_DIR}
BUILD_IN_SOURCE 1
)

# Create a custom target to manage dependencies
add_custom_target(zenoh_c_vendor ALL
DEPENDS zenohc
)

# Add the installation directory to CMAKE_PREFIX_PATH
list(APPEND CMAKE_PREFIX_PATH ${ZENOHC_INSTALL_DIR})

ament_package()

0 comments on commit d3fabb4

Please sign in to comment.