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.

239 lines
5.0KB

  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. linux_embed = get_option('linux-embed')
  19. optimizations = get_option('optimizations') and host_machine.cpu_family().contains('x86')
  20. ###############################################################################
  21. # set paths
  22. lv2dir = prefix / libdir / 'lv2'
  23. vst2dir = prefix / libdir / 'vst'
  24. vst3dir = prefix / libdir / 'vst3'
  25. ###############################################################################
  26. # set target OS
  27. os_darwin = false
  28. os_linux = false
  29. os_windows = false
  30. if host_machine.system() == 'darwin'
  31. os_darwin = true
  32. elif host_machine.system() == 'windows'
  33. os_windows = true
  34. elif host_machine.system() == 'linux'
  35. os_linux = true
  36. else
  37. error('unsupported system')
  38. endif
  39. ###############################################################################
  40. # set OS-specific details
  41. if os_darwin
  42. bin_suffix = ''
  43. lib_suffix = '.dylib'
  44. bintype_prefix = 'Mac-'
  45. elif os_windows
  46. bin_suffix = '.exe'
  47. lib_suffix = '.dll'
  48. bintype_prefix = 'Windows-'
  49. else
  50. bin_suffix = ''
  51. lib_suffix = '.so'
  52. bintype_prefix = 'Linux-'
  53. endif
  54. ###############################################################################
  55. # base compiler details
  56. cc = meson.get_compiler('c')
  57. cpp = meson.get_compiler('cpp')
  58. ###############################################################################
  59. # dependencies
  60. dependencies = [
  61. ]
  62. if os_linux
  63. dependencies += [
  64. cc.find_library('dl'),
  65. cc.find_library('rt'),
  66. ]
  67. endif
  68. if os_linux and not linux_embed
  69. dependencies += [
  70. dependency('alsa'),
  71. dependency('freetype2'),
  72. dependency('x11'),
  73. dependency('xext'),
  74. ]
  75. endif
  76. ###############################################################################
  77. # build flags
  78. build_flags = [
  79. '-DJUCE_APP_CONFIG_HEADER="AppConfig.h"',
  80. '-pthread',
  81. '-Wall',
  82. '-Wno-multichar',
  83. '-Wno-strict-overflow',
  84. '-Wno-unused-but-set-variable',
  85. '-Wno-unused-function',
  86. ]
  87. build_flags_cpp = [
  88. '-Wno-class-memaccess',
  89. ]
  90. build_flags_debug = [
  91. '-O0', '-ggdb',
  92. '-DDEBUG=1', '-D_DEBUG=1',
  93. ]
  94. build_flags_debug_cpp = [
  95. ]
  96. build_flags_release = [
  97. '-O3', '-fvisibility=hidden',
  98. '-DNDEBUG=1',
  99. ]
  100. build_flags_release_cpp = [
  101. '-fvisibility-inlines-hidden',
  102. ]
  103. if optimizations and not linux_embed
  104. build_flags_release += [
  105. '-mtune=generic', '-msse', '-msse2',
  106. ]
  107. endif
  108. if not os_darwin
  109. build_flags_cpp += [
  110. '-std=gnu++11',
  111. ]
  112. build_flags_release += [
  113. '-fdata-sections', '-ffunction-sections',
  114. ]
  115. endif
  116. if os_darwin
  117. build_flags += [
  118. '-DMAC=1',
  119. ]
  120. build_flags_cpp += [
  121. '-ObjC++',
  122. ]
  123. elif os_windows
  124. build_flags += [
  125. '-DWINDOWS=1',
  126. '-mstackrealign',
  127. ]
  128. build_flags_cpp += [
  129. '-fpermissive',
  130. ]
  131. elif linux_embed
  132. build_flags += [
  133. '-DLINUX=1',
  134. ]
  135. build_flags_cpp += [
  136. '-DJUCE_AUDIOPROCESSOR_NO_GUI=1',
  137. ]
  138. else
  139. build_flags += [
  140. '-DLINUX=1',
  141. ]
  142. endif
  143. ###############################################################################
  144. # link flags
  145. link_flags = [
  146. '-pthread',
  147. ]
  148. link_flags_debug = [
  149. ]
  150. link_flags_release = [
  151. ]
  152. if os_windows
  153. link_flags += [
  154. '-static',
  155. ]
  156. endif
  157. if not os_darwin
  158. link_flags += [
  159. '-Wl,--no-undefined',
  160. ]
  161. link_flags_release += [
  162. '-fdata-sections', '-ffunction-sections', '-Wl,--gc-sections',
  163. '-Wl,--as-needed',
  164. '-Wl,--strip-all',
  165. ]
  166. endif
  167. ###############################################################################
  168. # combine flags depending on build type
  169. if buildtype == 'debug'
  170. build_flags += build_flags_debug
  171. build_flags_cpp += build_flags_debug_cpp + build_flags
  172. link_flags += link_flags_debug
  173. else
  174. build_flags += build_flags_release
  175. build_flags_cpp += build_flags_release_cpp + build_flags
  176. link_flags += link_flags_release
  177. endif
  178. ###############################################################################
  179. # go into subdir to build libraries and plugins
  180. subdir('libs')
  181. subdir('ports')
  182. subdir('ports-legacy')
  183. ###############################################################################
  184. # extra files to install
  185. extra_lv2_preset_bundles = [
  186. 'TAL-NoiseMaker-Noise4U.lv2',
  187. ]
  188. foreach bundle : extra_lv2_preset_bundles
  189. install_data([
  190. 'static-lv2-ttl/@0@/manifest.ttl'.format(bundle),
  191. 'static-lv2-ttl/@0@/presets.ttl'.format(bundle),
  192. ],
  193. install_dir: lv2dir / bundle,
  194. )
  195. endforeach
  196. ###############################################################################