cmake: Fix building without libsamplerate library
On Fedora, the headers for 32-bit and 64-bit are shared. When building a 32-bit library, CMake found the header (that was installed for the 64-bit libsamplerate development package). Because no 32-bit libsamplerate library was installed, linking failed. (SDL_LIBSAMPLERATE_DYNAMIC was set to FALSE because CMake could not find a library)
This commit is contained in:
parent
f360965db6
commit
773aad14f8
5 changed files with 14 additions and 15 deletions
|
@ -250,7 +250,6 @@ macro(CheckLibSampleRate)
|
||||||
find_package(SampleRate QUIET)
|
find_package(SampleRate QUIET)
|
||||||
if(SampleRate_FOUND AND TARGET SampleRate::samplerate)
|
if(SampleRate_FOUND AND TARGET SampleRate::samplerate)
|
||||||
set(HAVE_LIBSAMPLERATE TRUE)
|
set(HAVE_LIBSAMPLERATE TRUE)
|
||||||
set(HAVE_LIBSAMPLERATE_H TRUE)
|
|
||||||
if(SDL_LIBSAMPLERATE_SHARED)
|
if(SDL_LIBSAMPLERATE_SHARED)
|
||||||
target_include_directories(sdl-build-options INTERFACE $<TARGET_PROPERTY:SampleRate::samplerate,INTERFACE_INCLUDE_DIRECTORIES>)
|
target_include_directories(sdl-build-options INTERFACE $<TARGET_PROPERTY:SampleRate::samplerate,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||||
if(NOT HAVE_SDL_LOADSO)
|
if(NOT HAVE_SDL_LOADSO)
|
||||||
|
|
|
@ -226,7 +226,7 @@
|
||||||
#cmakedefine HAVE_O_CLOEXEC 1
|
#cmakedefine HAVE_O_CLOEXEC 1
|
||||||
|
|
||||||
#cmakedefine HAVE_LIBUDEV_H 1
|
#cmakedefine HAVE_LIBUDEV_H 1
|
||||||
#cmakedefine HAVE_LIBSAMPLERATE_H 1
|
#cmakedefine HAVE_LIBSAMPLERATE 1
|
||||||
#cmakedefine HAVE_LIBDECOR_H 1
|
#cmakedefine HAVE_LIBDECOR_H 1
|
||||||
|
|
||||||
#cmakedefine HAVE_D3D_H @HAVE_D3D_H@
|
#cmakedefine HAVE_D3D_H @HAVE_D3D_H@
|
||||||
|
|
|
@ -100,7 +100,7 @@ static const AudioBootStrap *const bootstrap[] = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HAVE_LIBSAMPLERATE_H
|
#ifdef HAVE_LIBSAMPLERATE
|
||||||
#ifdef SDL_LIBSAMPLERATE_DYNAMIC
|
#ifdef SDL_LIBSAMPLERATE_DYNAMIC
|
||||||
static void *SRC_lib = NULL;
|
static void *SRC_lib = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
@ -965,7 +965,7 @@ int SDL_InitAudio(const char *driver_name)
|
||||||
/* Make sure we have a list of devices available at startup. */
|
/* Make sure we have a list of devices available at startup. */
|
||||||
current_audio.impl.DetectDevices();
|
current_audio.impl.DetectDevices();
|
||||||
|
|
||||||
#ifdef HAVE_LIBSAMPLERATE_H
|
#ifdef HAVE_LIBSAMPLERATE
|
||||||
LoadLibSampleRate();
|
LoadLibSampleRate();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1590,7 +1590,7 @@ void SDL_QuitAudio(void)
|
||||||
SDL_zero(current_audio);
|
SDL_zero(current_audio);
|
||||||
SDL_zeroa(open_devices);
|
SDL_zeroa(open_devices);
|
||||||
|
|
||||||
#ifdef HAVE_LIBSAMPLERATE_H
|
#ifdef HAVE_LIBSAMPLERATE
|
||||||
UnloadLibSampleRate();
|
UnloadLibSampleRate();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
/* Functions and variables exported from SDL_audio.c for SDL_sysaudio.c */
|
/* Functions and variables exported from SDL_audio.c for SDL_sysaudio.c */
|
||||||
|
|
||||||
#ifdef HAVE_LIBSAMPLERATE_H
|
#ifdef HAVE_LIBSAMPLERATE
|
||||||
#include "samplerate.h"
|
#include "samplerate.h"
|
||||||
extern SDL_bool SRC_available;
|
extern SDL_bool SRC_available;
|
||||||
extern int SRC_converter;
|
extern int SRC_converter;
|
||||||
|
|
|
@ -494,7 +494,7 @@ static int SDL_BuildAudioTypeCVTFromFloat(SDL_AudioCVT *cvt, const SDL_AudioForm
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LIBSAMPLERATE_H
|
#ifdef HAVE_LIBSAMPLERATE
|
||||||
|
|
||||||
static void SDL_ResampleCVT_SRC(SDL_AudioCVT *cvt, const int chans, const SDL_AudioFormat format)
|
static void SDL_ResampleCVT_SRC(SDL_AudioCVT *cvt, const int chans, const SDL_AudioFormat format)
|
||||||
{
|
{
|
||||||
|
@ -533,7 +533,7 @@ static void SDL_ResampleCVT_SRC(SDL_AudioCVT *cvt, const int chans, const SDL_Au
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_LIBSAMPLERATE_H */
|
#endif /* HAVE_LIBSAMPLERATE */
|
||||||
|
|
||||||
static int SDL_ResampleCVT(SDL_AudioCVT *cvt, const int chans, const SDL_AudioFormat format)
|
static int SDL_ResampleCVT(SDL_AudioCVT *cvt, const int chans, const SDL_AudioFormat format)
|
||||||
{
|
{
|
||||||
|
@ -595,7 +595,7 @@ RESAMPLER_FUNCS(6)
|
||||||
RESAMPLER_FUNCS(8)
|
RESAMPLER_FUNCS(8)
|
||||||
#undef RESAMPLER_FUNCS
|
#undef RESAMPLER_FUNCS
|
||||||
|
|
||||||
#ifdef HAVE_LIBSAMPLERATE_H
|
#ifdef HAVE_LIBSAMPLERATE
|
||||||
#define RESAMPLER_FUNCS(chans) \
|
#define RESAMPLER_FUNCS(chans) \
|
||||||
static void SDLCALL \
|
static void SDLCALL \
|
||||||
SDL_ResampleCVT_SRC_c##chans(SDL_AudioCVT *cvt, SDL_AudioFormat format) \
|
SDL_ResampleCVT_SRC_c##chans(SDL_AudioCVT *cvt, SDL_AudioFormat format) \
|
||||||
|
@ -608,11 +608,11 @@ RESAMPLER_FUNCS(4)
|
||||||
RESAMPLER_FUNCS(6)
|
RESAMPLER_FUNCS(6)
|
||||||
RESAMPLER_FUNCS(8)
|
RESAMPLER_FUNCS(8)
|
||||||
#undef RESAMPLER_FUNCS
|
#undef RESAMPLER_FUNCS
|
||||||
#endif /* HAVE_LIBSAMPLERATE_H */
|
#endif /* HAVE_LIBSAMPLERATE */
|
||||||
|
|
||||||
static SDL_AudioFilter ChooseCVTResampler(const int dst_channels)
|
static SDL_AudioFilter ChooseCVTResampler(const int dst_channels)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LIBSAMPLERATE_H
|
#ifdef HAVE_LIBSAMPLERATE
|
||||||
if (SRC_available) {
|
if (SRC_available) {
|
||||||
switch (dst_channels) {
|
switch (dst_channels) {
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -629,7 +629,7 @@ static SDL_AudioFilter ChooseCVTResampler(const int dst_channels)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* HAVE_LIBSAMPLERATE_H */
|
#endif /* HAVE_LIBSAMPLERATE */
|
||||||
|
|
||||||
switch (dst_channels) {
|
switch (dst_channels) {
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -934,7 +934,7 @@ static Uint8 *EnsureStreamBufferSize(SDL_AudioStream *stream, int newlen)
|
||||||
return offset ? ptr + (16 - offset) : ptr;
|
return offset ? ptr + (16 - offset) : ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LIBSAMPLERATE_H
|
#ifdef HAVE_LIBSAMPLERATE
|
||||||
static int SDL_ResampleAudioStream_SRC(SDL_AudioStream *stream, const void *_inbuf, const int inbuflen, void *_outbuf, const int outbuflen)
|
static int SDL_ResampleAudioStream_SRC(SDL_AudioStream *stream, const void *_inbuf, const int inbuflen, void *_outbuf, const int outbuflen)
|
||||||
{
|
{
|
||||||
const float *inbuf = (const float *)_inbuf;
|
const float *inbuf = (const float *)_inbuf;
|
||||||
|
@ -1010,7 +1010,7 @@ static SDL_bool SetupLibSampleRateResampling(SDL_AudioStream *stream)
|
||||||
|
|
||||||
return SDL_TRUE;
|
return SDL_TRUE;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_LIBSAMPLERATE_H */
|
#endif /* HAVE_LIBSAMPLERATE */
|
||||||
|
|
||||||
static int SDL_ResampleAudioStream(SDL_AudioStream *stream, const void *_inbuf, const int inbuflen, void *_outbuf, const int outbuflen)
|
static int SDL_ResampleAudioStream(SDL_AudioStream *stream, const void *_inbuf, const int inbuflen, void *_outbuf, const int outbuflen)
|
||||||
{
|
{
|
||||||
|
@ -1141,7 +1141,7 @@ SDL_CreateAudioStream(SDL_AudioFormat src_format,
|
||||||
return NULL; /* SDL_BuildAudioCVT should have called SDL_SetError. */
|
return NULL; /* SDL_BuildAudioCVT should have called SDL_SetError. */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LIBSAMPLERATE_H
|
#ifdef HAVE_LIBSAMPLERATE
|
||||||
SetupLibSampleRateResampling(retval);
|
SetupLibSampleRateResampling(retval);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue