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.

410 lines
10KB

  1. ###############################################################################
  2. project('DISTRHO-Ports',
  3. ['c', 'cpp'],
  4. license : 'GPLv3',
  5. meson_version: '>=0.55.0',
  6. version: '1',
  7. )
  8. ###############################################################################
  9. # set target OS
  10. os_darwin = false
  11. os_linux = false
  12. os_windows = false
  13. if host_machine.system() == 'darwin'
  14. os_darwin = true
  15. elif host_machine.system() == 'windows'
  16. os_windows = true
  17. elif host_machine.system() == 'linux'
  18. os_linux = true
  19. else
  20. error('unsupported system')
  21. endif
  22. ###############################################################################
  23. # get options
  24. buildtype = get_option('buildtype')
  25. prefix = get_option('prefix')
  26. bindir = get_option('bindir')
  27. libdir = get_option('libdir')
  28. if libdir.contains('/')
  29. libdir = 'lib'
  30. endif
  31. linux_headless = get_option('linux-headless')
  32. build_lv2 = get_option('build-lv2')
  33. build_vst2 = get_option('build-vst2') and not linux_headless
  34. build_vst3 = get_option('build-vst3') and not linux_headless
  35. build_juce5_only = get_option('build-juce5-only')
  36. build_juce60_only = get_option('build-juce60-only')
  37. build_juce61_only = get_option('build-juce61-only')
  38. build_juce7_only = get_option('build-juce7-only')
  39. build_universal = get_option('build-universal')
  40. optimizations = get_option('optimizations') and buildtype != 'debug'
  41. lto_optimizations = get_option('lto-optimizations') and buildtype != 'debug' and not os_windows
  42. neon_optimizations = get_option('neon-optimizations') and buildtype != 'debug' and (
  43. host_machine.cpu_family() == 'arm'
  44. )
  45. sse_optimizations = get_option('sse-optimizations') and buildtype != 'debug' and (
  46. host_machine.cpu_family() == 'x86' or host_machine.cpu_family() == 'x86_64'
  47. )
  48. ###############################################################################
  49. # set paths
  50. lv2dir = prefix / libdir / 'lv2'
  51. vst2dir = prefix / libdir / 'vst'
  52. vst3dir = prefix / libdir / 'vst3'
  53. ###############################################################################
  54. # set OS-specific details
  55. if os_darwin
  56. bin_suffix = ''
  57. lib_suffix = '.dylib'
  58. bintype_prefix = 'macOS-'
  59. elif os_windows
  60. bin_suffix = '.exe'
  61. lib_suffix = '.dll'
  62. bintype_prefix = 'Windows-'
  63. else
  64. bin_suffix = ''
  65. lib_suffix = '.so'
  66. bintype_prefix = 'Linux-'
  67. endif
  68. ###############################################################################
  69. # base compiler details
  70. cc = meson.get_compiler('c')
  71. cpp = meson.get_compiler('cpp')
  72. ###############################################################################
  73. # dependencies
  74. if os_linux
  75. dependencies = [
  76. cc.find_library('dl'),
  77. cc.find_library('rt'),
  78. dependency('fftw3f').partial_dependency(link_args: false, links: false),
  79. ]
  80. dependencies_devices = [
  81. dependency('alsa'),
  82. ]
  83. if not linux_headless
  84. dependencies += [
  85. dependency('freetype2'),
  86. dependency('x11').partial_dependency(link_args: false, links: false),
  87. dependency('xext').partial_dependency(link_args: false, links: false),
  88. ]
  89. endif
  90. elif os_windows
  91. dependencies = [
  92. cc.find_library('comdlg32'),
  93. cc.find_library('gdi32'),
  94. cc.find_library('imm32'),
  95. cc.find_library('ole32'),
  96. cc.find_library('oleaut32'),
  97. cc.find_library('shlwapi'),
  98. cc.find_library('uuid'),
  99. cc.find_library('version'),
  100. cc.find_library('wininet'),
  101. cc.find_library('winmm'),
  102. cc.find_library('ws2_32'),
  103. ]
  104. dependencies_devices = [
  105. ]
  106. else
  107. dependencies = [
  108. ]
  109. dependencies_devices = [
  110. ]
  111. endif
  112. ###############################################################################
  113. # build flags
  114. build_flags = [
  115. '-DJUCE_APP_CONFIG_HEADER="AppConfig.h"',
  116. '-fno-common',
  117. '-pthread',
  118. '-Wall',
  119. '-Wno-multichar',
  120. '-Wno-strict-overflow',
  121. '-Wno-unused-function',
  122. ]
  123. build_flags_cpp = [
  124. '-std=gnu++11',
  125. ]
  126. if not os_darwin
  127. build_flags += [
  128. '-Wno-unused-but-set-variable',
  129. ]
  130. build_flags_cpp += [
  131. '-Wno-class-memaccess',
  132. ]
  133. endif
  134. if cc.get_id() == 'gcc'
  135. build_flags += [
  136. '-fno-gnu-unique'
  137. ]
  138. endif
  139. ###############################################################################
  140. # build flags (debug)
  141. build_flags_debug = [
  142. '-O0',
  143. '-ggdb',
  144. '-DDEBUG=1',
  145. '-D_DEBUG=1',
  146. ]
  147. build_flags_debug_cpp = [
  148. ]
  149. ###############################################################################
  150. # build flags (release)
  151. build_flags_release = [
  152. '-O3',
  153. '-fvisibility=hidden',
  154. '-DNDEBUG=1',
  155. '-fdata-sections',
  156. '-ffunction-sections',
  157. ]
  158. build_flags_release_cpp = [
  159. '-fvisibility-inlines-hidden',
  160. ]
  161. if optimizations or neon_optimizations or sse_optimizations
  162. build_flags_release += [
  163. '-ffast-math',
  164. ]
  165. endif
  166. if optimizations
  167. build_flags_release += [
  168. '-fomit-frame-pointer', '-ftree-vectorize', '-funroll-loops',
  169. ]
  170. if not os_darwin
  171. build_flags_release += [
  172. '-fprefetch-loop-arrays',
  173. ]
  174. endif
  175. endif
  176. if lto_optimizations
  177. build_flags_release += [
  178. '-fno-strict-aliasing', '-flto',
  179. ]
  180. endif
  181. if sse_optimizations or build_universal
  182. build_flags_release += [
  183. '-mtune=generic', '-msse', '-msse2',
  184. ]
  185. if not build_universal
  186. build_flags_release += [
  187. '-mfpmath=sse',
  188. ]
  189. endif
  190. endif
  191. if neon_optimizations
  192. build_flags_release += [
  193. '-mfpu=neon-vfpv4', '-mfloat-abi=hard',
  194. ]
  195. endif
  196. ###############################################################################
  197. # build flags (per-OS macros and setup)
  198. if os_darwin
  199. build_flags += [
  200. '-DMAC=1',
  201. '-DGL_SILENCE_DEPRECATION=1',
  202. '-DMAC_OS_X_VERSION_MAX_ALLOWED=MAC_OS_X_VERSION_10_15',
  203. '-DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_15',
  204. '-mmacosx-version-min=10.15',
  205. ]
  206. build_flags_cpp += [
  207. '-ObjC++',
  208. ]
  209. if build_universal
  210. build_flags += [
  211. '-arch', 'x86_64',
  212. '-arch', 'arm64',
  213. ]
  214. endif
  215. elif os_windows
  216. build_flags += [
  217. '-DWINDOWS=1',
  218. '-mstackrealign',
  219. ]
  220. build_flags_cpp += [
  221. '-fpermissive',
  222. ]
  223. else
  224. build_flags += [
  225. '-DLINUX=1',
  226. ]
  227. if linux_headless
  228. build_flags_cpp += [
  229. '-DJUCE_AUDIOPROCESSOR_NO_GUI=1',
  230. ]
  231. endif
  232. endif
  233. ###############################################################################
  234. # link flags
  235. link_flags = [
  236. '-pthread',
  237. ]
  238. link_flags_debug = [
  239. ]
  240. link_flags_release = [
  241. '-fdata-sections',
  242. '-ffunction-sections',
  243. ]
  244. if lto_optimizations
  245. link_flags_release += [
  246. '-Werror=odr',
  247. '-Werror=lto-type-mismatch',
  248. ]
  249. endif
  250. if os_darwin
  251. link_flags += [
  252. '-mmacosx-version-min=10.15',
  253. ]
  254. link_flags_release += [
  255. '-Wl,-dead_strip,-dead_strip_dylibs,-x',
  256. ]
  257. if build_universal
  258. link_flags += [
  259. '-arch', 'x86_64',
  260. '-arch', 'arm64',
  261. ]
  262. endif
  263. elif os_windows
  264. link_flags += [
  265. '-static',
  266. '-Wl,--as-needed,--no-undefined',
  267. ]
  268. link_flags_release += [
  269. '-Wl,-O1,--gc-sections,--strip-all',
  270. ]
  271. else
  272. link_flags += [
  273. '-Wl,--as-needed,--no-undefined',
  274. ]
  275. link_flags_release += [
  276. '-Wl,-O1,--gc-sections,--strip-all',
  277. ]
  278. endif
  279. ###############################################################################
  280. # combine flags depending on build type
  281. if buildtype == 'debug'
  282. build_flags += build_flags_debug
  283. build_flags_cpp += build_flags_debug_cpp + build_flags
  284. link_flags += link_flags_debug
  285. else
  286. build_flags += build_flags_release
  287. build_flags_cpp += build_flags_release_cpp + build_flags
  288. link_flags += link_flags_release
  289. endif
  290. ###############################################################################
  291. # set vst3 architecture bundle name
  292. if os_darwin
  293. vst3_bundle_name = 'MacOS'
  294. elif os_windows
  295. vst3_bundle_name = host_machine.cpu_family() + '-win'
  296. else
  297. vst3_bundle_name = host_machine.cpu_family() + '-' + host_machine.system()
  298. endif
  299. ###############################################################################
  300. # go into subdir to build libraries and plugins
  301. subdir('libs')
  302. if not (build_juce60_only or build_juce61_only or build_juce7_only)
  303. subdir('ports-juce5')
  304. endif
  305. if not (build_juce5_only or build_juce61_only or build_juce7_only)
  306. subdir('ports-juce6.0')
  307. endif
  308. if not (build_juce5_only or build_juce60_only or build_juce7_only)
  309. subdir('ports-juce6.1')
  310. endif
  311. # NOTICE no plugins imported that use juce7 yet
  312. if not (build_juce5_only or build_juce60_only or build_juce61_only)
  313. subdir('ports-juce7')
  314. endif
  315. ###############################################################################
  316. # extra files to install
  317. if 'tal-noisemaker' in get_option('plugins')
  318. extra_lv2_preset_files = [
  319. 'TAL-NoiseMaker-Noise4U.lv2/manifest.ttl',
  320. 'TAL-NoiseMaker-Noise4U.lv2/presets.ttl',
  321. ]
  322. foreach preset_file : extra_lv2_preset_files
  323. install_data([ 'static-lv2-ttl/@0@'.format(preset_file) ],
  324. install_dir: lv2dir / 'TAL-NoiseMaker-Noise4U.lv2',
  325. )
  326. endforeach
  327. endif
  328. if 'vitalium' in get_option('plugins')
  329. extra_lv2_preset_files = [
  330. 'Vitalium-unfa.lv2/manifest.ttl',
  331. 'Vitalium-unfa.lv2/Analog_Brass.ttl',
  332. 'Vitalium-unfa.lv2/Combat.ttl',
  333. 'Vitalium-unfa.lv2/Dark_Ambient.ttl',
  334. 'Vitalium-unfa.lv2/Dark_Bouncy_Groove.ttl',
  335. 'Vitalium-unfa.lv2/Hardcore_Kick.ttl',
  336. 'Vitalium-unfa.lv2/Kickbass.ttl',
  337. 'Vitalium-unfa.lv2/Koto.ttl',
  338. 'Vitalium-unfa.lv2/Nasty_Growl.ttl',
  339. 'Vitalium-unfa.lv2/Pianium.ttl',
  340. 'Vitalium-unfa.lv2/Power_Lead.ttl',
  341. 'Vitalium-unfa.lv2/Retro_Ambient_Pluck.ttl',
  342. 'Vitalium-unfa.lv2/Sci_Fi_Computer.ttl',
  343. 'Vitalium-unfa.lv2/Sci_Fi_Piano.ttl',
  344. 'Vitalium-unfa.lv2/Sparkly_Dreamy_Pad.ttl',
  345. 'Vitalium-unfa.lv2/Supersaw.ttl',
  346. 'Vitalium-unfa.lv2/Trance_Pluck.ttl',
  347. 'Vitalium-unfa.lv2/Vitalium_Groove.ttl',
  348. ]
  349. foreach preset_file : extra_lv2_preset_files
  350. install_data([ 'static-lv2-ttl/@0@'.format(preset_file) ],
  351. install_dir: lv2dir / 'Vitalium-unfa.lv2',
  352. )
  353. endforeach
  354. endif
  355. ###############################################################################