From c77e94a76cd502f608e23ff9fc6ea8d880541642 Mon Sep 17 00:00:00 2001 From: Filippo Brizzi Date: Thu, 24 Oct 2024 16:33:18 +0200 Subject: [PATCH] Update to Zenoh version 1.0.0 (#191) # Description Finally, zenoh released a stable v1.0.0. We are upgrading to that --- docker/Dockerfile | 2 +- docker/version.sh | 2 +- external/CMakeLists.txt | 13 +++++++++---- modules/ipc/src/zenoh/raw_publisher.cpp | 10 ++++------ modules/ipc/src/zenoh/raw_subscriber.cpp | 6 +++--- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index ae64defc..02650c34 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -35,7 +35,7 @@ RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-$CLANG_VE RUN ln -s /usr/bin/clangd-${CLANG_VERSION} /usr/bin/clangd -RUN export ZENOH_VERSION="1.0.0~beta.4-1" && \ +RUN export ZENOH_VERSION="1.0.0" && \ echo "deb [trusted=yes] https://download.eclipse.org/zenoh/debian-repo/ /" | tee /etc/apt/sources.list.d/zenoh.list >/dev/null && \ (apt-get update && apt-get install --no-install-recommends -y --allow-downgrades zenohd=${ZENOH_VERSION} zenoh-plugin-rest=${ZENOH_VERSION} || true) && \ sed -i 's/systemctl /# remove if fixed by zenoh: systemctl /' /var/lib/dpkg/info/zenohd.postinst && \ diff --git a/docker/version.sh b/docker/version.sh index 14bfd5e9..b6572cde 100644 --- a/docker/version.sh +++ b/docker/version.sh @@ -1,3 +1,3 @@ HOST=ghcr.io/olympus-robotics -VERSION=1.0.15 +VERSION=1.0.16 IMAGE=hephaestus-dev diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 3708d041..fe3485b2 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -43,18 +43,23 @@ set(ZENOHC_CMAKE_ARGS -DZENOHC_CARGO_CHANNEL=+stable -DZENOHC_BUILD_WITH_SHARED_ -DZENOHC_BUILD_WITH_UNSTABLE_API=TRUE ) if(NOT BUILD_SHARED_LIBS) - list(APPEND ZENOHC_CMAKE_ARGS "-DZENOHC_LIB_STATIC=TRUE" "-DZENOHC_INSTALL_STATIC_LIBRARY=TRUE") + list(APPEND ZENOHC_CMAKE_ARGS "-DZENOHC_INSTALL_STATIC_LIBRARY=TRUE") endif() -set(ZENOH_VERSION "1.0.0.10") +set(ZENOH_VERSION "release/1.0.0") add_cmake_dependency( - NAME zenohc URL https://github.com/eclipse-zenoh/zenoh-c/archive/${ZENOH_VERSION}.zip CMAKE_ARGS ${ZENOHC_CMAKE_ARGS} + NAME zenohc + GIT_REPOSITORY https://github.com/eclipse-zenoh/zenoh-c + GIT_TAG ${ZENOH_VERSION} + CMAKE_ARGS ${ZENOHC_CMAKE_ARGS} ) set(ZENOHCXX_VERSION ${ZENOH_VERSION}) set(ZENOHCXX_CMAKE_ARGS -DZ_FEATURE_UNSTABLE_API=1 -DZENOHCXX_EXAMPLES_PROTOBUF=OFF) add_cmake_dependency( NAME zenohcxx - DEPENDS ${ZENOHCXX_DEPENDS} URL https://github.com/eclipse-zenoh/zenoh-cpp/archive/${ZENOHCXX_VERSION}.zip + DEPENDS ${ZENOHCXX_DEPENDS} + GIT_REPOSITORY https://github.com/eclipse-zenoh/zenoh-cpp + GIT_TAG ${ZENOHCXX_VERSION} CMAKE_ARGS ${ZENOHCXX_CMAKE_ARGS} ) diff --git a/modules/ipc/src/zenoh/raw_publisher.cpp b/modules/ipc/src/zenoh/raw_publisher.cpp index c343a176..3aecf7c9 100644 --- a/modules/ipc/src/zenoh/raw_publisher.cpp +++ b/modules/ipc/src/zenoh/raw_publisher.cpp @@ -114,9 +114,8 @@ void RawPublisher::enableCache() { z_view_keyexpr_t keyexpr; z_view_keyexpr_from_str(&keyexpr, topic_config_.name.data()); - const auto result = ze_declare_publication_cache(&cache_publisher_, - ::zenoh::interop::as_loaned_c_ptr(session_->zenoh_session), - z_loan(keyexpr), &cache_publisher_opts); + const auto result = ze_declare_publication_cache(::zenoh::interop::as_loaned_c_ptr(session_->zenoh_session), + &cache_publisher_, z_loan(keyexpr), &cache_publisher_opts); throwExceptionIf( result != Z_OK, fmt::format("[Publisher {}] failed to enable cache, result {}", topic_config_.name, result)); @@ -140,9 +139,8 @@ void RawPublisher::enableMatchingListener() { this->match_cb_(status); }, []() {}); - - zc_publisher_matching_listener_declare(&subscriers_listener_, - ::zenoh::interop::as_loaned_c_ptr(*publisher_), z_move(closure)); + zc_publisher_declare_matching_listener(::zenoh::interop::as_loaned_c_ptr(*publisher_), + &subscriers_listener_, z_move(closure)); } void RawPublisher::createTypeInfoService() { diff --git a/modules/ipc/src/zenoh/raw_subscriber.cpp b/modules/ipc/src/zenoh/raw_subscriber.cpp index 9f8211dd..473c1add 100644 --- a/modules/ipc/src/zenoh/raw_subscriber.cpp +++ b/modules/ipc/src/zenoh/raw_subscriber.cpp @@ -76,9 +76,9 @@ RawSubscriber::RawSubscriber(SessionPtr session, TopicConfig topic_config, DataC auto c_closure = createZenohcClosure(cb, ::zenoh::closures::none); - const auto result = ze_declare_querying_subscriber( - &cache_subscriber_, ::zenoh::interop::as_loaned_c_ptr(session_->zenoh_session), z_loan(keyexpr), - z_move(c_closure), &sub_opts); + const auto result = + ze_declare_querying_subscriber(::zenoh::interop::as_loaned_c_ptr(session_->zenoh_session), + &cache_subscriber_, z_loan(keyexpr), z_move(c_closure), &sub_opts); heph::throwExceptionIf( result != Z_OK,