Skip to content

Commit

Permalink
Move to Clang 17 (#146)
Browse files Browse the repository at this point in the history
# Description
Move to Clang 17, this is needed due to
llvm/llvm-project#106204 and
llvm/llvm-project#96210 (comment).

In addition, we install `ssh` package.

---------

Co-authored-by: Filippo Brizzi <[email protected]>
  • Loading branch information
lhruby and filippobrizzi authored Aug 29, 2024
1 parent 86a17a1 commit 793115b
Show file tree
Hide file tree
Showing 40 changed files with 75 additions and 69 deletions.
6 changes: 3 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ FROM ${BASE_IMAGE}
ENV DEBIAN_FRONTEND=noninteractive

RUN apt update && \
apt install -y --no-install-recommends x11-apps g++ mesa-utils make cmake-curses-gui ninja-build git gdb vim htop \
apt install -y --no-install-recommends x11-apps g++ mesa-utils make cmake-curses-gui ninja-build git gdb vim htop ssh \
curl zlib1g-dev libffi-dev libssl-dev libbz2-dev libsqlite3-dev iproute2 tk-dev texlive-latex-extra texlive-fonts-recommended dvipng cm-super libnotify-bin \
pkg-config gpg wget ca-certificates git-lfs curl ccache ninja-build doxygen graphviz linux-generic python3-dev python3-pip iproute2 python-is-python3 \
net-tools iftop htop lsb-release software-properties-common gnupg bash-completion psmisc less tree && \
rm -rf /var/lib/apt/lists/*
RUN python3 -m pip install cmakelang
RUN python3 -m pip install cmakelang six

RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null && \
echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/kitware.list >/dev/null && \
Expand All @@ -19,7 +19,7 @@ RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/nul
apt install -y kitware-archive-keyring cmake && \
rm -rf /var/lib/apt/lists/*

ENV CLANG_VERSION=18
ENV CLANG_VERSION=17
RUN wget https://apt.llvm.org/llvm.sh && \
sed -i "s/add-apt-repository \"${REPO_NAME}\"/add-apt-repository \"${REPO_NAME}\" -y/g" llvm.sh && \
chmod +x llvm.sh && \
Expand Down
4 changes: 2 additions & 2 deletions docker/version.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
HOST=ghcr.io/olympus-robotics
VERSION=1.0.7
VERSION=1.0.9
IMAGE=hephaestus-dev

# This is the version of the dep image. Increase this number everytime you change `external/CMakeLists.txt`
DEPS_VERSION=1.0.25
DEPS_VERSION=1.0.26
1 change: 0 additions & 1 deletion modules/bag/src/writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "hephaestus/bag/writer.h"

#include <cctype>
#include <cstddef>
#include <cstdint>
#include <memory>
Expand Down
6 changes: 4 additions & 2 deletions modules/bag/tests/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
// Copyright (C) 2023-2024 HEPHAESTUS Contributors
//=================================================================================================

#include <chrono>
#include <cstddef>
#include <memory>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
Expand Down Expand Up @@ -36,8 +38,8 @@ constexpr auto SENDER_ID = "bag_tester";
constexpr auto ROBOT_TOPIC = "robot";
constexpr auto FLEET_TOPIC = "fleet";

[[nodiscard]] auto
createBag() -> std::tuple<utils::filesystem::ScopedPath, std::vector<Robot>, std::vector<Fleet>> {
[[nodiscard]] auto createBag()
-> std::tuple<utils::filesystem::ScopedPath, std::vector<Robot>, std::vector<Fleet>> {
auto scoped_path = utils::filesystem::ScopedPath::createFile();
auto mcap_writer = createMcapWriter({ scoped_path });

Expand Down
1 change: 1 addition & 0 deletions modules/cli/examples/example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <cstdio>
#include <cstdlib>
#include <exception>
#include <string>
#include <tuple>
#include <utility>

Expand Down
20 changes: 10 additions & 10 deletions modules/cli/include/hephaestus/cli/program_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ class ProgramDescription {
/// @param description A brief text describing the option
/// @return Reference to the object. Enables daisy-chained calls
template <StringStreamable T>
auto defineOption(const std::string& key, char short_key,
const std::string& description) -> ProgramDescription&;
auto defineOption(const std::string& key, char short_key, const std::string& description)
-> ProgramDescription&;

/// @brief Defines a command line option (--key=value) that is optional
/// @tparam T Value type
Expand All @@ -96,8 +96,8 @@ class ProgramDescription {
/// @param default_value Default value to use if the option is not specified on the command line
/// @return Reference to the object. Enables daisy-chained calls
template <StringStreamable T>
auto defineOption(const std::string& key, const std::string& description,
const T& default_value) -> ProgramDescription&;
auto defineOption(const std::string& key, const std::string& description, const T& default_value)
-> ProgramDescription&;

/// @brief Defines a command line option (--key=value) that is optional
/// @tparam T Value type
Expand All @@ -116,8 +116,8 @@ class ProgramDescription {
/// @param short_key Single char (can be used as alias for --key)
/// @param description A brief text describing the option
/// @return Reference to the object. Enables daisy-chained calls
auto defineFlag(const std::string& key, char short_key,
const std::string& description) -> ProgramDescription&;
auto defineFlag(const std::string& key, char short_key, const std::string& description)
-> ProgramDescription&;

/// @brief Defines a boolean option (flag) (--key=value) on the command line. If the flag is
/// passed the value of the option is true, false otherwise.
Expand Down Expand Up @@ -156,14 +156,14 @@ class ProgramDescription {
};

template <StringStreamable T>
auto ProgramDescription::defineOption(const std::string& key,
const std::string& description) -> ProgramDescription& {
auto ProgramDescription::defineOption(const std::string& key, const std::string& description)
-> ProgramDescription& {
return defineOption<T>(key, '\0', description);
}

template <StringStreamable T>
auto ProgramDescription::defineOption(const std::string& key, char short_key,
const std::string& description) -> ProgramDescription& {
auto ProgramDescription::defineOption(const std::string& key, char short_key, const std::string& description)
-> ProgramDescription& {
checkOptionAlreadyExists(key, short_key);

options_.emplace_back(key, short_key, description, utils::getTypeName<T>(), "", true, false);
Expand Down
8 changes: 4 additions & 4 deletions modules/cli/src/program_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ void ProgramDescription::checkOptionAlreadyExists(const std::string& key, char k
fmt::format("Attempted redefinition of short key '{}' for option '{}'", k, key));
}

auto ProgramDescription::defineFlag(const std::string& key, char short_key,
const std::string& description) -> ProgramDescription& {
auto ProgramDescription::defineFlag(const std::string& key, char short_key, const std::string& description)
-> ProgramDescription& {
checkOptionAlreadyExists(key, short_key);

options_.emplace_back(key, short_key, description, utils::getTypeName<bool>(), "false", false, false);
return *this;
}

auto ProgramDescription::defineFlag(const std::string& key,
const std::string& description) -> ProgramDescription& {
auto ProgramDescription::defineFlag(const std::string& key, const std::string& description)
-> ProgramDescription& {
return defineFlag(key, '\0', description);
}

Expand Down
1 change: 1 addition & 0 deletions modules/cli/tests/program_options_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//=================================================================================================
// Copyright (C) 2023-2024 HEPHAESTUS Contributors
//=================================================================================================
#include <string>
#include <utility>

#include <gtest/gtest.h>
Expand Down
1 change: 0 additions & 1 deletion modules/containers/examples/blocking_queue_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Copyright (C) 2023-2024 HEPHAESTUS Contributors
//=================================================================================================

#include <cstdlib>
#include <exception>
#include <string>
#include <utility>
Expand Down
1 change: 1 addition & 0 deletions modules/examples/examples/mcap_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright (C) 2023-2024 HEPHAESTUS Contributors
//=================================================================================================

#include <cstdio>
#include <cstdlib>
#include <exception>
#include <filesystem>
Expand Down
3 changes: 2 additions & 1 deletion modules/examples/examples/mcap_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <chrono>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <exception>
#include <filesystem>
Expand Down Expand Up @@ -39,7 +40,7 @@ auto main(int argc, const char* argv[]) -> int {
auto frame_time = start_time + i * INTERVAL;

heph::examples::types::Pose pose;
pose.position = Eigen::Vector3d{ static_cast<double>(i), 2, 3 };
pose.position = Eigen::Vector3d{ static_cast<double>(i), 2, 3 }; // NOLINT
const auto data = heph::serdes::serialize(pose);
const heph::ipc::MessageMetadata metadata{
.sender_id = "myself", .topic = "pose", .timestamp = frame_time, .sequence_id = i
Expand Down
5 changes: 2 additions & 3 deletions modules/examples/examples/serdes_examples.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ auto main(int argc, const char* argv[]) -> int {
(void)argv;
try {
heph::examples::types::Pose pose;
pose.position = Eigen::Vector3d{ 1, 2, 3 };
pose.orientation =
Eigen::Quaterniond{ 1., 0.1, 0.2, 0.3 }; // NOLINT(cppcoreguidelines-avoid-magic-numbers)
pose.position = Eigen::Vector3d{ 1, 2, 3 }; // NOLINT
pose.orientation = Eigen::Quaterniond{ 1., 0.1, 0.2, 0.3 }; // NOLINT

const auto json_string = heph::serdes::serializeToJSON(pose);
fmt::print("Pose serialized to JSON:\n{}\n", json_string);
Expand Down
1 change: 1 addition & 0 deletions modules/examples/examples/zenoh_action_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <atomic>
#include <chrono>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <exception>
#include <functional>
Expand Down
1 change: 1 addition & 0 deletions modules/examples/examples/zenoh_action_server_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//=================================================================================================

#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <exception>
#include <functional>
Expand Down
8 changes: 4 additions & 4 deletions modules/examples/examples/zenoh_program_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

enum class ExampleType : uint8_t { PUBSUB, SERVICE, ACTION_SERVER };

[[nodiscard]] inline auto getProgramDescription(const std::string& description,
const ExampleType type) -> heph::cli::ProgramDescription {
[[nodiscard]] inline auto getProgramDescription(const std::string& description, const ExampleType type)
-> heph::cli::ProgramDescription {
static constexpr auto DEFAULT_PUBSUB_KEY = "hephaestus/ipc/example/zenoh/put";
static constexpr auto DEFAULT_SERVICE_KEY = "hephaestus/ipc/example/zenoh/service";
static constexpr auto DEFAULT_ACTION_SERVER_KEY = "hephaestus/ipc/example/zenoh/action_server";
Expand Down Expand Up @@ -38,8 +38,8 @@ enum class ExampleType : uint8_t { PUBSUB, SERVICE, ACTION_SERVER };
return desc;
}

[[nodiscard]] inline auto
parseArgs(const heph::cli::ProgramOptions& args) -> std::pair<heph::ipc::Config, heph::ipc::TopicConfig> {
[[nodiscard]] inline auto parseArgs(const heph::cli::ProgramOptions& args)
-> std::pair<heph::ipc::Config, heph::ipc::TopicConfig> {
heph::ipc::TopicConfig topic_config{ .name = args.getOption<std::string>("topic") };

heph::ipc::Config config;
Expand Down
6 changes: 2 additions & 4 deletions modules/examples/examples/zenoh_pub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
//=================================================================================================

#include <chrono>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <exception>
Expand Down Expand Up @@ -47,9 +46,8 @@ auto main(int argc, const char* argv[]) -> int {
double count = 0;
while (!heph::utils::TerminationBlocker::stopRequested()) {
heph::examples::types::Pose pose;
pose.position = Eigen::Vector3d{ 1, 2, count++ };
pose.orientation =
Eigen::Quaterniond{ 1., 0.1, 0.2, 0.3 }; // NOLINT(cppcoreguidelines-avoid-magic-numbers)
pose.position = Eigen::Vector3d{ 1, 2, count++ }; // NOLINT
pose.orientation = Eigen::Quaterniond{ 1., 0.1, 0.2, 0.3 }; // NOLINT

fmt::println("Publishing Data ('{} : {})", topic_config.name, pose);
auto res = publisher.publish(pose);
Expand Down
3 changes: 2 additions & 1 deletion modules/examples/examples/zenoh_service_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <cstdio>
#include <cstdlib>
#include <exception>
#include <string>
#include <tuple>
#include <utility>

Expand Down Expand Up @@ -34,7 +35,7 @@ auto main(int argc, const char* argv[]) -> int {
static constexpr auto K_TIMEOUT = std::chrono::seconds(10);
const auto query =
heph::examples::types::Pose{ .orientation = Eigen::Quaterniond{ 1., 0.3, 0.2, 0.1 }, // NOLINT
.position = Eigen::Vector3d{ 3, 2, 1 } };
.position = Eigen::Vector3d{ 3, 2, 1 } }; // NOLINT
LOG(INFO) << fmt::format("Calling service on topic: {} with {}.", topic_config.name, query);
const auto replies =
heph::ipc::zenoh::callService<heph::examples::types::Pose, heph::examples::types::Pose>(
Expand Down
3 changes: 1 addition & 2 deletions modules/examples/examples/zenoh_service_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Copyright (C) 2023-2024 HEPHAESTUS Contributors
//=================================================================================================

#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <exception>
Expand Down Expand Up @@ -34,7 +33,7 @@ auto main(int argc, const char* argv[]) -> int {
LOG(INFO) << fmt::format("Received query: {}", sample);
heph::examples::types::Pose sample_reply{
.orientation = Eigen::Quaterniond{ 1., 0.1, 0.2, 0.3 }, // NOLINT
.position = Eigen::Vector3d{ 1, 2, 3 },
.position = Eigen::Vector3d{ 1, 2, 3 }, // NOLINT
};
return sample_reply;
};
Expand Down
1 change: 1 addition & 0 deletions modules/examples/examples/zenoh_string_service_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <cstdio>
#include <cstdlib>
#include <exception>
#include <string>
#include <tuple>
#include <utility>

Expand Down
1 change: 0 additions & 1 deletion modules/examples/examples/zenoh_string_service_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Copyright (C) 2023-2024 HEPHAESTUS Contributors
//=================================================================================================

#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <exception>
Expand Down
1 change: 0 additions & 1 deletion modules/examples/examples/zenoh_sub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
//=================================================================================================

#include <chrono>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <exception>
Expand Down
4 changes: 2 additions & 2 deletions modules/ipc/include/hephaestus/ipc/program_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace heph::ipc {

void appendIPCProgramOption(cli::ProgramDescription& program_description);

[[nodiscard]] auto
parseIPCProgramOptions(const heph::cli::ProgramOptions& args) -> std::pair<Config, TopicConfig>;
[[nodiscard]] auto parseIPCProgramOptions(const heph::cli::ProgramOptions& args)
-> std::pair<Config, TopicConfig>;

} // namespace heph::ipc
4 changes: 2 additions & 2 deletions modules/ipc/include/hephaestus/ipc/topic_database.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace zenoh {
struct Session;
}

[[nodiscard]] auto
createZenohTopicDatabase(std::shared_ptr<zenoh::Session> session) -> std::unique_ptr<ITopicDatabase>;
[[nodiscard]] auto createZenohTopicDatabase(std::shared_ptr<zenoh::Session> session)
-> std::unique_ptr<ITopicDatabase>;

} // namespace heph::ipc
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ template <typename RequestT, typename StatusT, typename ReplyT>
-> std::future<Response<ReplyT>>;

/// Request the action server to stop.
[[nodiscard]] auto requestActionServerToStopExecution(Session& session,
const TopicConfig& topic_config) -> bool;
[[nodiscard]] auto requestActionServerToStopExecution(Session& session, const TopicConfig& topic_config)
-> bool;

// TODO: add a function to get notified when the server is idle again.

Expand Down
1 change: 1 addition & 0 deletions modules/ipc/src/zenoh/action_server/action_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "hephaestus/ipc/zenoh/action_server/action_server.h"

#include <chrono>
#include <string>

#include <absl/log/log.h>
Expand Down
1 change: 1 addition & 0 deletions modules/ipc/src/zenoh/liveliness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <zenoh/api/enums.hxx>
#include <zenoh/api/keyexpr.hxx>
#include <zenoh/api/reply.hxx>
#include <zenoh/api/sample.hxx>
#include <zenoh/api/subscriber.hxx>

#include "hephaestus/ipc/common.h"
Expand Down
4 changes: 2 additions & 2 deletions modules/ipc/src/zenoh/publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ inline void zenohOnMatchingStatus(const ::zc_matching_status_t* matching_status,
}

template <typename C, typename D>
[[nodiscard]] auto createZenohcClosureMatchingStatus(C&& on_matching_status,
D&& on_drop) -> zc_owned_closure_matching_status_t {
[[nodiscard]] auto createZenohcClosureMatchingStatus(C&& on_matching_status, D&& on_drop)
-> zc_owned_closure_matching_status_t {
zc_owned_closure_matching_status_t c_closure;
using Cval = std::remove_reference_t<C>;
using Dval = std::remove_reference_t<D>;
Expand Down
7 changes: 4 additions & 3 deletions modules/ipc/src/zenoh/scout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ namespace heph::ipc::zenoh {

namespace {

[[nodiscard]] inline auto
toStringVector(const std::vector<std::string_view>& str_vec) -> std::vector<std::string> {
[[nodiscard]] inline auto toStringVector(const std::vector<std::string_view>& str_vec)
-> std::vector<std::string> {
std::vector<std::string> output_vec;
output_vec.reserve(str_vec.size());
for (const auto& str : str_vec) {
Expand Down Expand Up @@ -102,7 +102,8 @@ auto getListOfNodes() -> std::vector<NodeInfo> {
ScoutDataManager manager;

auto config = ::zenoh::Config::create_default();
::zenoh::scout(std::move(config), [&manager](const auto& hello) { manager.onDiscovery(hello); }, []() {});
::zenoh::scout(
std::move(config), [&manager](const auto& hello) { manager.onDiscovery(hello); }, []() {});

auto nodes = manager.getNodesInfo();

Expand Down
Loading

0 comments on commit 793115b

Please sign in to comment.