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.

287 lines
9.6KB

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