From 0a8b29bd5f89be9eda6f2f932e34ecdd9608578c Mon Sep 17 00:00:00 2001 From: Nathan Hughes Date: Thu, 12 Dec 2024 16:31:52 -0500 Subject: [PATCH] Fix/develop ci (#28) * fix ci build issue * update deprecated zmq functions --- include/spark_dsg/serialization/json_conversions.h | 2 +- include/spark_dsg/serialization/versioning.h | 1 + src/zmq_interface.cpp | 13 +++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/spark_dsg/serialization/json_conversions.h b/include/spark_dsg/serialization/json_conversions.h index 826ac62..16238f2 100644 --- a/include/spark_dsg/serialization/json_conversions.h +++ b/include/spark_dsg/serialization/json_conversions.h @@ -111,7 +111,7 @@ struct adl_serializer> { throw std::runtime_error(ss.str()); } - mat = Eigen::Matrix(rows, cols); + mat = Eigen::Matrix::Zero(rows, cols); for (size_t i = 0; i < vec->size(); ++i) { int r = i / cols; int c = i % cols; diff --git a/include/spark_dsg/serialization/versioning.h b/include/spark_dsg/serialization/versioning.h index 1ac6200..8b595ac 100644 --- a/include/spark_dsg/serialization/versioning.h +++ b/include/spark_dsg/serialization/versioning.h @@ -38,6 +38,7 @@ #include #include #include +#include #include namespace spark_dsg::io { diff --git a/src/zmq_interface.cpp b/src/zmq_interface.cpp index bcc3e34..1474ec4 100644 --- a/src/zmq_interface.cpp +++ b/src/zmq_interface.cpp @@ -101,17 +101,30 @@ struct ZmqReceiver::Detail { Detail(const std::string& url, size_t, bool conflate) { socket.reset(new zmq::socket_t(ZmqContextHolder::instance().context(), ZMQ_SUB)); socket->connect(url); +#if ZMQ_VERSION < ZMQ_MAKE_VERSION(4, 7, 0) socket->setsockopt(ZMQ_SUBSCRIBE, "", 0); +#else + socket->set(zmq::sockopt::subscribe, "", 0); +#endif + if (conflate) { int conflate_flag = 1; +#if ZMQ_VERSION < ZMQ_MAKE_VERSION(4, 7, 0) socket->setsockopt(ZMQ_CONFLATE, &conflate_flag, sizeof(conflate_flag)); +#else + socket->set(zmq::sockopt::conflate, &conflate_flag, sizeof(conflate_flag)); +#endif } } ~Detail() = default; bool recv(size_t timeout_ms) { +#if ZMQ_VERSION < ZMQ_MAKE_VERSION(4, 7, 1) if (!socket->connected()) { +#else + if (!socket) { +#endif return false; }