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.

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