From 84e13e556c60bfde90bae32475472daaa36403f0 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Wed, 2 Dec 2020 14:49:00 +0100 Subject: [PATCH] Add #ifdef WITH_VST3 guards around VST3 hosting --- src/wine-host/bridges/group.cpp | 10 ++++++++++ src/wine-host/bridges/group.h | 4 +++- src/wine-host/bridges/vst3.h | 18 ++++++++++++++++++ src/wine-host/individual-host.cpp | 13 ++++++++++--- 4 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 src/wine-host/bridges/vst3.h diff --git a/src/wine-host/bridges/group.cpp b/src/wine-host/bridges/group.cpp index 7c743e7c..2f421c47 100644 --- a/src/wine-host/bridges/group.cpp +++ b/src/wine-host/bridges/group.cpp @@ -22,6 +22,10 @@ #include #include "../../common/communication/common.h" +#include "vst2.h" +#ifdef WITH_VST3 +#include "vst3.h" +#endif // FIXME: `std::filesystem` is broken in wineg++, at least under Wine 5.8. Any // path operation will thrown an encoding related error @@ -201,7 +205,13 @@ void GroupBridge::accept_requests() { request.endpoint_base_dir); break; case PluginType::vst3: +#ifdef WITH_VST3 throw std::runtime_error("TODO: Not yet implemented"); +#else + throw std::runtime_error( + "This version of yabridge has not been compiled " + "with VST3 support"); +#endif break; case PluginType::unknown: throw std::runtime_error( diff --git a/src/wine-host/bridges/group.h b/src/wine-host/bridges/group.h index a255f75e..7c0e65a3 100644 --- a/src/wine-host/bridges/group.h +++ b/src/wine-host/bridges/group.h @@ -18,6 +18,7 @@ #include "../boost-fix.h" +#include #include #include #include @@ -25,7 +26,8 @@ #include #include -#include "vst2.h" +#include "../common/logging/common.h" +#include "common.h" /** * Encapsulate capturing the STDOUT or STDERR stream by opening a pipe and diff --git a/src/wine-host/bridges/vst3.h b/src/wine-host/bridges/vst3.h new file mode 100644 index 00000000..768a86af --- /dev/null +++ b/src/wine-host/bridges/vst3.h @@ -0,0 +1,18 @@ + +// yabridge: a Wine VST bridge +// Copyright (C) 2020 Robbert van der Helm +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#pragma once diff --git a/src/wine-host/individual-host.cpp b/src/wine-host/individual-host.cpp index 5ea79a4e..8c2679e9 100644 --- a/src/wine-host/individual-host.cpp +++ b/src/wine-host/individual-host.cpp @@ -23,6 +23,9 @@ #include "../common/utils.h" #include "bridges/vst2.h" +#ifdef WITH_VST3 +#include "bridges/vst3.h" +#endif /** * This is the default plugin host application. It will load the specified @@ -54,9 +57,6 @@ main(int argc, char* argv[]) { return 1; } - // TODO: On the Wine side of things, we should only allow hosting VST3 - // plugins when the Meson build option is enabled (because, well, - // otherwise we'd get compile errors) const std::string plugin_type_str(argv[1]); const PluginType plugin_type = plugin_type_from_string(plugin_type_str); const std::string plugin_location(argv[2]); @@ -84,8 +84,15 @@ main(int argc, char* argv[]) { main_context, plugin_location, socket_endpoint_path); break; case PluginType::vst3: +#ifdef WITH_VST3 std::cerr << "TODO: Not yet implemented" << std::endl; return 1; +#else + std::cerr << "This version of yabridge has not been compiled " + "with VST3 support" + << std::endl; + return 1; +#endif break; case PluginType::unknown: std::cerr << "Unknown plugin type '" << plugin_type_str << "'"