You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

265 lines
9.1KB

  1. ###############################################################################
  2. if linux_embed
  3. plugins = [
  4. 'vitalium',
  5. 'swankyamp',
  6. ]
  7. else
  8. plugins = [
  9. 'chow',
  10. 'vitalium',
  11. 'swankyamp',
  12. ]
  13. endif
  14. plugin_include_dirs = [
  15. include_directories('../libs/juce6'),
  16. include_directories('../libs/juce6/source'),
  17. include_directories('../libs/juce6/source/modules'),
  18. include_directories('../libs/juce6/source/modules/juce_audio_processors/format_types/VST3_SDK'),
  19. include_directories('../libs/juce-plugin'),
  20. ]
  21. ###############################################################################
  22. # build flags for plugins
  23. build_flags_plugin = [
  24. '-Werror=deprecated-declarations',
  25. ]
  26. build_flag_plugin_cpp = [
  27. '-std=gnu++14',
  28. ]
  29. ###############################################################################
  30. # format-specific build flags
  31. build_flags_plugin_lv2 = [
  32. '-DJucePlugin_Build_AU=0',
  33. '-DJucePlugin_Build_LV2=1',
  34. '-DJucePlugin_Build_RTAS=0',
  35. '-DJucePlugin_Build_VST=0',
  36. '-DJucePlugin_Build_VST3=0',
  37. '-DJucePlugin_Build_Standalone=0',
  38. '-DBINTYPE=@0@LV2'.format(bintype_prefix),
  39. '-Wno-parentheses',
  40. '-Wno-deprecated-declarations', # FIXME
  41. ]
  42. build_flags_plugin_vst2 = [
  43. '-DJucePlugin_Build_AU=0',
  44. '-DJucePlugin_Build_LV2=0',
  45. '-DJucePlugin_Build_RTAS=0',
  46. '-DJucePlugin_Build_VST=1',
  47. '-DJucePlugin_Build_VST3=0',
  48. '-DJucePlugin_Build_Standalone=0',
  49. '-DBINTYPE=@0@VST2'.format(bintype_prefix),
  50. '-Wno-write-strings',
  51. ]
  52. build_flags_plugin_vst3 = [
  53. '-DJucePlugin_Build_AU=0',
  54. '-DJucePlugin_Build_LV2=0',
  55. '-DJucePlugin_Build_RTAS=0',
  56. '-DJucePlugin_Build_VST=0',
  57. '-DJucePlugin_Build_VST3=1',
  58. '-DJucePlugin_Build_Standalone=0',
  59. '-DBINTYPE=@0@VST3'.format(bintype_prefix),
  60. '-Wno-non-virtual-dtor',
  61. ]
  62. if os_windows
  63. build_flags_plugin_vst3 += [
  64. '-D_NATIVE_WCHAR_T_DEFINED',
  65. '-D__wchar_t=wchar_t',
  66. ]
  67. endif
  68. ###############################################################################
  69. # format-specific link flags
  70. link_flags_plugin_common = [
  71. ]
  72. if os_darwin
  73. link_flags_plugin_common += [
  74. '-framework', 'Accelerate',
  75. '-framework', 'AudioToolbox',
  76. '-framework', 'AudioUnit',
  77. '-framework', 'Carbon',
  78. '-framework', 'Cocoa',
  79. '-framework', 'CoreAudio',
  80. '-framework', 'CoreAudioKit',
  81. '-framework', 'CoreMIDI',
  82. '-framework', 'IOKit',
  83. '-framework', 'QuartzCore',
  84. '-framework', 'WebKit',
  85. ]
  86. link_flags_plugin_lv2 = [
  87. '-Wl,-exported_symbol,_lv2_generate_ttl',
  88. '-Wl,-exported_symbol,_lv2_descriptor',
  89. '-Wl,-exported_symbol,_lv2ui_descriptor',
  90. ]
  91. link_flags_plugin_vst2 = [
  92. '-Wl,-exported_symbol,_VSTPluginMain',
  93. ]
  94. link_flags_plugin_vst3 = [
  95. '-Wl,-exported_symbol,_bundleEntry',
  96. '-Wl,-exported_symbol,_bundleExit',
  97. '-Wl,-exported_symbol,_GetPluginFactory',
  98. ]
  99. else
  100. link_flags_plugin_lv2 = [
  101. '-Wl,--version-script=' + meson.source_root() + '/scripts/plugin-symbols-lv2.version',
  102. ]
  103. link_flags_plugin_vst2 = [
  104. '-Wl,--version-script=' + meson.source_root() + '/scripts/plugin-symbols-vst2.version',
  105. ]
  106. link_flags_plugin_vst3 = [
  107. '-Wl,--version-script=' + meson.source_root() + '/scripts/plugin-symbols-vst3.version',
  108. ]
  109. endif
  110. ###############################################################################
  111. foreach plugin : plugins
  112. if plugin in get_option('plugins')
  113. plugin_uses_devices = false
  114. plugin_uses_opengl = false
  115. plugin_extra_dependencies = []
  116. plugin_extra_include_dirs = []
  117. plugin_extra_build_flags = []
  118. plugin_extra_link_flags = []
  119. plugin_extra_format_specific_srcs = []
  120. subdir(plugin)
  121. plugin_extra_format_specific_srcs += files([
  122. '../libs/juce-plugin/JucePluginMain.cpp',
  123. '../libs/juce-plugin/JucePluginUtils.cpp',
  124. ])
  125. if plugin_uses_devices
  126. link_with_plugin += lib_juce6_devices
  127. if os_linux
  128. plugin_extra_dependencies += [
  129. dependency('alsa')
  130. ]
  131. endif
  132. endif
  133. if plugin_uses_opengl
  134. if os_darwin
  135. plugin_extra_link_flags += [
  136. '-framework', 'OpenGL',
  137. ]
  138. elif os_windows
  139. plugin_extra_dependencies += [
  140. cc.find_library('opengl32'),
  141. ]
  142. elif not linux_embed
  143. plugin_extra_dependencies += [
  144. dependency('gl')
  145. ]
  146. endif
  147. endif
  148. plugin_lib = static_library(plugin_name + '_lib',
  149. name_prefix: '',
  150. sources: plugin_srcs,
  151. include_directories: [
  152. include_directories(plugin),
  153. plugin_include_dirs,
  154. plugin_extra_include_dirs,
  155. ],
  156. c_args: build_flags + build_flags_plugin + plugin_extra_build_flags,
  157. cpp_args: build_flags_cpp + build_flags_plugin + build_flag_plugin_cpp + plugin_extra_build_flags,
  158. dependencies: plugin_extra_dependencies,
  159. pic: true,
  160. install: false,
  161. )
  162. if build_lv2
  163. plugin_lv2_lib = shared_library(plugin_name + '_lv2',
  164. name_prefix: '',
  165. sources: plugin_extra_format_specific_srcs,
  166. include_directories: [
  167. include_directories(plugin),
  168. plugin_include_dirs,
  169. plugin_extra_include_dirs,
  170. ],
  171. c_args: build_flags + build_flags_plugin + build_flags_plugin_lv2 + plugin_extra_build_flags,
  172. cpp_args: build_flags_cpp + build_flags_plugin + build_flags_plugin_lv2 + build_flag_plugin_cpp + plugin_extra_build_flags,
  173. link_args: link_flags + link_flags_plugin_common + link_flags_plugin_lv2 + plugin_extra_link_flags,
  174. link_with: [ lib_juce6, plugin_lib ],
  175. )
  176. plugin_lv2_dir = meson.current_build_dir() / plugin_name + '.lv2'
  177. plugin_lv2_ttl = custom_target(plugin_name + '_lv2-ttl',
  178. output: plugin_name + '.lv2',
  179. input: plugin_lv2_lib,
  180. command: [
  181. 'mkdir', '-p', plugin_lv2_dir, '&&',
  182. 'cd', plugin_lv2_dir, '&&',
  183. 'mv', plugin_lv2_lib.full_path(), plugin_lv2_dir / plugin_name + lib_suffix, '&&',
  184. (meson.is_cross_build() ? 'wine' : 'env'), lv2_ttl_generator, '.' / plugin_name + lib_suffix,
  185. ],
  186. install: true,
  187. install_dir: lv2dir,
  188. )
  189. endif
  190. if build_vst2
  191. plugin_vst2 = shared_library(plugin_name,
  192. name_prefix: '',
  193. sources: plugin_extra_format_specific_srcs,
  194. include_directories: [
  195. include_directories(plugin),
  196. plugin_include_dirs,
  197. plugin_extra_include_dirs,
  198. ],
  199. c_args: build_flags + build_flags_plugin + build_flags_plugin_vst2 + plugin_extra_build_flags,
  200. cpp_args: build_flags_cpp + build_flags_plugin + build_flags_plugin_vst2 + build_flag_plugin_cpp + plugin_extra_build_flags,
  201. link_args: link_flags + link_flags_plugin_common + link_flags_plugin_vst2 + plugin_extra_link_flags,
  202. link_with: [ lib_juce6, plugin_lib ],
  203. install: true,
  204. install_dir: vst2dir,
  205. )
  206. endif
  207. if build_vst3
  208. plugin_vst3_lib = shared_library(plugin_name + '-vst3',
  209. name_prefix: '',
  210. sources: plugin_extra_format_specific_srcs,
  211. include_directories: [
  212. include_directories(plugin),
  213. plugin_include_dirs,
  214. plugin_extra_include_dirs,
  215. ],
  216. c_args: build_flags + build_flags_plugin + build_flags_plugin_vst3 + plugin_extra_build_flags,
  217. cpp_args: build_flags_cpp + build_flags_plugin + build_flags_plugin_vst3 + build_flag_plugin_cpp + plugin_extra_build_flags,
  218. link_args: link_flags + link_flags_plugin_common + link_flags_plugin_vst3 + plugin_extra_link_flags,
  219. link_with: [ lib_juce6, plugin_lib ],
  220. )
  221. plugin_vst3_dir = meson.current_build_dir() / plugin_name + '.vst3' / 'Contents' / host_machine.cpu_family() + '-' + host_machine.system()
  222. plugin_vst3 = custom_target(plugin_name + '_vst3-bundle',
  223. output: plugin_name + '.vst3',
  224. input: plugin_vst3_lib,
  225. command: [
  226. 'mkdir', '-p', plugin_vst3_dir, '&&',
  227. 'cd', plugin_vst3_dir, '&&',
  228. 'mv', plugin_vst3_lib.full_path(), plugin_vst3_dir / plugin_name + lib_suffix,
  229. ],
  230. install: true,
  231. install_dir: vst3dir,
  232. )
  233. endif
  234. endif
  235. endforeach
  236. ###############################################################################