From f0c26cbe06ca58d3f0bd9ab2aed9a37a7c9102ff Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Thu, 24 Jun 2021 13:41:43 +0200 Subject: [PATCH] Allow building 32-bit yabridge libraries --- CHANGELOG.md | 5 +++++ README.md | 18 ++++++++++++++++++ meson.build | 27 +++++++++++++++++++++------ 3 files changed, 44 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0532c40e..2e87593e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,11 @@ Versioning](https://semver.org/spec/v2.0.0.html). - Added an environment variable to disable the watchdog timer. This allows the Wine process to run under a separate namespace. If you don't know that you need this, then you probably don't need this! +- Added support for building 32-bit versions of the yabridge libraries, so you + can use both 32-bit and 64-bit Windows VST2 and VST3 plugins under 32-bit + Linux plugin hosts. This should not be necessary in any normal situation since + Desktop Linux has been 64-bit only for a while now, but it could be useful in + some very specific situations. ### Changed diff --git a/README.md b/README.md index 634f1c3a..8efbd112 100644 --- a/README.md +++ b/README.md @@ -753,6 +753,24 @@ This will produce four files called `yabridge-host-32.exe`, trying to load is 32-bit or 64-bit, and will run either the regular version or the `*-32.exe` variant accordingly. +### 32-bit libraries + +It also possible to build 32-bit versions of yabridge's libraries, which would +let you use both 32-bit and 64-bit Windows VST2 and VST3 plugins from a 32-bit +Linux plugin host. This is mostly untested since 32-bit desktop Linux doesn't +really exist anymore, but it should work! The build system will still assume +you're compiling from a 64-bit system, so if you're compiling on an actual +32-bit system you would need to comment out the 64-bit `yabridge-host` and +`yabridge-group` binaries in `meson.build`: + +```shell +meson setup --buildtype=release --cross-file=cross-wine.conf --unity=on --unity-size=1000 -Dwith-bitbridge=true -Dbuild.cpp_link_args='-m32' build +ninja -C build +``` + +Like the above commands, you might need to tweak the unity size based on the +amount of system memory available. + ## Debugging Wine's error messages and warning are usually very helpful whenever a plugin diff --git a/meson.build b/meson.build index 5f965b19..f9421f96 100644 --- a/meson.build +++ b/meson.build @@ -145,12 +145,27 @@ endif # Statically link against Boost.Filesystem, otherwise it would become impossible # to distribute a prebuilt version of yabridge boost_dep = dependency('boost', version : '>=1.66', static : with_static_boost) -boost_filesystem_dep = dependency( - 'boost', - version : '>=1.66', - modules : ['filesystem'], - static : with_static_boost, -) + +# HACK: I couldn't get Meson's Boost dependency detection to work with `-m32`, +# because no matter what settings I use in machine/cross files it will +# keep rejecting the 32-bit libraries when the host system is 64-bit. +# Since cross-compiling 32-bit native libraries is not really a supported +# use case anyways we'll just brute force it for the time being. +if get_option('build.cpp_args').contains('-m32') + if with_static_boost + boost_filesystem_dep = declare_dependency(link_args : '-staticboost_filesystem') + else + boost_filesystem_dep = declare_dependency(link_args : '-lboost_filesystem') + endif +else + boost_filesystem_dep = dependency( + 'boost', + version : '>=1.66', + modules : ['filesystem'], + static : with_static_boost, + ) +endif + # TODO: Meson doesn't have a way to define version ranges, does it? Like # `^>=5.2.0`, `>=5.2.0 && <6.0.0` or `5.2.*`. bitsery_dep = dependency('bitsery', version : '>=5.2.0', fallback : ['bitsery', 'bitsery_dep'])