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.

368 lines
8.8KB

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