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.

219 lines
4.5KB

  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')
  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. ]
  125. build_flags_cpp += [
  126. '-fpermissive',
  127. ]
  128. elif linux_embed
  129. build_flags += [
  130. '-DLINUX=1',
  131. ]
  132. build_flags_cpp += [
  133. '-DJUCE_AUDIOPROCESSOR_NO_GUI=1',
  134. ]
  135. else
  136. build_flags += [
  137. '-DLINUX=1',
  138. ]
  139. endif
  140. ###############################################################################
  141. # link flags
  142. link_flags = [
  143. '-pthread',
  144. ]
  145. link_flags_debug = [
  146. ]
  147. link_flags_release = [
  148. ]
  149. if os_windows
  150. link_flags += [
  151. '-static',
  152. ]
  153. endif
  154. if not os_darwin
  155. link_flags += [
  156. '-Wl,--no-undefined',
  157. ]
  158. link_flags_release += [
  159. '-fdata-sections', '-ffunction-sections', '-Wl,--gc-sections',
  160. '-Wl,--as-needed',
  161. '-Wl,--strip-all',
  162. ]
  163. endif
  164. ###############################################################################
  165. # combine flags depending on build type
  166. if buildtype == 'debug'
  167. build_flags += build_flags_debug
  168. build_flags_cpp += build_flags_debug_cpp + build_flags
  169. link_flags += link_flags_debug
  170. else
  171. build_flags += build_flags_release
  172. build_flags_cpp += build_flags_release_cpp + build_flags
  173. link_flags += link_flags_release
  174. endif
  175. ###############################################################################
  176. # go into subdir to build libraries and plugins
  177. subdir('libs')
  178. subdir('ports-legacy')
  179. ###############################################################################