mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +02:00
Also add a way to use logging library without Asio
This commit is contained in:
+1
-1
@@ -58,7 +58,7 @@ compiler_options = [
|
|||||||
chainloader_compiler_options = [
|
chainloader_compiler_options = [
|
||||||
# We use our process library for sending notifications from the chainloaders,
|
# We use our process library for sending notifications from the chainloaders,
|
||||||
# but we don't need the Asio pipe support there
|
# but we don't need the Asio pipe support there
|
||||||
'-DPROCESS_NO_ASIO',
|
'-DWITHOUT_ASIO',
|
||||||
]
|
]
|
||||||
|
|
||||||
# HACK: Some stuff from `windows.h` that we don't need results in conflicting
|
# HACK: Some stuff from `windows.h` that we don't need results in conflicting
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <vestige/aeffectx.h>
|
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|||||||
@@ -20,12 +20,16 @@
|
|||||||
#include <optional>
|
#include <optional>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
|
// The chainloader needs to be able to use the logger without pulling in a bunch
|
||||||
|
// of Boost things
|
||||||
|
#ifndef WITHOUT_ASIO
|
||||||
#ifdef __WINE__
|
#ifdef __WINE__
|
||||||
#include "../wine-host/asio-fix.h"
|
#include "../wine-host/asio-fix.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <asio/read_until.hpp>
|
#include <asio/read_until.hpp>
|
||||||
#include <asio/streambuf.hpp>
|
#include <asio/streambuf.hpp>
|
||||||
|
#endif // WITHOUT_ASIO
|
||||||
|
|
||||||
#include "../utils.h"
|
#include "../utils.h"
|
||||||
|
|
||||||
@@ -138,6 +142,7 @@ class Logger {
|
|||||||
*/
|
*/
|
||||||
void log(const std::string& message);
|
void log(const std::string& message);
|
||||||
|
|
||||||
|
#ifndef WITHOUT_ASIO
|
||||||
/**
|
/**
|
||||||
* Write output from an async pipe to the log on a line by line basis.
|
* Write output from an async pipe to the log on a line by line basis.
|
||||||
* Useful for logging the Wine process's STDOUT and STDERR streams.
|
* Useful for logging the Wine process's STDOUT and STDERR streams.
|
||||||
@@ -167,6 +172,7 @@ class Logger {
|
|||||||
async_log_pipe_lines(pipe, buffer, prefix);
|
async_log_pipe_lines(pipe, buffer, prefix);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
#endif // WITHOUT_ASIO
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log a message that should only be printed when the `verbosity` is set to
|
* Log a message that should only be printed when the `verbosity` is set to
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ Process::StatusResult Process::spawn_get_status() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef PROCESS_NO_ASIO
|
#ifndef WITHOUT_ASIO
|
||||||
Process::HandleResult Process::spawn_child_piped(
|
Process::HandleResult Process::spawn_child_piped(
|
||||||
// NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
|
// NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
|
||||||
asio::posix::stream_descriptor& stdout_pipe,
|
asio::posix::stream_descriptor& stdout_pipe,
|
||||||
@@ -385,7 +385,7 @@ Process::HandleResult Process::spawn_child_piped(
|
|||||||
return Handle(child_pid);
|
return Handle(child_pid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // PROCESS_NO_ASIO
|
#endif // WITHOUT_ASIO
|
||||||
|
|
||||||
Process::HandleResult Process::spawn_child_redirected(
|
Process::HandleResult Process::spawn_child_redirected(
|
||||||
const ghc::filesystem::path& filename) const {
|
const ghc::filesystem::path& filename) const {
|
||||||
|
|||||||
@@ -26,13 +26,13 @@
|
|||||||
|
|
||||||
// We also use this header from the chainloaders, and we don't want to pull in
|
// We also use this header from the chainloaders, and we don't want to pull in
|
||||||
// Asio there
|
// Asio there
|
||||||
#ifndef PROCESS_NO_ASIO
|
#ifndef WITHOUT_ASIO
|
||||||
#ifdef __WINE__
|
#ifdef __WINE__
|
||||||
#include "../wine-host/asio-fix.h"
|
#include "../wine-host/asio-fix.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <asio/posix/stream_descriptor.hpp>
|
#include <asio/posix/stream_descriptor.hpp>
|
||||||
#endif // PROCESS_NO_ASIO
|
#endif // WITHOUT_ASIO
|
||||||
|
|
||||||
// A minimal API akin to Boost.Process for launching and managing processes
|
// A minimal API akin to Boost.Process for launching and managing processes
|
||||||
// using plain Linux APIs. Needed so we can implement our chainloader without
|
// using plain Linux APIs. Needed so we can implement our chainloader without
|
||||||
@@ -240,7 +240,7 @@ class Process {
|
|||||||
*/
|
*/
|
||||||
StatusResult spawn_get_status() const;
|
StatusResult spawn_get_status() const;
|
||||||
|
|
||||||
#ifndef PROCESS_NO_ASIO
|
#ifndef WITHOUT_ASIO
|
||||||
/**
|
/**
|
||||||
* Spawn the process without waiting for its completion, leave STDIN alone,
|
* Spawn the process without waiting for its completion, leave STDIN alone,
|
||||||
* create pipes for STDOUT and STDERR, and assign those to the provided
|
* create pipes for STDOUT and STDERR, and assign those to the provided
|
||||||
@@ -251,7 +251,7 @@ class Process {
|
|||||||
HandleResult spawn_child_piped(
|
HandleResult spawn_child_piped(
|
||||||
asio::posix::stream_descriptor& stdout_pipe,
|
asio::posix::stream_descriptor& stdout_pipe,
|
||||||
asio::posix::stream_descriptor& stderr_pipe) const;
|
asio::posix::stream_descriptor& stderr_pipe) const;
|
||||||
#endif // PROCESS_NO_ASIO
|
#endif // WITHOUT_ASIO
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spawn the process without waiting for its completion, leave STDIN alone,
|
* Spawn the process without waiting for its completion, leave STDIN alone,
|
||||||
|
|||||||
Reference in New Issue
Block a user