diff --git a/meson.build b/meson.build index 4c04cf4a..20e7a306 100644 --- a/meson.build +++ b/meson.build @@ -31,7 +31,7 @@ compiler_options = [ '-fvisibility-inlines-hidden', # Disable the use of concepts in Boost.Asio until Boost 1.73 gets released # https://github.com/boostorg/asio/issues/312 - '-DBOOST_ASIO_DISABLE_CONCEPTS' + '-DBOOST_ASIO_DISABLE_CONCEPTS', ] with_bitbridge = get_option('with-bitbridge') @@ -176,6 +176,7 @@ if with_vst3 vst3_sdk_native_dep = declare_dependency( link_with : vst3_sdk_native, include_directories : vst3_include_dir, + compile_args : vst3_compiler_options, ) # And another dependency for the host SDK for our Wine host applications @@ -192,14 +193,9 @@ if with_vst3 endif vst3_wine_compiler_options = [ - # Removes some MSVC-isms for us - '-D__MINGW32__', - # We don't need all of this stuff from `Windows.h`, and it only causes more - # issues + # Some stuff from `windows.h` results in conflicting definitions '-DNOMINMAX', - '-DNOSERVICE', - '-DNOMCX', - '-DWIN32_LEAN_AND_MEAN', + '-DWINE_NOWINSOCK', ] vst3_base_wine_64bit = static_library( '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 # alternative would be patching every location in the SDK where they include # `windows.h` - compile_args : vst3_wine_compiler_options, + compile_args : vst3_compiler_options + vst3_wine_compiler_options, ) endif endif diff --git a/src/wine-host/boost-fix.h b/src/wine-host/boost-fix.h index 764760bb..478aaeef 100644 --- a/src/wine-host/boost-fix.h +++ b/src/wine-host/boost-fix.h @@ -23,13 +23,11 @@ // it's running under a WIN32 environment. If anyone knows a better way to do // this, please let me know! -#pragma push_macro("__MINGW32__") #pragma push_macro("WIN32") #pragma push_macro("_WIN32") #pragma push_macro("__WIN32__") #pragma push_macro("_WIN64") -#undef __MINGW32__ #undef WIN32 #undef _WIN32 #undef __WIN32__ @@ -44,7 +42,6 @@ #include // #include -#pragma pop_macro("__MINGW32__") #pragma pop_macro("WIN32") #pragma pop_macro("_WIN32") #pragma pop_macro("__WIN32__") diff --git a/src/wine-host/bridges/vst2.h b/src/wine-host/bridges/vst2.h index 9062870f..b5a8d25c 100644 --- a/src/wine-host/bridges/vst2.h +++ b/src/wine-host/bridges/vst2.h @@ -20,10 +20,6 @@ #ifndef NOMINMAX #define NOMINMAX -#define NOSERVICE -#define NOMCX -#define NOIMM -#define WIN32_LEAN_AND_MEAN #endif #include #include diff --git a/src/wine-host/editor.h b/src/wine-host/editor.h index b03b2f2c..e483c722 100644 --- a/src/wine-host/editor.h +++ b/src/wine-host/editor.h @@ -22,10 +22,6 @@ #ifndef NOMINMAX #define NOMINMAX -#define NOSERVICE -#define NOMCX -#define NOIMM -#define WIN32_LEAN_AND_MEAN #endif #include #include diff --git a/src/wine-host/utils.h b/src/wine-host/utils.h index 8358800b..3bc8a55e 100644 --- a/src/wine-host/utils.h +++ b/src/wine-host/utils.h @@ -23,10 +23,6 @@ #ifndef NOMINMAX #define NOMINMAX -#define NOSERVICE -#define NOMCX -#define NOIMM -#define WIN32_LEAN_AND_MEAN #endif #include diff --git a/tools/patch-vst3-sdk.sh b/tools/patch-vst3-sdk.sh index 1d5d46e5..7e9edc1f 100755 --- a/tools/patch-vst3-sdk.sh +++ b/tools/patch-vst3-sdk.sh @@ -25,11 +25,14 @@ fi 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>/' -# We're building with `WIN32_LEAN_AND_MEAN` because some of the definitions in -# there conflict with the C standard library as provided by GCC. This also -# excludes the shell API, which the VST3 SDK uses to open URLs. -sed -i "s/^#include $/#include \\/\\/ patched for yabridge\\ -#include /" "$sdk_directory/public.sdk/source/common/openurl.cpp" +# Use the attributes and types from GCC +sed -i 's/defined(__MINGW32__)/defined(__WINE__)/g' "$sdk_directory/pluginterfaces/base/ftypes.h" + +# There are some more places where the SDK includes better compatibility with +# 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 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;" "$sdk replace_char16 "using Converter = std::wstring_convert;" "$sdk_directory/base/source/fstring.cpp" replace_char16 "using Converter = std::wstring_convert, 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. # We'll patch the Win32 module loading to use Boost.Filesystem instead. sed -i 's/^#include <\(experimental\/\)\?filesystem>$/#include /' "$sdk_directory/public.sdk/source/vst/hosting/module_win32.cpp"