diff --git a/meson.build b/meson.build index e9963828..0b59034c 100644 --- a/meson.build +++ b/meson.build @@ -227,134 +227,11 @@ wine_shell32_dep = declare_dependency(link_args : '-lshell32') wine_threads_dep = declare_dependency(link_args : '-lpthread') wine_uuid_dep = declare_dependency(link_args : '-luuid') -# -# VST3 SDK -# -# Meson does not allow mixing native and non native dependencies from -# subprojects. The only workaround is to only define only the necessary -# variables there, and to then assemble the dependencies here ourselves. -# - +# We need to build the VST3 SDK dependencies in tree because Meson won't let us +# build both native, 32-bit cross compiled and 64-bit cross compiled +# dependencies from a (CMake) subproject if with_vst3 - vst3 = subproject('vst3', version : '3.7.2') - vst3_compiler_options = vst3.get_variable('compiler_options') - vst3_include_dir = vst3.get_variable('include_dir') - - # We'll create a dependency for the plugin SDK for our native VST3 plugin - vst3_base_native = static_library( - 'base_native', - vst3.get_variable('base_sources'), - native : true, - cpp_args : vst3_compiler_options + ['-Wno-cpp'], - include_directories : vst3_include_dir, - override_options : ['warning_level=0'], - ) - vst3_pluginterfaces_native = static_library( - 'pluginterfaces_native', - vst3.get_variable('pluginterfaces_sources'), - native : true, - cpp_args : vst3_compiler_options, - include_directories : vst3_include_dir, - override_options : ['warning_level=0'], - ) - vst3_sdk_native = static_library( - 'sdk_native', - vst3.get_variable('sdk_common_sources') + vst3.get_variable('sdk_sources'), - native : true, - link_with : [vst3_base_native, vst3_pluginterfaces_native], - cpp_args : vst3_compiler_options + ['-Wno-multichar'], - include_directories : vst3_include_dir, - override_options : ['warning_level=0'], - ) - 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 - # We need to do some minor hacking to get this to compile with winegcc. Most - # notably some attributes are named differently, and the SDK uses 'Windows.h' - # instead of 'windows.h' like how the file is actually called. - # message(vst3_include_dir) - vst3_sdk_base_dir = vst3.get_variable('sdk_base_dir') - patch_result = run_command('tools/patch-vst3-sdk.sh', vst3_sdk_base_dir) - if patch_result.returncode() == 0 - message(patch_result.stdout()) - else - error('Error while trying to patch the VST3 SDK:\n' + patch_result.stderr()) - endif - - vst3_base_wine_64bit = static_library( - 'vst3_base_wine_64bit', - vst3.get_variable('base_sources'), - native : false, - cpp_args : vst3_compiler_options + wine_64bit_compiler_options + [ '-Wno-cpp'], - include_directories : vst3_include_dir, - override_options : ['warning_level=0'], - ) - vst3_pluginterfaces_wine_64bit = static_library( - 'vst3_pluginterfaces_wine_64bit', - vst3.get_variable('pluginterfaces_sources'), - native : false, - cpp_args : vst3_compiler_options + wine_64bit_compiler_options, - include_directories : vst3_include_dir, - override_options : ['warning_level=0'], - ) - vst3_sdk_hosting_wine_64bit = static_library( - 'vst3_sdk_hosting_wine_64bit', - vst3.get_variable('sdk_common_sources') + vst3.get_variable('sdk_hosting_sources'), - native : false, - link_with : [vst3_base_wine_64bit, vst3_pluginterfaces_wine_64bit], - cpp_args : vst3_compiler_options + wine_64bit_compiler_options + ['-Wno-multichar'], - include_directories : vst3_include_dir, - override_options : ['warning_level=0'], - ) - vst3_sdk_hosting_wine_64bit_dep = declare_dependency( - link_with : vst3_sdk_hosting_wine_64bit, - include_directories : vst3_include_dir, - # 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_compiler_options + wine_64bit_compiler_options, - ) - - # And another time for the 32-bit version - if with_bitbridge - vst3_base_wine_32bit = static_library( - 'vst3_base_wine_32bit', - vst3.get_variable('base_sources'), - native : false, - cpp_args : vst3_compiler_options + wine_32bit_compiler_options + ['-Wno-cpp'], - include_directories : vst3_include_dir, - override_options : ['warning_level=0'], - ) - vst3_pluginterfaces_wine_32bit = static_library( - 'vst3_pluginterfaces_wine_32bit', - vst3.get_variable('pluginterfaces_sources'), - native : false, - cpp_args : vst3_compiler_options + wine_32bit_compiler_options, - include_directories : vst3_include_dir, - override_options : ['warning_level=0'], - ) - vst3_sdk_hosting_wine_32bit = static_library( - 'vst3_sdk_hosting_wine_32bit', - vst3.get_variable('sdk_common_sources') + vst3.get_variable('sdk_hosting_sources'), - native : false, - link_with : [vst3_base_wine_32bit, vst3_pluginterfaces_wine_32bit], - cpp_args : vst3_compiler_options + wine_32bit_compiler_options + ['-Wno-multichar'], - include_directories : vst3_include_dir, - override_options : ['warning_level=0'], - ) - vst3_sdk_hosting_wine_32bit_dep = declare_dependency( - link_with : vst3_sdk_hosting_wine_32bit, - include_directories : vst3_include_dir, - # 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_compiler_options + wine_32bit_compiler_options, - ) - endif + subdir('src/common/vst3') endif # diff --git a/src/common/vst3/meson.build b/src/common/vst3/meson.build new file mode 100644 index 00000000..34821d35 --- /dev/null +++ b/src/common/vst3/meson.build @@ -0,0 +1,131 @@ +# Meson does not allow mixing native and non native dependencies from +# subprojects. The only workaround is to only define only the necessary +# variables there, and to then assemble the dependencies here ourselves. +vst3 = subproject('vst3', version : '3.7.2') +vst3_compiler_options = vst3.get_variable('compiler_options') +vst3_include_dir = vst3.get_variable('include_dir') + +# We'll create a dependency for the plugin SDK for our native VST3 plugin +vst3_base_native = static_library( + 'base_native', + vst3.get_variable('base_sources'), + native : true, + cpp_args : vst3_compiler_options + ['-Wno-cpp'], + include_directories : vst3_include_dir, + override_options : ['warning_level=0'], +) +vst3_pluginterfaces_native = static_library( + 'pluginterfaces_native', + vst3.get_variable('pluginterfaces_sources'), + native : true, + cpp_args : vst3_compiler_options, + include_directories : vst3_include_dir, + override_options : ['warning_level=0'], +) +vst3_sdk_native = static_library( + 'sdk_native', + vst3.get_variable('sdk_common_sources') + vst3.get_variable('sdk_sources'), + native : true, + link_with : [vst3_base_native, vst3_pluginterfaces_native], + cpp_args : vst3_compiler_options + ['-Wno-multichar'], + include_directories : vst3_include_dir, + override_options : ['warning_level=0'], +) + +# And another dependency for the host SDK for our Wine host applications +# We need to do some minor hacking to get this to compile with winegcc. Most +# notably some attributes are named differently, and the SDK uses 'Windows.h' +# instead of 'windows.h' like how the file is actually called. +# message(vst3_include_dir) +vst3_sdk_base_dir = vst3.get_variable('sdk_base_dir') +patch_result = run_command('../../../tools/patch-vst3-sdk.sh', vst3_sdk_base_dir) +if patch_result.returncode() == 0 + message(patch_result.stdout()) +else + error('Error while trying to patch the VST3 SDK:\n' + patch_result.stderr()) +endif + +vst3_base_wine_64bit = static_library( + 'vst3_base_wine_64bit', + vst3.get_variable('base_sources'), + native : false, + cpp_args : vst3_compiler_options + wine_64bit_compiler_options + [ '-Wno-cpp'], + include_directories : vst3_include_dir, + override_options : ['warning_level=0'], +) +vst3_pluginterfaces_wine_64bit = static_library( + 'vst3_pluginterfaces_wine_64bit', + vst3.get_variable('pluginterfaces_sources'), + native : false, + cpp_args : vst3_compiler_options + wine_64bit_compiler_options, + include_directories : vst3_include_dir, + override_options : ['warning_level=0'], +) +vst3_sdk_hosting_wine_64bit = static_library( + 'vst3_sdk_hosting_wine_64bit', + vst3.get_variable('sdk_common_sources') + vst3.get_variable('sdk_hosting_sources'), + native : false, + link_with : [vst3_base_wine_64bit, vst3_pluginterfaces_wine_64bit], + cpp_args : vst3_compiler_options + wine_64bit_compiler_options + ['-Wno-multichar'], + include_directories : vst3_include_dir, + override_options : ['warning_level=0'], +) + +# And another time for the 32-bit version +if with_bitbridge + vst3_base_wine_32bit = static_library( + 'vst3_base_wine_32bit', + vst3.get_variable('base_sources'), + native : false, + cpp_args : vst3_compiler_options + wine_32bit_compiler_options + ['-Wno-cpp'], + include_directories : vst3_include_dir, + override_options : ['warning_level=0'], + ) + vst3_pluginterfaces_wine_32bit = static_library( + 'vst3_pluginterfaces_wine_32bit', + vst3.get_variable('pluginterfaces_sources'), + native : false, + cpp_args : vst3_compiler_options + wine_32bit_compiler_options, + include_directories : vst3_include_dir, + override_options : ['warning_level=0'], + ) + vst3_sdk_hosting_wine_32bit = static_library( + 'vst3_sdk_hosting_wine_32bit', + vst3.get_variable('sdk_common_sources') + vst3.get_variable('sdk_hosting_sources'), + native : false, + link_with : [vst3_base_wine_32bit, vst3_pluginterfaces_wine_32bit], + cpp_args : vst3_compiler_options + wine_32bit_compiler_options + ['-Wno-multichar'], + include_directories : vst3_include_dir, + override_options : ['warning_level=0'], + ) +endif + +# +# VST3 dependencies +# + +vst3_sdk_native_dep = declare_dependency( + link_with : vst3_sdk_native, + include_directories : vst3_include_dir, + compile_args : vst3_compiler_options, +) + +vst3_sdk_hosting_wine_64bit_dep = declare_dependency( + link_with : vst3_sdk_hosting_wine_64bit, + include_directories : vst3_include_dir, + # 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_compiler_options + wine_64bit_compiler_options, +) + +if with_bitbridge + vst3_sdk_hosting_wine_32bit_dep = declare_dependency( + link_with : vst3_sdk_hosting_wine_32bit, + include_directories : vst3_include_dir, + # 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_compiler_options + wine_32bit_compiler_options, + ) +endif