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.

378 lines
9.2KB

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