mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-22 21:50:51 -05:00
Build against recent system Boost (>= 1.87) (#15835)
Boost 1.87 removed io_service and io_context::reset(), and 1.88 moved the classic Boost.Process API under boost/process/v1/ and dropped deadline_timer from boost/asio.hpp. Use io_context, restart() and steady_timer, and include Boost.Process only through the new slic3r/Utils/BoostProcessCompat.hpp, which picks the v1 headers on 1.88+. The bundled Boost 1.84 build is unchanged.
This commit is contained in:
1 parent
887a8f1806
commit
88890b9bb1
14 files changed
+69
-72
No files matched your search
+3
-1
@@ -27,6 +27,7 @@ CheckOptions:
|
||||
# are included through clipper2/clipper.h, or clipper2_z.hpp, which defines
|
||||
# USINGZ first. minilzo's config
|
||||
# headers are internal to minilzo.h.
|
||||
# The boost/process headers are only included through Utils/BoostProcessCompat.hpp.
|
||||
# FFmpeg's C headers are left alone because they are only included inside
|
||||
# extern "C", which an inserted include would miss. OS-specific headers (GLib,
|
||||
# GTK, D-Bus, POSIX, the Windows SDK) are only used inside platform #if blocks,
|
||||
@@ -72,4 +73,5 @@ CheckOptions:
|
||||
mcut[/\\]platform\.h;
|
||||
boost[/\\]polygon[/\\].*;
|
||||
clipper2[/\\]clipper\.(core|engine|offset|minkowski|rectclip|export|triangulation|version)\.h;
|
||||
lzo(conf|defs)\.h
|
||||
lzo(conf|defs)\.h;
|
||||
boost[/\\]process[/\\].*
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <boost/asio/ip/basic_endpoint.hpp>
|
||||
#include <functional>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
#include <boost/asio/streambuf.hpp>
|
||||
#include <iostream>
|
||||
@@ -137,7 +137,7 @@ private:
|
||||
{
|
||||
public:
|
||||
HttpServer& server;
|
||||
boost::asio::io_service io_service;
|
||||
boost::asio::io_context io_service;
|
||||
boost::asio::ip::tcp::acceptor acceptor;
|
||||
std::set<std::shared_ptr<session>> sessions;
|
||||
|
||||
|
||||
@@ -41,10 +41,6 @@
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <boost/process/pipe.hpp>
|
||||
#include <boost/process/start_dir.hpp>
|
||||
#include <boost/process/io.hpp>
|
||||
#include <boost/process/handles.hpp>
|
||||
#include <exception>
|
||||
#include <slic3r/GUI/DeviceManager.hpp>
|
||||
#include <string>
|
||||
@@ -63,10 +59,8 @@
|
||||
#include <wx/utils.h>
|
||||
#include <wx/uri.h>
|
||||
#undef pid_t
|
||||
#include <boost/process.hpp>
|
||||
#ifdef __WIN32__
|
||||
#include <boost/process/windows.hpp>
|
||||
#else
|
||||
#include <slic3r/Utils/BoostProcessCompat.hpp>
|
||||
#ifndef __WIN32__
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
#endif
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
|
||||
// BBS
|
||||
#include <algorithm>
|
||||
#include <boost/process/pipe.hpp>
|
||||
#include <boost/process/io.hpp>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <exception>
|
||||
@@ -187,7 +185,7 @@ static int run_script(const std::string& script, const std::string& gcode, std::
|
||||
// POSIX
|
||||
|
||||
#include <cstdlib> // getenv()
|
||||
#include <boost/process.hpp>
|
||||
#include <slic3r/Utils/BoostProcessCompat.hpp>
|
||||
|
||||
namespace process = boost::process;
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
#include "ProcessRunner.hpp"
|
||||
|
||||
#include <boost/process/cmd.hpp>
|
||||
#include <boost/process/args.hpp>
|
||||
#include <boost/process/env.hpp>
|
||||
#include <boost/process.hpp>
|
||||
#include <slic3r/Utils/BoostProcessCompat.hpp>
|
||||
#include <wx/event.h>
|
||||
#include <wx/timer.h>
|
||||
#include <string>
|
||||
@@ -12,12 +9,7 @@
|
||||
#include <vector>
|
||||
#include <system_error>
|
||||
#include <memory>
|
||||
#include <boost/process/pipe.hpp>
|
||||
#include <boost/process/io.hpp>
|
||||
#include <exception>
|
||||
#ifdef _WIN32
|
||||
#include <boost/process/windows.hpp>
|
||||
#endif
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef slic3r_GUI_ProcessRunner_hpp_
|
||||
#define slic3r_GUI_ProcessRunner_hpp_
|
||||
|
||||
#include <boost/process/pipe.hpp>
|
||||
#include <slic3r/Utils/BoostProcessCompat.hpp>
|
||||
#include <wx/event.h>
|
||||
#include <wx/timer.h>
|
||||
|
||||
@@ -13,10 +13,6 @@
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
#include <boost/process.hpp>
|
||||
|
||||
namespace boost::process { class child; }
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
class ProcessRunner : public wxEvtHandler
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
#include "libslic3r/Platform.hpp"
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <cstddef>
|
||||
#include <boost/process/pipe.hpp>
|
||||
#include <boost/process/search_path.hpp>
|
||||
#include <boost/process/io.hpp>
|
||||
#include <cassert>
|
||||
#include <algorithm>
|
||||
#include <boost/bind/bind.hpp>
|
||||
@@ -39,7 +36,7 @@
|
||||
#include <pwd.h>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/system/error_code.hpp>
|
||||
#include <boost/process.hpp>
|
||||
#include <slic3r/Utils/BoostProcessCompat.hpp>
|
||||
#endif
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "WebUserLoginDialog.hpp"
|
||||
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
#include "slic3r/GUI/HttpServer.hpp"
|
||||
#include <memory>
|
||||
@@ -70,7 +70,7 @@ namespace {
|
||||
int reserve_loopback_port()
|
||||
{
|
||||
try {
|
||||
boost::asio::io_service io_service;
|
||||
boost::asio::io_context io_service;
|
||||
boost::asio::ip::tcp::acceptor acceptor(io_service, {boost::asio::ip::tcp::v4(), 0});
|
||||
return static_cast<int>(acceptor.local_endpoint().port());
|
||||
} catch (...) {
|
||||
|
||||
@@ -2,19 +2,21 @@
|
||||
|
||||
#include <boost/optional/optional.hpp>
|
||||
#include <boost/asio/ip/udp.hpp>
|
||||
#include <chrono>
|
||||
#include <cstddef>
|
||||
#include <boost/none.hpp>
|
||||
#include <boost/asio/ip/address_v4.hpp>
|
||||
#include <boost/asio/ip/address_v6.hpp>
|
||||
#include <boost/asio/ip/address.hpp>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <boost/asio/ip/multicast.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/asio/placeholders.hpp>
|
||||
#include <boost/asio/post.hpp>
|
||||
#include <cassert>
|
||||
#include <cctype>
|
||||
#include <boost/asio/ip/host_name.hpp>
|
||||
#include <boost/asio/deadline_timer.hpp>
|
||||
#include <boost/asio/steady_timer.hpp>
|
||||
#include <cstdint>
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
@@ -29,7 +31,6 @@
|
||||
#include <map>
|
||||
#include <thread>
|
||||
#include <boost/endian/conversion.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time_duration.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/log/trivial.hpp>
|
||||
#include <boost/bind/bind.hpp>
|
||||
@@ -641,7 +642,7 @@ UdpSession::UdpSession(Bonjour::ReplyFn rfn) : replyfn(rfn)
|
||||
buffer.resize(DnsMessage::MAX_SIZE);
|
||||
}
|
||||
|
||||
UdpSocket::UdpSocket( Bonjour::ReplyFn replyfn, const asio::ip::address& multicast_address, const asio::ip::address& interface_address, std::shared_ptr< boost::asio::io_service > io_service)
|
||||
UdpSocket::UdpSocket( Bonjour::ReplyFn replyfn, const asio::ip::address& multicast_address, const asio::ip::address& interface_address, std::shared_ptr< boost::asio::io_context > io_service)
|
||||
: replyfn(replyfn)
|
||||
, multicast_address(multicast_address)
|
||||
, socket(*io_service)
|
||||
@@ -675,7 +676,7 @@ UdpSocket::UdpSocket( Bonjour::ReplyFn replyfn, const asio::ip::address& multica
|
||||
}
|
||||
|
||||
|
||||
UdpSocket::UdpSocket( Bonjour::ReplyFn replyfn, const asio::ip::address& multicast_address, std::shared_ptr< boost::asio::io_service > io_service)
|
||||
UdpSocket::UdpSocket( Bonjour::ReplyFn replyfn, const asio::ip::address& multicast_address, std::shared_ptr< boost::asio::io_context > io_service)
|
||||
: replyfn(replyfn)
|
||||
, multicast_address(multicast_address)
|
||||
, socket(*io_service)
|
||||
@@ -731,7 +732,7 @@ void UdpSocket::receive_handler(SharedSession session, const boost::system::erro
|
||||
// let io_service to handle the datagram on session
|
||||
// from boost documentation io_service::post:
|
||||
// The io_service guarantees that the handler will only be called in a thread in which the run(), run_one(), poll() or poll_one() member functions is currently being invoked.
|
||||
io_service->post(boost::bind(&UdpSession::handle_receive, session, error, bytes));
|
||||
boost::asio::post(*io_service, boost::bind(&UdpSession::handle_receive, session, error, bytes));
|
||||
// immediately accept new datagrams
|
||||
async_receive();
|
||||
}
|
||||
@@ -888,7 +889,7 @@ void Bonjour::priv::lookup_perform()
|
||||
{
|
||||
service_dn = (boost::format("_%1%._%2%.local") % service % protocol).str();
|
||||
|
||||
std::shared_ptr< boost::asio::io_service > io_service(new boost::asio::io_service);
|
||||
std::shared_ptr< boost::asio::io_context > io_service(new boost::asio::io_context);
|
||||
|
||||
std::vector<LookupSocket*> sockets;
|
||||
|
||||
@@ -940,7 +941,7 @@ void Bonjour::priv::lookup_perform()
|
||||
socket->send();
|
||||
|
||||
// timer settings
|
||||
asio::deadline_timer timer(*io_service);
|
||||
asio::steady_timer timer(*io_service);
|
||||
retries--;
|
||||
std::function<void(const error_code&)> timer_handler = [&](const error_code& error) {
|
||||
// end
|
||||
@@ -953,7 +954,7 @@ void Bonjour::priv::lookup_perform()
|
||||
// restart timer
|
||||
} else {
|
||||
retries--;
|
||||
timer.expires_from_now(boost::posix_time::seconds(timeout));
|
||||
timer.expires_after(std::chrono::seconds(timeout));
|
||||
timer.async_wait(timer_handler);
|
||||
// trigger another round of queries
|
||||
for (auto * socket : sockets)
|
||||
@@ -961,7 +962,7 @@ void Bonjour::priv::lookup_perform()
|
||||
}
|
||||
};
|
||||
// start timer
|
||||
timer.expires_from_now(boost::posix_time::seconds(timeout));
|
||||
timer.expires_after(std::chrono::seconds(timeout));
|
||||
timer.async_wait(timer_handler);
|
||||
// start io_service, it will run until it has something to do - so in this case until stop is called in timer
|
||||
io_service->run();
|
||||
@@ -983,7 +984,7 @@ void Bonjour::priv::resolve_perform()
|
||||
rpls.push_back(reply);
|
||||
};
|
||||
|
||||
std::shared_ptr< boost::asio::io_service > io_service(new boost::asio::io_service);
|
||||
std::shared_ptr< boost::asio::io_context > io_service(new boost::asio::io_context);
|
||||
std::vector<ResolveSocket*> sockets;
|
||||
|
||||
// resolve interfaces - from PR#6646
|
||||
@@ -1033,7 +1034,7 @@ void Bonjour::priv::resolve_perform()
|
||||
socket->send();
|
||||
|
||||
// timer settings
|
||||
asio::deadline_timer timer(*io_service);
|
||||
asio::steady_timer timer(*io_service);
|
||||
retries--;
|
||||
std::function<void(const error_code&)> timer_handler = [&](const error_code& error) {
|
||||
int replies_count = replies.size();
|
||||
@@ -1047,7 +1048,7 @@ void Bonjour::priv::resolve_perform()
|
||||
// restart timer
|
||||
} else {
|
||||
retries--;
|
||||
timer.expires_from_now(boost::posix_time::seconds(timeout));
|
||||
timer.expires_after(std::chrono::seconds(timeout));
|
||||
timer.async_wait(timer_handler);
|
||||
// trigger another round of queries
|
||||
for (auto * socket : sockets)
|
||||
@@ -1055,7 +1056,7 @@ void Bonjour::priv::resolve_perform()
|
||||
}
|
||||
};
|
||||
// start timer
|
||||
timer.expires_from_now(boost::posix_time::seconds(timeout));
|
||||
timer.expires_after(std::chrono::seconds(timeout));
|
||||
timer.async_wait(timer_handler);
|
||||
// start io_service, it will run until it has something to do - so in this case until stop is called in timer
|
||||
io_service->run();
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <boost/optional/optional.hpp>
|
||||
#include <cstddef>
|
||||
#include <boost/asio/ip/udp.hpp>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
@@ -165,11 +165,11 @@ public:
|
||||
UdpSocket(Bonjour::ReplyFn replyfn
|
||||
, const boost::asio::ip::address& multicast_address
|
||||
, const boost::asio::ip::address& interface_address
|
||||
, std::shared_ptr< boost::asio::io_service > io_service);
|
||||
, std::shared_ptr< boost::asio::io_context > io_service);
|
||||
|
||||
UdpSocket(Bonjour::ReplyFn replyfn
|
||||
, const boost::asio::ip::address& multicast_address
|
||||
, std::shared_ptr< boost::asio::io_service > io_service);
|
||||
, std::shared_ptr< boost::asio::io_context > io_service);
|
||||
|
||||
void send();
|
||||
void async_receive();
|
||||
@@ -182,7 +182,7 @@ protected:
|
||||
boost::asio::ip::address multicast_address;
|
||||
boost::asio::ip::udp::socket socket;
|
||||
boost::asio::ip::udp::endpoint mcast_endpoint;
|
||||
std::shared_ptr< boost::asio::io_service > io_service;
|
||||
std::shared_ptr< boost::asio::io_context > io_service;
|
||||
std::vector<BonjourRequest> requests;
|
||||
};
|
||||
|
||||
@@ -196,7 +196,7 @@ public:
|
||||
, Bonjour::ReplyFn replyfn
|
||||
, const boost::asio::ip::address& multicast_address
|
||||
, const boost::asio::ip::address& interface_address
|
||||
, std::shared_ptr< boost::asio::io_service > io_service)
|
||||
, std::shared_ptr< boost::asio::io_context > io_service)
|
||||
: UdpSocket(replyfn, multicast_address, interface_address, io_service)
|
||||
, txt_keys(txt_keys)
|
||||
, service(service)
|
||||
@@ -213,7 +213,7 @@ public:
|
||||
, std::string protocol
|
||||
, Bonjour::ReplyFn replyfn
|
||||
, const boost::asio::ip::address& multicast_address
|
||||
, std::shared_ptr< boost::asio::io_service > io_service)
|
||||
, std::shared_ptr< boost::asio::io_context > io_service)
|
||||
: UdpSocket(replyfn, multicast_address, io_service)
|
||||
, txt_keys(txt_keys)
|
||||
, service(service)
|
||||
@@ -251,7 +251,7 @@ public:
|
||||
, Bonjour::ReplyFn replyfn
|
||||
, const boost::asio::ip::address& multicast_address
|
||||
, const boost::asio::ip::address& interface_address
|
||||
, std::shared_ptr< boost::asio::io_service > io_service)
|
||||
, std::shared_ptr< boost::asio::io_context > io_service)
|
||||
: UdpSocket(replyfn, multicast_address, interface_address, io_service)
|
||||
, hostname(hostname)
|
||||
|
||||
@@ -263,7 +263,7 @@ public:
|
||||
ResolveSocket(const std::string& hostname
|
||||
, Bonjour::ReplyFn replyfn
|
||||
, const boost::asio::ip::address& multicast_address
|
||||
, std::shared_ptr< boost::asio::io_service > io_service)
|
||||
, std::shared_ptr< boost::asio::io_context > io_service)
|
||||
: UdpSocket(replyfn, multicast_address, io_service)
|
||||
, hostname(hostname)
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef slic3r_Utils_BoostProcessCompat_hpp_
|
||||
#define slic3r_Utils_BoostProcessCompat_hpp_
|
||||
|
||||
#include <boost/version.hpp>
|
||||
|
||||
// Since Boost 1.88 the classic boost/process headers are only available
|
||||
// under boost/process/v1/, select those there and the originals otherwise.
|
||||
#if BOOST_VERSION >= 108800
|
||||
#define BOOST_PROCESS_VERSION 1
|
||||
#include <boost/process/v1.hpp>
|
||||
#else
|
||||
#include <boost/process.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#if BOOST_VERSION >= 108800
|
||||
#include <boost/process/v1/windows.hpp>
|
||||
#else
|
||||
#include <boost/process/windows.hpp>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // slic3r_Utils_BoostProcessCompat_hpp_
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <initializer_list>
|
||||
#include <boost/filesystem/directory.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <boost/asio/serial_port.hpp>
|
||||
#include <boost/asio/serial_port_base.hpp>
|
||||
#include <boost/system/system_error.hpp>
|
||||
@@ -289,11 +289,11 @@ std::vector<std::string> scan_serial_ports()
|
||||
|
||||
namespace asio = boost::asio;
|
||||
|
||||
Serial::Serial(asio::io_service& io_service) :
|
||||
Serial::Serial(asio::io_context& io_service) :
|
||||
asio::serial_port(io_service)
|
||||
{}
|
||||
|
||||
Serial::Serial(asio::io_service& io_service, const std::string &name, unsigned baud_rate) :
|
||||
Serial::Serial(asio::io_context& io_service, const std::string &name, unsigned baud_rate) :
|
||||
asio::serial_port(io_service, name)
|
||||
{
|
||||
set_baud_rate(baud_rate);
|
||||
@@ -406,12 +406,12 @@ bool Serial::read_line(unsigned timeout, std::string &line, error_code &ec)
|
||||
#else
|
||||
this->get_io_service();
|
||||
#endif
|
||||
asio::deadline_timer timer(io_service);
|
||||
asio::steady_timer timer(io_service);
|
||||
char c = 0;
|
||||
bool fail = false;
|
||||
|
||||
while (true) {
|
||||
io_service.reset();
|
||||
io_service.restart();
|
||||
|
||||
asio::async_read(*this, boost::asio::buffer(&c, 1), [&](const error_code &read_ec, size_t size) {
|
||||
if (ec || size == 0) {
|
||||
@@ -422,7 +422,7 @@ bool Serial::read_line(unsigned timeout, std::string &line, error_code &ec)
|
||||
});
|
||||
|
||||
if (timeout > 0) {
|
||||
timer.expires_from_now(boost::posix_time::milliseconds(timeout));
|
||||
timer.expires_after(std::chrono::milliseconds(timeout));
|
||||
timer.async_wait([&](const error_code &ec) {
|
||||
// Ignore timer aborts
|
||||
if (!ec) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <utility>
|
||||
#include <boost/asio/serial_port.hpp>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <boost/system/error_code.hpp>
|
||||
@@ -42,8 +42,8 @@ extern std::vector<SerialPortInfo> scan_serial_ports_extended();
|
||||
class Serial : public boost::asio::serial_port
|
||||
{
|
||||
public:
|
||||
Serial(boost::asio::io_service &io_service);
|
||||
Serial(boost::asio::io_service &io_service, const std::string &name, unsigned baud_rate);
|
||||
Serial(boost::asio::io_context &io_service);
|
||||
Serial(boost::asio::io_context &io_service, const std::string &name, unsigned baud_rate);
|
||||
Serial(const Serial &) = delete;
|
||||
Serial &operator=(const Serial &) = delete;
|
||||
~Serial();
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <boost/filesystem/directory.hpp>
|
||||
#include <boost/filesystem/file_status.hpp>
|
||||
#include <boost/log/trivial.hpp>
|
||||
#include <boost/process.hpp>
|
||||
#include <slic3r/Utils/BoostProcessCompat.hpp>
|
||||
#include "slic3r/plugin/PluginDescriptor.hpp"
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
@@ -31,13 +31,7 @@
|
||||
#include "slic3r/plugin/PythonPluginInterface.hpp"
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <boost/process/pipe.hpp>
|
||||
#include <boost/process/args.hpp>
|
||||
#include <boost/process/io.hpp>
|
||||
#include <system_error>
|
||||
#ifdef _WIN32
|
||||
#include <boost/process/windows.hpp>
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
|
||||
Reference in new issue
Block a user