mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +02:00
Don't set __MINGW32__
This took me a few hours of non-stop headaches to figure out. Apparently deep inside of Wine's headers having __MINGW32__ defined will cause some GUIDs to be defined slightly differently. This normally wouldn't cause issues, but when including `shellobj.h` or `objbase.h` this results in multiple definition linking errors that are basically impossible to diagnose.
This commit is contained in:
+5
-9
@@ -31,7 +31,7 @@ compiler_options = [
|
|||||||
'-fvisibility-inlines-hidden',
|
'-fvisibility-inlines-hidden',
|
||||||
# Disable the use of concepts in Boost.Asio until Boost 1.73 gets released
|
# Disable the use of concepts in Boost.Asio until Boost 1.73 gets released
|
||||||
# https://github.com/boostorg/asio/issues/312
|
# https://github.com/boostorg/asio/issues/312
|
||||||
'-DBOOST_ASIO_DISABLE_CONCEPTS'
|
'-DBOOST_ASIO_DISABLE_CONCEPTS',
|
||||||
]
|
]
|
||||||
|
|
||||||
with_bitbridge = get_option('with-bitbridge')
|
with_bitbridge = get_option('with-bitbridge')
|
||||||
@@ -176,6 +176,7 @@ if with_vst3
|
|||||||
vst3_sdk_native_dep = declare_dependency(
|
vst3_sdk_native_dep = declare_dependency(
|
||||||
link_with : vst3_sdk_native,
|
link_with : vst3_sdk_native,
|
||||||
include_directories : vst3_include_dir,
|
include_directories : vst3_include_dir,
|
||||||
|
compile_args : vst3_compiler_options,
|
||||||
)
|
)
|
||||||
|
|
||||||
# And another dependency for the host SDK for our Wine host applications
|
# And another dependency for the host SDK for our Wine host applications
|
||||||
@@ -192,14 +193,9 @@ if with_vst3
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
vst3_wine_compiler_options = [
|
vst3_wine_compiler_options = [
|
||||||
# Removes some MSVC-isms for us
|
# Some stuff from `windows.h` results in conflicting definitions
|
||||||
'-D__MINGW32__',
|
|
||||||
# We don't need all of this stuff from `Windows.h`, and it only causes more
|
|
||||||
# issues
|
|
||||||
'-DNOMINMAX',
|
'-DNOMINMAX',
|
||||||
'-DNOSERVICE',
|
'-DWINE_NOWINSOCK',
|
||||||
'-DNOMCX',
|
|
||||||
'-DWIN32_LEAN_AND_MEAN',
|
|
||||||
]
|
]
|
||||||
vst3_base_wine_64bit = static_library(
|
vst3_base_wine_64bit = static_library(
|
||||||
'vst3_base_wine_64bit',
|
'vst3_base_wine_64bit',
|
||||||
@@ -268,7 +264,7 @@ if with_vst3
|
|||||||
# This does mean that we now have a lot of defines in our code, but the
|
# This does mean that we now have a lot of defines in our code, but the
|
||||||
# alternative would be patching every location in the SDK where they include
|
# alternative would be patching every location in the SDK where they include
|
||||||
# `windows.h`
|
# `windows.h`
|
||||||
compile_args : vst3_wine_compiler_options,
|
compile_args : vst3_compiler_options + vst3_wine_compiler_options,
|
||||||
)
|
)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -23,13 +23,11 @@
|
|||||||
// it's running under a WIN32 environment. If anyone knows a better way to do
|
// it's running under a WIN32 environment. If anyone knows a better way to do
|
||||||
// this, please let me know!
|
// this, please let me know!
|
||||||
|
|
||||||
#pragma push_macro("__MINGW32__")
|
|
||||||
#pragma push_macro("WIN32")
|
#pragma push_macro("WIN32")
|
||||||
#pragma push_macro("_WIN32")
|
#pragma push_macro("_WIN32")
|
||||||
#pragma push_macro("__WIN32__")
|
#pragma push_macro("__WIN32__")
|
||||||
#pragma push_macro("_WIN64")
|
#pragma push_macro("_WIN64")
|
||||||
|
|
||||||
#undef __MINGW32__
|
|
||||||
#undef WIN32
|
#undef WIN32
|
||||||
#undef _WIN32
|
#undef _WIN32
|
||||||
#undef __WIN32__
|
#undef __WIN32__
|
||||||
@@ -44,7 +42,6 @@
|
|||||||
#include <boost/asio/basic_socket_streambuf.hpp>
|
#include <boost/asio/basic_socket_streambuf.hpp>
|
||||||
// #include <boost/asio/detail/timer_queue_ptime.hpp>
|
// #include <boost/asio/detail/timer_queue_ptime.hpp>
|
||||||
|
|
||||||
#pragma pop_macro("__MINGW32__")
|
|
||||||
#pragma pop_macro("WIN32")
|
#pragma pop_macro("WIN32")
|
||||||
#pragma pop_macro("_WIN32")
|
#pragma pop_macro("_WIN32")
|
||||||
#pragma pop_macro("__WIN32__")
|
#pragma pop_macro("__WIN32__")
|
||||||
|
|||||||
@@ -20,10 +20,6 @@
|
|||||||
|
|
||||||
#ifndef NOMINMAX
|
#ifndef NOMINMAX
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
#define NOSERVICE
|
|
||||||
#define NOMCX
|
|
||||||
#define NOIMM
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#endif
|
#endif
|
||||||
#include <vestige/aeffectx.h>
|
#include <vestige/aeffectx.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|||||||
@@ -22,10 +22,6 @@
|
|||||||
|
|
||||||
#ifndef NOMINMAX
|
#ifndef NOMINMAX
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
#define NOSERVICE
|
|
||||||
#define NOMCX
|
|
||||||
#define NOIMM
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#endif
|
#endif
|
||||||
#include <vestige/aeffectx.h>
|
#include <vestige/aeffectx.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|||||||
@@ -23,10 +23,6 @@
|
|||||||
|
|
||||||
#ifndef NOMINMAX
|
#ifndef NOMINMAX
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
#define NOSERVICE
|
|
||||||
#define NOMCX
|
|
||||||
#define NOIMM
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#endif
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
|||||||
@@ -25,11 +25,14 @@ fi
|
|||||||
find "$sdk_directory" -type f \( -iname '*.h' -or -iname '*.cpp' \) -print0 |
|
find "$sdk_directory" -type f \( -iname '*.h' -or -iname '*.cpp' \) -print0 |
|
||||||
xargs -0 sed -i -E 's/^#include <(Windows.h|ShlObj.h)>$/#include <\L\1\E>/'
|
xargs -0 sed -i -E 's/^#include <(Windows.h|ShlObj.h)>$/#include <\L\1\E>/'
|
||||||
|
|
||||||
# We're building with `WIN32_LEAN_AND_MEAN` because some of the definitions in
|
# Use the attributes and types from GCC
|
||||||
# there conflict with the C standard library as provided by GCC. This also
|
sed -i 's/defined(__MINGW32__)/defined(__WINE__)/g' "$sdk_directory/pluginterfaces/base/ftypes.h"
|
||||||
# excludes the shell API, which the VST3 SDK uses to open URLs.
|
|
||||||
sed -i "s/^#include <windows.h>$/#include <windows.h> \\/\\/ patched for yabridge\\
|
# There are some more places where the SDK includes better compatibility with
|
||||||
#include <shellapi.h>/" "$sdk_directory/public.sdk/source/common/openurl.cpp"
|
# GCC that we can use
|
||||||
|
# NOTE: We should **not** define __MINGW32__ globally, since that also breaks
|
||||||
|
# Wine's headers in headache inducing ways
|
||||||
|
sed -i 's/defined(__MINGW32__)/defined(__WINE__)/g' "$sdk_directory/public.sdk/source/common/systemclipboard_win32.cpp"
|
||||||
|
|
||||||
# Use the string manipulation functions from the C standard library
|
# Use the string manipulation functions from the C standard library
|
||||||
sed -i 's/\bSMTG_OS_WINDOWS\b/0/g;s/\bSMTG_OS_LINUX\b/1/g' "$sdk_directory/base/source/fstring.cpp"
|
sed -i 's/\bSMTG_OS_WINDOWS\b/0/g;s/\bSMTG_OS_LINUX\b/1/g' "$sdk_directory/base/source/fstring.cpp"
|
||||||
@@ -61,10 +64,6 @@ replace_char16 "using ConverterFacet = std::codecvt_utf8_utf16<char16_t>;" "$sdk
|
|||||||
replace_char16 "using Converter = std::wstring_convert<ConverterFacet, char16_t>;" "$sdk_directory/base/source/fstring.cpp"
|
replace_char16 "using Converter = std::wstring_convert<ConverterFacet, char16_t>;" "$sdk_directory/base/source/fstring.cpp"
|
||||||
replace_char16 "using Converter = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>;" "$sdk_directory/pluginterfaces/base/ustring.cpp"
|
replace_char16 "using Converter = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>;" "$sdk_directory/pluginterfaces/base/ustring.cpp"
|
||||||
|
|
||||||
# The definitions of long doesn't match up between platforms, and the mingw
|
|
||||||
# version here is trying to do something funky
|
|
||||||
sed -i 's/\b__MINGW32__\b/__NOPE__/g' "$sdk_directory/pluginterfaces/base/funknown.cpp"
|
|
||||||
|
|
||||||
# libstdc++fs doesn't work under Winelib, for whatever reason that might be.
|
# libstdc++fs doesn't work under Winelib, for whatever reason that might be.
|
||||||
# We'll patch the Win32 module loading to use Boost.Filesystem instead.
|
# We'll patch the Win32 module loading to use Boost.Filesystem instead.
|
||||||
sed -i 's/^#include <\(experimental\/\)\?filesystem>$/#include <boost\/filesystem.hpp>/' "$sdk_directory/public.sdk/source/vst/hosting/module_win32.cpp"
|
sed -i 's/^#include <\(experimental\/\)\?filesystem>$/#include <boost\/filesystem.hpp>/' "$sdk_directory/public.sdk/source/vst/hosting/module_win32.cpp"
|
||||||
|
|||||||
Reference in New Issue
Block a user