mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2026-02-04 03:19:21 +00:00
fix(boost): add compatibility for Boost.Process v1 API in Boost 1.89+
Boost 1.88 replaced Boost.Process with v2, breaking the v1 API. Boost 1.89 restores v1 compatibility via <boost/process/v1.hpp>. - Fail configuration if Boost 1.88 is detected - Define FAIRMQ_BOOST_PROCESS_V1_HEADER for Boost >= 1.89 - Use conditional includes to select v1.hpp or process.hpp - Add namespace aliases (bp, bp_this) for portable API access
This commit is contained in:
committed by
Dennis Klein
parent
25abd605f3
commit
fa64faf3f7
@@ -176,6 +176,9 @@ if(BUILD_FAIRMQ)
|
||||
FAIRMQ_HAS_STD_FILESYSTEM=${FAIRMQ_HAS_STD_FILESYSTEM}
|
||||
FAIRMQ_HAS_STD_PMR=${FAIRMQ_HAS_STD_PMR}
|
||||
)
|
||||
if(FAIRMQ_BOOST_PROCESS_V1_HEADER)
|
||||
target_compile_definitions(${target} PRIVATE FAIRMQ_BOOST_PROCESS_V1_HEADER)
|
||||
endif()
|
||||
if(DEFINED FAIRMQ_CHANNEL_DEFAULT_AUTOBIND)
|
||||
# translate CMake boolean (TRUE, FALSE, 0, 1, OFF, ON) into C++ boolean literal (true, false)
|
||||
if(FAIRMQ_CHANNEL_DEFAULT_AUTOBIND)
|
||||
|
||||
@@ -11,7 +11,13 @@
|
||||
// Needed to compile-firewall the <boost/process/async.hpp> header because it
|
||||
// interferes with the <asio/buffer.hpp> header. So, let's factor
|
||||
// the whole dependency to Boost.Process out of the header.
|
||||
#ifdef FAIRMQ_BOOST_PROCESS_V1_HEADER
|
||||
#include <boost/process/v1.hpp>
|
||||
namespace bp = boost::process::v1;
|
||||
#else
|
||||
#include <boost/process.hpp>
|
||||
namespace bp = boost::process;
|
||||
#endif
|
||||
#include <fairlogger/Logger.h>
|
||||
|
||||
namespace fair::mq::shmem {
|
||||
@@ -28,7 +34,7 @@ bool Manager::SpawnShmMonitor(const std::string& id)
|
||||
path.emplace(path.begin(), env.at(fairmq_path_key).to_string());
|
||||
}
|
||||
|
||||
auto exe(boost::process::search_path(shmmonitor_exe_name, path));
|
||||
auto exe(bp::search_path(shmmonitor_exe_name, path));
|
||||
if (exe.empty()) {
|
||||
LOG(warn) << "could not find " << shmmonitor_exe_name << " in \"$" << fairmq_path_key
|
||||
<< ":$PATH\"";
|
||||
@@ -39,7 +45,7 @@ bool Manager::SpawnShmMonitor(const std::string& id)
|
||||
bool verbose(env.count(shmmonitor_verbose_key)
|
||||
&& env.at(shmmonitor_verbose_key).to_string() == "true");
|
||||
|
||||
boost::process::spawn(
|
||||
bp::spawn(
|
||||
exe, "-x", "-m", "--shmid", id, "-d", "-t", "2000", (verbose ? "--verbose" : ""), env);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -10,7 +10,11 @@
|
||||
#include <fairmq/tools/Strings.h>
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#ifdef FAIRMQ_BOOST_PROCESS_V1_HEADER
|
||||
#include <boost/process/v1.hpp>
|
||||
#else
|
||||
#include <boost/process.hpp>
|
||||
#endif
|
||||
#include <chrono>
|
||||
#include <csignal> // kill, signals
|
||||
#include <iostream>
|
||||
@@ -20,7 +24,11 @@
|
||||
#include <utility>
|
||||
|
||||
using namespace std;
|
||||
#ifdef FAIRMQ_BOOST_PROCESS_V1_HEADER
|
||||
namespace bp = boost::process::v1;
|
||||
#else
|
||||
namespace bp = boost::process;
|
||||
#endif
|
||||
namespace ba = boost::asio;
|
||||
namespace bs = boost::system;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user