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.

391 lines
9.6KB

  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 not (os_darwin or os_windows)
  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. ]
  203. build_flags_cpp += [
  204. '-ObjC++',
  205. ]
  206. if build_universal
  207. build_flags += [
  208. '-arch', 'x86_64',
  209. '-arch', 'arm64',
  210. ]
  211. endif
  212. elif os_windows
  213. build_flags += [
  214. '-DWINDOWS=1',
  215. '-mstackrealign',
  216. ]
  217. build_flags_cpp += [
  218. '-fpermissive',
  219. ]
  220. elif linux_headless
  221. build_flags += [
  222. '-DLINUX=1',
  223. ]
  224. build_flags_cpp += [
  225. '-DJUCE_AUDIOPROCESSOR_NO_GUI=1',
  226. ]
  227. else
  228. build_flags += [
  229. '-DLINUX=1',
  230. ]
  231. endif
  232. ###############################################################################
  233. # link flags
  234. link_flags = [
  235. '-pthread',
  236. ]
  237. link_flags_debug = [
  238. ]
  239. link_flags_release = [
  240. '-fdata-sections',
  241. '-ffunction-sections',
  242. ]
  243. if lto_optimizations
  244. link_flags_release += [
  245. '-Werror=odr',
  246. '-Werror=lto-type-mismatch',
  247. ]
  248. endif
  249. if os_darwin
  250. if build_universal
  251. link_flags += [
  252. '-arch', 'x86_64',
  253. '-arch', 'arm64',
  254. ]
  255. endif
  256. link_flags_release += [
  257. '-Wl,-dead_strip,-dead_strip_dylibs,-x',
  258. ]
  259. elif os_windows
  260. link_flags += [
  261. '-static',
  262. ]
  263. else
  264. link_flags += [
  265. '-Wl,--as-needed,--no-undefined',
  266. ]
  267. link_flags_release += [
  268. '-Wl,-O1,--gc-sections,--strip-all',
  269. ]
  270. endif
  271. ###############################################################################
  272. # combine flags depending on build type
  273. if buildtype == 'debug'
  274. build_flags += build_flags_debug
  275. build_flags_cpp += build_flags_debug_cpp + build_flags
  276. link_flags += link_flags_debug
  277. else
  278. build_flags += build_flags_release
  279. build_flags_cpp += build_flags_release_cpp + build_flags
  280. link_flags += link_flags_release
  281. endif
  282. ###############################################################################
  283. # go into subdir to build libraries and plugins
  284. subdir('libs')
  285. if not (build_juce60_only or build_juce61_only or build_juce7_only)
  286. subdir('ports-juce5')
  287. endif
  288. if not (build_juce5_only or build_juce61_only or build_juce7_only)
  289. subdir('ports-juce6.0')
  290. endif
  291. if not (build_juce5_only or build_juce60_only or build_juce7_only)
  292. subdir('ports-juce6.1')
  293. endif
  294. # no plugins imported that use juce7 yet
  295. # if not (build_juce5_only or build_juce60_only or build_juce61_only)
  296. # subdir('ports-juce7')
  297. # endif
  298. ###############################################################################
  299. # extra files to install
  300. if 'tal-noisemaker' in get_option('plugins')
  301. extra_lv2_preset_files = [
  302. 'TAL-NoiseMaker-Noise4U.lv2/manifest.ttl',
  303. 'TAL-NoiseMaker-Noise4U.lv2/presets.ttl',
  304. ]
  305. foreach preset_file : extra_lv2_preset_files
  306. install_data([ 'static-lv2-ttl/@0@'.format(preset_file) ],
  307. install_dir: lv2dir / 'TAL-NoiseMaker-Noise4U.lv2',
  308. )
  309. endforeach
  310. endif
  311. if 'vitalium' in get_option('plugins')
  312. extra_lv2_preset_files = [
  313. 'Vitalium-unfa.lv2/manifest.ttl',
  314. 'Vitalium-unfa.lv2/Analog_Brass.ttl',
  315. 'Vitalium-unfa.lv2/Combat.ttl',
  316. 'Vitalium-unfa.lv2/Dark_Ambient.ttl',
  317. 'Vitalium-unfa.lv2/Dark_Bouncy_Groove.ttl',
  318. 'Vitalium-unfa.lv2/Hardcore_Kick.ttl',
  319. 'Vitalium-unfa.lv2/Kickbass.ttl',
  320. 'Vitalium-unfa.lv2/Koto.ttl',
  321. 'Vitalium-unfa.lv2/Nasty_Growl.ttl',
  322. 'Vitalium-unfa.lv2/Pianium.ttl',
  323. 'Vitalium-unfa.lv2/Power_Lead.ttl',
  324. 'Vitalium-unfa.lv2/Retro_Ambient_Pluck.ttl',
  325. 'Vitalium-unfa.lv2/Sci_Fi_Computer.ttl',
  326. 'Vitalium-unfa.lv2/Sci_Fi_Piano.ttl',
  327. 'Vitalium-unfa.lv2/Sparkly_Dreamy_Pad.ttl',
  328. 'Vitalium-unfa.lv2/Supersaw.ttl',
  329. 'Vitalium-unfa.lv2/Trance_Pluck.ttl',
  330. 'Vitalium-unfa.lv2/Vitalium_Groove.ttl',
  331. ]
  332. foreach preset_file : extra_lv2_preset_files
  333. install_data([ 'static-lv2-ttl/@0@'.format(preset_file) ],
  334. install_dir: lv2dir / 'Vitalium-unfa.lv2',
  335. )
  336. endforeach
  337. endif
  338. ###############################################################################