lib/xiph/VorbisComments: move to separate static library

This also reverts the previous commit which was wrong.  When the
Vorbis decoder is disabled, we can't compile VorbisComments.cxx at
all.

Instead of expanding the #ifdef, this commit moves VorbisComments.cxx
to a separate library with dependencies on libvorbis (which was
missing previously, which could also lead to build failures if the
libvorbis headers were in a non-standard directory).
This commit is contained in:
Max Kellermann 2019-11-20 16:12:35 +01:00
parent 1e03457746
commit c129ca9f63
3 changed files with 27 additions and 8 deletions

View File

@ -36,9 +36,9 @@ if flac_dep.found()
]
endif
conf.set('ENABLE_VORBIS_DECODER', libvorbis_dep.found() or libvorbisidec_dep.found())
conf.set('ENABLE_VORBIS_DECODER', vorbis_dep.found())
conf.set('HAVE_TREMOR', libvorbisidec_dep.found())
if libvorbis_dep.found() or libvorbisidec_dep.found()
if vorbis_dep.found()
decoder_plugins_sources += [
'VorbisDecoderPlugin.cxx',
'VorbisDomain.cxx',
@ -181,8 +181,7 @@ decoder_plugins = static_library(
libopus_dep,
libsidplay_dep,
libsndfile_dep,
libvorbis_dep,
libvorbisidec_dep,
vorbis_dep,
ogg_dep,
wavpack_dep,
wildmidi_dep,

View File

@ -29,8 +29,6 @@
#include "util/StringView.hxx"
#include "config.h"
#ifdef ENABLE_VORBIS_DECODER
#ifndef HAVE_TREMOR
#include <vorbis/codec.h>
#else
@ -65,8 +63,6 @@ VorbisCommentToReplayGain(ReplayGainInfo &rgi,
return found;
}
#endif /* ENABLE_VORBIS_DECODER */
static void
vorbis_scan_comment(StringView comment, TagHandler &handler) noexcept
{

View File

@ -40,6 +40,7 @@ endif
if not libogg_dep.found() and not libflac_dep.found()
xiph_dep = dependency('', required: false)
ogg_dep = dependency('', required: false)
vorbis_dep = dependency('', required: false)
flac_dep = dependency('', required: false)
subdir_done()
endif
@ -82,6 +83,29 @@ else
ogg_dep = dependency('', required: false)
endif
if libvorbis_dep.found() or libvorbisidec_dep.found()
vorbis = static_library(
'vorbis',
'VorbisComments.cxx',
include_directories: inc,
dependencies: [
libvorbis_dep,
libvorbisidec_dep,
],
)
vorbis_dep = declare_dependency(
link_with: vorbis,
dependencies: [
ogg_dep,
libvorbis_dep,
libvorbisidec_dep,
],
)
else
vorbis_dep = dependency('', required: false)
endif
if libflac_dep.found()
flac = static_library(
'flac',