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.

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