Add another flag for enabling a bit bridge build

This commit is contained in:
Robbert van der Helm
2020-04-29 16:54:26 +02:00
parent 7ce42e4306
commit c9060e984d
7 changed files with 118 additions and 43 deletions
+16
View File
@@ -0,0 +1,16 @@
[binaries]
c = 'winegcc'
cpp = 'wineg++'
ar = 'ar'
strip = 'strip'
[properties]
# These would be the arguments for 64-bit compilation. We'll set the `-m64` flag
# (or `-m32`) in our meson.build to allow the 32-bit bitbridge to be built in
# the same build directory as the plugin and the regular 64-bit version of the
# host application to ensure that they are always in sync.
# c_args = ['-m64']
# cpp_args = ['-m64']
# cpp_link_args = ['-m64', '-mwindows']
cpp_link_args = ['-mwindows']
needs_exe_wrapper = true
-17
View File
@@ -1,17 +0,0 @@
[binaries]
c = 'winegcc'
cpp = 'wineg++'
ar = 'ar'
strip = 'strip'
[properties]
c_args=['-m64']
cpp_args=['-m64']
cpp_link_args=['-m64', '-mwindows']
needs_exe_wrapper = true
[host_machine]
system = 'linux'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'
+47 -20
View File
@@ -12,9 +12,19 @@ winelib_check = '''#ifndef __WINE__
#error 1
#endif'''
if not meson.get_compiler('cpp').compiles(winelib_check)
error('You need to set up a cross compiler, check the README for more information.')
error('You need to set up a cross compiler, check the README for compilation instructions.')
endif
# Depending on the `use-bitbridge` flag we'll enable building a second 32-bit
# host application that can act as a bit bridge for using 32-bit Windows plugins
# in 64-bit Linux VST hsots. The plugin will determine which host application to
# use based on the `.dll` file it's trying to load.
# This setup is necessary until Meson provides a way to have multiple
# cross-builds for a single build directory:
# https://github.com/mesonbuild/meson/issues/5125
host_name_64bit = 'yabridge-host'
host_name_32bit = 'yabridge-host-32'
# This provides an easy way to start the Wine VST host using winedbg since it
# can be quite a pain to set up
compiler_options = []
@@ -22,13 +32,8 @@ if get_option('use-winedbg')
compiler_options += '-DUSE_WINEDBG'
endif
# The application consists of a VST plugin (yabridge) that calls a winelib
# program (yabridge-host) that can host Windows VST plugins. More information
# about the way these two components work together can be found in the readme
# file.
# Generate header files for configuration variables such as the current git tag
# and the last commit hash
# and the name of the host binary
subdir('src/common/config')
boost_dep = dependency('boost', modules : ['filesystem'])
@@ -40,6 +45,11 @@ xcb_dep = dependency('xcb')
include_dir = include_directories('src/include')
# The application consists of a VST plugin (yabridge) that calls a winelib
# program (yabridge-host) that can host Windows VST plugins. More information
# about the way these two components work together can be found in the readme
# file.
shared_library(
'yabridge',
[
@@ -56,21 +66,38 @@ shared_library(
link_args : ['-ldl']
)
host_sources = [
'src/common/logging.cpp',
'src/common/serialization.cpp',
'src/wine-host/editor.cpp',
'src/wine-host/editor.cpp',
'src/wine-host/plugin-bridge.cpp',
'src/wine-host/vst-host.cpp',
'src/wine-host/utils.cpp',
version_header,
]
executable(
'yabridge-host',
[
'src/common/logging.cpp',
'src/common/serialization.cpp',
'src/wine-host/editor.cpp',
'src/wine-host/editor.cpp',
'src/wine-host/plugin-bridge.cpp',
'src/wine-host/vst-host.cpp',
'src/wine-host/utils.cpp',
version_header,
],
host_name_64bit,
host_sources,
native : false,
include_directories : include_dir,
dependencies : [boost_dep, bitsery_dep, wine_threads_dep, xcb_dep],
cpp_args : compiler_options,
link_args : []
cpp_args : compiler_options + ['-m64'],
link_args : ['-m64']
)
if get_option('use-bitbridge')
compiler_options += '-DUSE_BITBRIDGE'
# TODO: Use 32 bit libraries
executable(
host_name_32bit,
host_sources,
native : false,
include_directories : include_dir,
dependencies : [boost_dep, bitsery_dep, wine_threads_dep, xcb_dep],
cpp_args : compiler_options + ['-m32'],
link_args : ['-m32']
)
endif
+9 -1
View File
@@ -1,6 +1,14 @@
option(
'use-bitbridge',
type : 'boolean',
value : false,
description : '''Build a 32-bit host application for hosting 32-bit plugins.
See the readme for full instructions on how to use this.'''
)
option(
'use-winedbg',
type : 'boolean',
value : false,
description: 'Whether to run the Wien VST host with GDB attached. Might not always be reliable.'
description : 'Whether to run the Wien VST host with GDB attached. Might not always be reliable.'
)
+30
View File
@@ -0,0 +1,30 @@
// 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 <https://www.gnu.org/licenses/>.
#pragma once
/**
* The name of the wine host name, e.g. `yabridge-host.exe` for the regular 64
* bit build.
*/
constexpr char yabridge_wine_host_name[] = "@host_binary_64bit@";
/**
* The name of the 32-bit wine host name, e.g. `yabridge-host-32.exe`.` This is
* used as a bitbridge to be able to load legacy 32-bit only Windows plugins
* from a 64-bit Linux host.
*/
constexpr char yabridge_wine_host_name_32bit[] = "@host_binary_32bit@";
+13
View File
@@ -1,3 +1,16 @@
# Contains constants determined while configuring the build. As an alternative
# to preprocessor macros.
config_header = configure_file(
input : 'config.h.in',
output : 'config.h',
configuration : configuration_data(
{
'host_binary_32bit': host_name_32bit + '.exe',
'host_binary_64bit': host_name_64bit + '.exe',
}
)
)
# Generate a file containing the last annotated git tag and possibly also the
# amount of commits since then and the hash of the last commit
version_header = vcs_tag(
+3 -5
View File
@@ -30,6 +30,7 @@
#endif
// Generated inside of build directory
#include <src/common/config/config.h>
#include <src/common/config/version.h>
#include "../common/communication.h"
@@ -40,11 +41,6 @@ namespace bp = boost::process;
// boost::filesystem
namespace fs = boost::filesystem;
/**
* The name of the wine VST host binary.
*/
constexpr auto yabridge_wine_host_name = "yabridge-host.exe";
/**
* Used for generating random identifiers.
*/
@@ -500,6 +496,8 @@ fs::path find_wine_vst_host() {
return host_path;
}
// TODO: First, check whether the plugin is 32-bit or 64-bit, and then
// search for the correct binary accordingly
// Bosot will return an empty path if the file could not be found in the
// search path
const fs::path vst_host_path = bp::search_path(yabridge_wine_host_name);