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.

240 lines
5.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 = 'Mac-'
  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. dependencies = [
  62. ]
  63. if os_linux
  64. dependencies += [
  65. cc.find_library('dl'),
  66. cc.find_library('rt'),
  67. ]
  68. endif
  69. if os_linux and not linux_embed
  70. dependencies += [
  71. dependency('alsa'),
  72. dependency('freetype2'),
  73. dependency('x11'),
  74. dependency('xext'),
  75. ]
  76. endif
  77. ###############################################################################
  78. # build flags
  79. build_flags = [
  80. '-DJUCE_APP_CONFIG_HEADER="AppConfig.h"',
  81. '-pthread',
  82. '-Wall',
  83. '-Wno-multichar',
  84. '-Wno-strict-overflow',
  85. '-Wno-unused-but-set-variable',
  86. '-Wno-unused-function',
  87. ]
  88. build_flags_cpp = [
  89. '-Wno-class-memaccess',
  90. ]
  91. build_flags_debug = [
  92. '-O0', '-ggdb',
  93. '-DDEBUG=1', '-D_DEBUG=1',
  94. ]
  95. build_flags_debug_cpp = [
  96. ]
  97. build_flags_release = [
  98. '-O3', '-fvisibility=hidden',
  99. '-DNDEBUG=1',
  100. ]
  101. build_flags_release_cpp = [
  102. '-fvisibility-inlines-hidden',
  103. ]
  104. if optimizations and not linux_embed
  105. build_flags_release += [
  106. '-mtune=generic', '-msse', '-msse2',
  107. ]
  108. endif
  109. if not os_darwin
  110. build_flags_cpp += [
  111. '-std=gnu++11',
  112. ]
  113. build_flags_release += [
  114. '-fdata-sections', '-ffunction-sections',
  115. ]
  116. endif
  117. if os_darwin
  118. build_flags += [
  119. '-DMAC=1',
  120. ]
  121. build_flags_cpp += [
  122. '-ObjC++',
  123. ]
  124. elif os_windows
  125. build_flags += [
  126. '-DWINDOWS=1',
  127. '-mstackrealign',
  128. ]
  129. build_flags_cpp += [
  130. '-fpermissive',
  131. ]
  132. elif linux_embed
  133. build_flags += [
  134. '-DLINUX=1',
  135. ]
  136. build_flags_cpp += [
  137. '-DJUCE_AUDIOPROCESSOR_NO_GUI=1',
  138. ]
  139. else
  140. build_flags += [
  141. '-DLINUX=1',
  142. ]
  143. endif
  144. ###############################################################################
  145. # link flags
  146. link_flags = [
  147. '-pthread',
  148. ]
  149. link_flags_debug = [
  150. ]
  151. link_flags_release = [
  152. ]
  153. if os_windows
  154. link_flags += [
  155. '-static',
  156. ]
  157. endif
  158. if not os_darwin
  159. link_flags += [
  160. '-Wl,--no-undefined',
  161. ]
  162. link_flags_release += [
  163. '-fdata-sections', '-ffunction-sections', '-Wl,--gc-sections',
  164. '-Wl,--as-needed',
  165. '-Wl,--strip-all',
  166. ]
  167. endif
  168. ###############################################################################
  169. # combine flags depending on build type
  170. if buildtype == 'debug'
  171. build_flags += build_flags_debug
  172. build_flags_cpp += build_flags_debug_cpp + build_flags
  173. link_flags += link_flags_debug
  174. else
  175. build_flags += build_flags_release
  176. build_flags_cpp += build_flags_release_cpp + build_flags
  177. link_flags += link_flags_release
  178. endif
  179. ###############################################################################
  180. # go into subdir to build libraries and plugins
  181. subdir('libs')
  182. subdir('ports')
  183. subdir('ports-legacy')
  184. ###############################################################################
  185. # extra files to install
  186. extra_lv2_preset_bundles = [
  187. 'TAL-NoiseMaker-Noise4U.lv2',
  188. ]
  189. foreach bundle : extra_lv2_preset_bundles
  190. install_data([
  191. 'static-lv2-ttl/@0@/manifest.ttl'.format(bundle),
  192. 'static-lv2-ttl/@0@/presets.ttl'.format(bundle),
  193. ],
  194. install_dir: lv2dir / bundle,
  195. )
  196. endforeach
  197. ###############################################################################