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.

300 lines
7.1KB

  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. build_lv2 = get_option('build-lv2')
  16. build_vst2 = get_option('build-vst2')
  17. build_vst3 = get_option('build-vst3')
  18. build_legacy_only = get_option('build-legacy-only')
  19. linux_embed = get_option('linux-embed')
  20. optimizations = get_option('optimizations') and host_machine.cpu_family().contains('x86')
  21. ###############################################################################
  22. # set paths
  23. lv2dir = prefix / libdir / 'lv2'
  24. vst2dir = prefix / libdir / 'vst'
  25. vst3dir = prefix / libdir / 'vst3'
  26. ###############################################################################
  27. # set target OS
  28. os_darwin = false
  29. os_linux = false
  30. os_windows = false
  31. if host_machine.system() == 'darwin'
  32. os_darwin = true
  33. elif host_machine.system() == 'windows'
  34. os_windows = true
  35. elif host_machine.system() == 'linux'
  36. os_linux = true
  37. else
  38. error('unsupported system')
  39. endif
  40. ###############################################################################
  41. # set OS-specific details
  42. if os_darwin
  43. bin_suffix = ''
  44. lib_suffix = '.dylib'
  45. bintype_prefix = 'macOS-'
  46. elif os_windows
  47. bin_suffix = '.exe'
  48. lib_suffix = '.dll'
  49. bintype_prefix = 'Windows-'
  50. else
  51. bin_suffix = ''
  52. lib_suffix = '.so'
  53. bintype_prefix = 'Linux-'
  54. endif
  55. ###############################################################################
  56. # base compiler details
  57. cc = meson.get_compiler('c')
  58. cpp = meson.get_compiler('cpp')
  59. ###############################################################################
  60. # dependencies
  61. if os_linux
  62. dependencies = [
  63. cc.find_library('dl'),
  64. cc.find_library('rt'),
  65. dependency('fftw3f').partial_dependency(link_args: false, links: false),
  66. ]
  67. dependencies_devices = [
  68. dependency('alsa'),
  69. ]
  70. if not linux_embed
  71. dependencies += [
  72. dependency('freetype2'),
  73. dependency('x11').partial_dependency(link_args: false, links: false),
  74. dependency('xext').partial_dependency(link_args: false, links: false),
  75. ]
  76. endif
  77. elif os_windows
  78. dependencies = [
  79. cc.find_library('comdlg32'),
  80. cc.find_library('gdi32'),
  81. cc.find_library('imm32'),
  82. cc.find_library('ole32'),
  83. cc.find_library('oleaut32'),
  84. cc.find_library('shlwapi'),
  85. cc.find_library('uuid'),
  86. cc.find_library('version'),
  87. cc.find_library('wininet'),
  88. cc.find_library('winmm'),
  89. cc.find_library('ws2_32'),
  90. ]
  91. dependencies_devices = [
  92. ]
  93. else
  94. dependencies = [
  95. ]
  96. dependencies_devices = [
  97. ]
  98. endif
  99. ###############################################################################
  100. # build flags
  101. build_flags = [
  102. '-DJUCE_APP_CONFIG_HEADER="AppConfig.h"',
  103. '-pthread',
  104. '-Wall',
  105. '-Wno-multichar',
  106. '-Wno-strict-overflow',
  107. '-Wno-unused-function',
  108. ]
  109. build_flags_cpp = [
  110. '-std=gnu++11',
  111. ]
  112. if not os_darwin
  113. build_flags += [
  114. '-Wno-unused-but-set-variable',
  115. ]
  116. build_flags_cpp += [
  117. '-Wno-class-memaccess',
  118. ]
  119. endif
  120. build_flags_debug = [
  121. '-O0',
  122. '-ggdb',
  123. '-DDEBUG=1',
  124. '-D_DEBUG=1',
  125. ]
  126. build_flags_debug_cpp = [
  127. ]
  128. build_flags_release = [
  129. '-O3',
  130. '-fvisibility=hidden',
  131. '-DNDEBUG=1',
  132. '-fdata-sections',
  133. '-ffunction-sections',
  134. ]
  135. build_flags_release_cpp = [
  136. '-fvisibility-inlines-hidden',
  137. ]
  138. if optimizations and not linux_embed
  139. build_flags_release += [
  140. '-mtune=generic', '-msse', '-msse2',
  141. ]
  142. endif
  143. if os_darwin
  144. build_flags += [
  145. '-DMAC=1',
  146. '-DGL_SILENCE_DEPRECATION=1',
  147. ]
  148. build_flags_cpp += [
  149. '-ObjC++',
  150. ]
  151. elif os_windows
  152. build_flags += [
  153. '-DWINDOWS=1',
  154. '-mstackrealign',
  155. ]
  156. build_flags_cpp += [
  157. '-fpermissive',
  158. ]
  159. elif linux_embed
  160. build_flags += [
  161. '-DLINUX=1',
  162. ]
  163. build_flags_cpp += [
  164. '-DJUCE_AUDIOPROCESSOR_NO_GUI=1',
  165. ]
  166. else
  167. build_flags += [
  168. '-DLINUX=1',
  169. ]
  170. endif
  171. ###############################################################################
  172. # link flags
  173. link_flags = [
  174. '-pthread',
  175. ]
  176. link_flags_debug = [
  177. ]
  178. link_flags_release = [
  179. '-fdata-sections',
  180. '-ffunction-sections',
  181. ]
  182. if os_windows
  183. link_flags += [
  184. '-static',
  185. ]
  186. endif
  187. if os_darwin
  188. link_flags_release += [
  189. '-Wl,-dead_strip',
  190. '-Wl,-dead_strip_dylibs',
  191. ]
  192. else
  193. link_flags += [
  194. '-Wl,--no-undefined',
  195. ]
  196. link_flags_release += [
  197. '-Wl,-O1',
  198. '-Wl,--as-needed',
  199. '-Wl,--gc-sections',
  200. '-Wl,--strip-all',
  201. ]
  202. endif
  203. ###############################################################################
  204. # combine flags depending on build type
  205. if buildtype == 'debug'
  206. build_flags += build_flags_debug
  207. build_flags_cpp += build_flags_debug_cpp + build_flags
  208. link_flags += link_flags_debug
  209. else
  210. build_flags += build_flags_release
  211. build_flags_cpp += build_flags_release_cpp + build_flags
  212. link_flags += link_flags_release
  213. endif
  214. ###############################################################################
  215. # go into subdir to build libraries and plugins
  216. subdir('libs')
  217. subdir('ports')
  218. subdir('ports-legacy')
  219. ###############################################################################
  220. # extra files to install
  221. if 'tal-noisemaker' in get_option('plugins')
  222. extra_lv2_preset_files = [
  223. 'TAL-NoiseMaker-Noise4U.lv2/manifest.ttl',
  224. 'TAL-NoiseMaker-Noise4U.lv2/presets.ttl',
  225. ]
  226. foreach preset_file : extra_lv2_preset_files
  227. install_data([ 'static-lv2-ttl/@0@'.format(preset_file) ],
  228. install_dir: lv2dir / 'TAL-NoiseMaker-Noise4U.lv2',
  229. )
  230. endforeach
  231. endif
  232. if 'vitalium' in get_option('plugins')
  233. extra_lv2_preset_files = [
  234. 'Vitalium-unfa.lv2/manifest.ttl',
  235. 'Vitalium-unfa.lv2/Analog_Brass.ttl',
  236. 'Vitalium-unfa.lv2/Combat.ttl',
  237. 'Vitalium-unfa.lv2/Dark_Ambient.ttl',
  238. 'Vitalium-unfa.lv2/Dark_Bouncy_Groove.ttl',
  239. 'Vitalium-unfa.lv2/Hardcore_Kick.ttl',
  240. 'Vitalium-unfa.lv2/Kickbass.ttl',
  241. 'Vitalium-unfa.lv2/Koto.ttl',
  242. 'Vitalium-unfa.lv2/Nasty_Growl.ttl',
  243. 'Vitalium-unfa.lv2/Pianium.ttl',
  244. 'Vitalium-unfa.lv2/Power_Lead.ttl',
  245. 'Vitalium-unfa.lv2/Retro_Ambient_Pluck.ttl',
  246. 'Vitalium-unfa.lv2/Sci_Fi_Computer.ttl',
  247. 'Vitalium-unfa.lv2/Sci_Fi_Piano.ttl',
  248. 'Vitalium-unfa.lv2/Sparkly_Dreamy_Pad.ttl',
  249. 'Vitalium-unfa.lv2/Supersaw.ttl',
  250. 'Vitalium-unfa.lv2/Trance_Pluck.ttl',
  251. 'Vitalium-unfa.lv2/Vitalium_Groove.ttl',
  252. ]
  253. foreach preset_file : extra_lv2_preset_files
  254. install_data([ 'static-lv2-ttl/@0@'.format(preset_file) ],
  255. install_dir: lv2dir / 'Vitalium-unfa.lv2',
  256. )
  257. endforeach
  258. endif
  259. ###############################################################################