meson.build 6.37 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
decoder_plugins_sources = [
  'PcmDecoderPlugin.cxx',
]

if get_option('dsd')
  decoder_plugins_sources += [
    'HybridDsdDecoderPlugin.cxx',
    'DsdiffDecoderPlugin.cxx',
    'DsfDecoderPlugin.cxx',
    'DsdLib.cxx',
  ]
endif

if ffmpeg_dep.found()
  decoder_plugins_sources += [
    'FfmpegIo.cxx',
    'FfmpegMetaData.cxx',
    'FfmpegDecoderPlugin.cxx',
  ]
endif

adplug_dep = dependency('adplug', required: get_option('adplug'))
23
decoder_features.set('ENABLE_ADPLUG', adplug_dep.found())
24 25 26 27
if adplug_dep.found()
  decoder_plugins_sources += 'AdPlugDecoderPlugin.cxx'
endif

28
decoder_features.set('ENABLE_FLAC', flac_dep.found())
29 30 31 32 33 34 35 36 37 38
if flac_dep.found()
  decoder_plugins_sources += [
    'FlacDecoderPlugin.cxx',
    'FlacInput.cxx',
    'FlacPcm.cxx',
    'FlacDomain.cxx',
    'FlacCommon.cxx',
  ]
endif

39 40
decoder_features.set('ENABLE_VORBIS_DECODER', vorbis_dep.found())
decoder_features.set('HAVE_TREMOR', libvorbisidec_dep.found())
41
if vorbis_dep.found()
42 43 44 45 46 47
  decoder_plugins_sources += [
    'VorbisDecoderPlugin.cxx',
    'VorbisDomain.cxx',
  ]
endif

48
decoder_features.set('ENABLE_OPUS', libopus_dep.found())
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
if libopus_dep.found()
  decoder_plugins_sources += [
    'OpusDecoderPlugin.cxx',
    'OpusDomain.cxx',
    'OpusHead.cxx',
    'OpusTags.cxx',
  ]
endif

if ogg_dep.found()
  decoder_plugins_sources += 'OggDecoder.cxx'
endif

if xiph_dep.found()
  decoder_plugins_sources += 'OggCodec.cxx'
endif

fluidsynth_dep = dependency('fluidsynth', version: '>= 1.1', required: get_option('fluidsynth'))
67
decoder_features.set('ENABLE_FLUIDSYNTH', fluidsynth_dep.found())
68 69 70 71 72
if fluidsynth_dep.found()
  decoder_plugins_sources += 'FluidsynthDecoderPlugin.cxx'
endif

libaudiofile_dep = dependency('audiofile', version: '>= 0.3', required: get_option('audiofile'))
73
decoder_features.set('ENABLE_AUDIOFILE', libaudiofile_dep.found())
74 75 76 77 78
if libaudiofile_dep.found()
  decoder_plugins_sources += 'AudiofileDecoderPlugin.cxx'
endif

libfaad_dep = c_compiler.find_library('faad', required: get_option('faad'))
79
decoder_features.set('ENABLE_FAAD', libfaad_dep.found())
80 81 82 83 84
if libfaad_dep.found()
  decoder_plugins_sources += 'FaadDecoderPlugin.cxx'
endif

libgme_dep = c_compiler.find_library('gme', required: get_option('gme'))
85
decoder_features.set('ENABLE_GME', libgme_dep.found())
86 87 88 89 90
if libgme_dep.found()
  decoder_plugins_sources += 'GmeDecoderPlugin.cxx'
endif

libmad_dep = c_compiler.find_library('mad', required: get_option('mad'))
91
decoder_features.set('ENABLE_MAD', libmad_dep.found())
92 93 94 95 96
if libmad_dep.found()
  decoder_plugins_sources += 'MadDecoderPlugin.cxx'
endif

libmikmod_dep = dependency('libmikmod', version: '>= 3.2', required: get_option('mikmod'))
97
decoder_features.set('ENABLE_LIBMIKMOD', libmikmod_dep.found())
98 99 100 101 102
if libmikmod_dep.found()
  decoder_plugins_sources += 'MikmodDecoderPlugin.cxx'
endif

libmodplug_dep = dependency('libmodplug', required: get_option('modplug'))
103
decoder_features.set('ENABLE_MODPLUG', libmodplug_dep.found())
104
if libmodplug_dep.found()
105 106 107 108
  decoder_plugins_sources += [
    'ModplugDecoderPlugin.cxx',
    'ModCommon.cxx'
  ]
109 110
endif

