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.

meson.build 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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. 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-function',
  86. ]
  87. build_flags_cpp = [
  88. '-std=gnu++11',
  89. ]
  90. if not os_darwin
  91. build_flags += [
  92. '-Wno-unused-but-set-variable',
  93. ]
  94. build_flags_cpp += [
  95. '-Wno-class-memaccess',
  96. ]
  97. endif
  98. build_flags_debug = [
  99. '-O0',
  100. '-ggdb',
  101. '-DDEBUG=1',
  102. '-D_DEBUG=1',
  103. ]
  104. build_flags_debug_cpp = [
  105. ]
  106. build_flags_release = [
  107. '-O3',
  108. '-fvisibility=hidden',
  109. '-DNDEBUG=1',
  110. '-fdata-sections',
  111. '-ffunction-sections',
  112. ]
  113. build_flags_release_cpp = [
  114. '-fvisibility-inlines-hidden',
  115. ]
  116. if optimizations and not linux_embed
  117. build_flags_release += [
  118. '-mtune=generic', '-msse', '-msse2',
  119. ]
  120. endif
  121. if os_darwin
  122. build_flags += [
  123. '-DMAC=1',
  124. '-DGL_SILENCE_DEPRECATION=1',
  125. ]
  126. build_flags_cpp += [
  127. '-ObjC++',
  128. ]
  129. elif os_windows
  130. build_flags += [
  131. '-DWINDOWS=1',
  132. '-mstackrealign',
  133. ]
  134. build_flags_cpp += [
  135. '-fpermissive',
  136. ]
  137. elif linux_embed
  138. build_flags += [
  139. '-DLINUX=1',
  140. ]
  141. build_flags_cpp += [
  142. '-DJUCE_AUDIOPROCESSOR_NO_GUI=1',
  143. ]
  144. else
  145. build_flags += [
  146. '-DLINUX=1',
  147. ]
  148. endif
  149. ###############################################################################
  150. # link flags
  151. link_flags = [
  152. '-pthread',
  153. ]
  154. link_flags_debug = [
  155. ]
  156. link_flags_release = [
  157. '-fdata-sections',
  158. '-ffunction-sections',
  159. ]
  160. if os_windows
  161. link_flags += [
  162. '-static',
  163. ]
  164. endif
  165. if os_darwin
  166. link_flags_release += [
  167. '-Wl,-dead_strip',
  168. '-Wl,-dead_strip_dylibs',
  169. ]
  170. else
  171. link_flags += [
  172. '-Wl,--no-undefined',
  173. ]
  174. link_flags_release += [
  175. '-Wl,-O1',
  176. '-Wl,--as-needed',
  177. '-Wl,--gc-sections',
  178. '-Wl,--strip-all',
  179. ]
  180. endif
  181. ###############################################################################
  182. # combine flags depending on build type
  183. if buildtype == 'debug'
  184. build_flags += build_flags_debug
  185. build_flags_cpp += build_flags_debug_cpp + build_flags
  186. link_flags += link_flags_debug
  187. else
  188. build_flags += build_flags_release
  189. build_flags_cpp += build_flags_release_cpp + build_flags
  190. link_flags += link_flags_release
  191. endif
  192. ###############################################################################
  193. # go into subdir to build libraries and plugins
  194. subdir('libs')
  195. subdir('ports')
  196. subdir('ports-legacy')
  197. ###############################################################################
  198. # extra files to install
  199. extra_lv2_preset_bundles = [
  200. 'TAL-NoiseMaker-Noise4U.lv2',
  201. ]
  202. foreach bundle : extra_lv2_preset_bundles
  203. install_data([
  204. 'static-lv2-ttl/@0@/manifest.ttl'.format(bundle),
  205. 'static-lv2-ttl/@0@/presets.ttl'.format(bundle),
  206. ],
  207. install_dir: lv2dir / bundle,
  208. )
  209. endforeach
  210. ###############################################################################