Skip to content

Commit

Permalink
fixing compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
MelamudMichael committed Mar 10, 2024
1 parent 39fecbe commit 8ab3cf3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 32 deletions.
40 changes: 13 additions & 27 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if(BUILD_UNBUNDLED)
find_package(zenohc REQUIRED)
else()
find_library(ZENOH_LIB zenohc)
find_package(up-cpp REQUIRED)
find_package(up-cpp QUIET)
endif()

# Support pulling headers outside of /usr/local
Expand All @@ -40,42 +40,28 @@ set(SRC_FILES
src/zenohRpcClient.cpp
src/zenohSessionManager.cpp
src/messageBuilder.cpp
src/messageParser.cpp
)
src/messageParser.cpp)

add_library(${PROJECT_NAME} ${SRC_FILES})
add_library(up-client-zenoh-cpp::${PROJECT_NAME} ALIAS ${PROJECT_NAME})

target_include_directories(${PROJECT_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src)

if(BUILD_UNBUNDLED)
target_include_directories(${PROJECT_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_link_libraries(${PROJECT_NAME}
PRIVATE
up-cpp::up-cpp
zenohc::lib
)
zenohc::lib)
else()
target_include_directories(${PROJECT_NAME}
PRIVATE
${up-cpp_INCLUDE_DIR}
include
)
if (${up-cpp_FOUND})
target_link_libraries(${PROJECT_NAME}
PRIVATE
target_link_libraries(${PROJECT_NAME}
PUBLIC
up-cpp::up-cpp
${ZENOH_LIB})
else()
target_link_libraries(${PROJECT_NAME}
PRIVATE
up-cpp
${ZENOH_LIB})
endif()
${ZENOH_LIB})
endif()

INSTALL(TARGETS ${PROJECT_NAME})
Expand Down
10 changes: 5 additions & 5 deletions lib/src/zenohRpcClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,25 +119,25 @@ std::future<UPayload> ZenohRpcClient::invokeMethod(const UUri &uri,

if (0 == refCount_) {
spdlog::error("ZenohRpcClient is not initialized");
return std::move(future);
return future;
}

if (false == isRPCMethod(uri.resource())) {
spdlog::error("URI is not of RPC type");
return std::move(future);
return future;
}

if (UMessageType::REQUEST != attributes.type()) {
spdlog::error("Wrong message type = {}", UMessageTypeToString(attributes.type()).value());
return std::move(future);
return future;
}

auto uriHash = std::hash<std::string>{}(LongUriSerializer::serialize(uri));

auto header = MessageBuilder::buildHeader(attributes);
if (header.empty()) {
spdlog::error("Failed to build header");
return std::move(future);
return future;
}

z_bytes_t bytes;
Expand Down Expand Up @@ -167,7 +167,7 @@ std::future<UPayload> ZenohRpcClient::invokeMethod(const UUri &uri,
if (0 != z_get(z_loan(session_), z_keyexpr(std::to_string(uriHash).c_str()), "", z_move(channel->send), &opts)) {
spdlog::error("z_get failure");
z_drop(&map);
return std::move(future);
return future;
}

future = threadPool_->submit(handleReply, channel);
Expand Down

0 comments on commit 8ab3cf3

Please sign in to comment.