111 112
libopenmpt_dep = dependency('libopenmpt', required: get_option('openmpt'))
decoder_features.set('ENABLE_OPENMPT', libopenmpt_dep.found())
113
decoder_features.set('HAVE_LIBOPENMPT_VERSION_0_5', libopenmpt_dep.version().version_compare('>= 0.5'))
114
if libopenmpt_dep.found()
115 116 117 118
  decoder_plugins_sources += [
    'OpenmptDecoderPlugin.cxx',
    'ModCommon.cxx'
  ]
119 120
endif

121
libmpcdec_dep = c_compiler.find_library('mpcdec', required: get_option('mpcdec'))
122
decoder_features.set('ENABLE_MPCDEC', libmpcdec_dep.found())
123 124 125 126 127
if libmpcdec_dep.found()
  decoder_plugins_sources += 'MpcdecDecoderPlugin.cxx'
endif

libmpg123_dep = dependency('libmpg123', required: get_option('mpg123'))
128
decoder_features.set('ENABLE_MPG123', libmpg123_dep.found())
129 130 131 132 133
if libmpg123_dep.found()
  decoder_plugins_sources += 'Mpg123DecoderPlugin.cxx'
endif

libsndfile_dep = dependency('sndfile', required: get_option('sndfile'))
134
decoder_features.set('ENABLE_SNDFILE', libsndfile_dep.found())
135 136 137 138 139
if libsndfile_dep.found()
  decoder_plugins_sources += 'SndfileDecoderPlugin.cxx'
endif

wavpack_dep = dependency('wavpack', required: get_option('wavpack'))
140
decoder_features.set('ENABLE_WAVPACK', wavpack_dep.found())
141 142 143 144
if wavpack_dep.found()
  decoder_plugins_sources += 'WavpackDecoderPlugin.cxx'
endif

145 146 147 148 149
wildmidi_required = get_option('wildmidi')
if wildmidi_required.enabled()
  # if the user has force-enabled WildMidi, allow the pkg-config test
  # to fail; after that, the find_library() check must succeed
  wildmidi_required = false
150
endif
151
wildmidi_dep = dependency('wildmidi', required: wildmidi_required)
152 153 154
if not wildmidi_dep.found()
  wildmidi_dep = c_compiler.find_library('WildMidi', required: get_option('wildmidi'))
endif
155
decoder_features.set('ENABLE_WILDMIDI', wildmidi_dep.found())
156 157 158 159 160
if wildmidi_dep.found()
  decoder_plugins_sources += 'WildmidiDecoderPlugin.cxx'
endif

if not get_option('sidplay').disabled()
161
  libsidplayfp_dep = dependency('libsidplayfp', version: '>= 1.8', required: false)
162
  decoder_features.set('HAVE_SIDPLAYFP', libsidplayfp_dep.found())
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180

  if libsidplayfp_dep.found()
    libsidplay_dep = libsidplayfp_dep
  else
    libsidplay2_dep = dependency('libsidplay2', required: false)
    if libsidplay2_dep.found()
      libsidutils_dep = dependency('libsidutils')
      libresid_builder_dep = compiler.find_library('resid-builder')
      libsidplay_dep = declare_dependency(dependencies: [libsidplay2_dep, libsidutils_dep, libresid_builder_dep])
    elif get_option('sidplay').enabled()
      error('Neither libsidplayfp nor libsidplay2 found')
    else
      libsidplay_dep = libsidplay2_dep
    endif
  endif
else
  libsidplay_dep = dependency('', required: false)
endif
181
decoder_features.set('ENABLE_SIDPLAY', libsidplay_dep.found())
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
if libsidplay_dep.found()
  decoder_plugins_sources += 'SidplayDecoderPlugin.cxx'
endif

decoder_plugins = static_library(
  'decoder_plugins',
  decoder_plugins_sources,
  include_directories: inc,
  dependencies: [
    adplug_dep,
    ffmpeg_dep,
    flac_dep,
    fluidsynth_dep,
    libaudiofile_dep,
    libfaad_dep,
    libgme_dep,
    libmad_dep,
    libmikmod_dep,
    libmodplug_dep,
201
    libopenmpt_dep,
202 203 204 205 206
    libmpcdec_dep,
    libmpg123_dep,
    libopus_dep,
    libsidplay_dep,
    libsndfile_dep,
207
    vorbis_dep,
208 209 210
    ogg_dep,
    wavpack_dep,
    wildmidi_dep,
211
    log_dep,
212 213 214 215 216 217
  ],
)

decoder_plugins_dep = declare_dependency(
  link_with: decoder_plugins,
  dependencies: [
218
    crypto_base64_dep,
219 220 221 222
    decoder_api_dep,
    pcm_dep,
  ],
)