mirror of https://github.com/libsdl-org/SDL
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
|
@ -250,7 +250,6 @@ macro(CheckLibSampleRate)
|
|||
find_package(SampleRate QUIET)
|
||||
if(SampleRate_FOUND AND TARGET SampleRate::samplerate)
|
||||
set(HAVE_LIBSAMPLERATE TRUE)
|
||||
set(HAVE_LIBSAMPLERATE_H TRUE)
|
||||
if(SDL_LIBSAMPLERATE_SHARED)
|
||||
target_include_directories(sdl-build-options INTERFACE $<TARGET_PROPERTY:SampleRate::samplerate,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
if(NOT HAVE_SDL_LOADSO)
|
||||
|
|
|
@ -226,7 +226,7 @@
|
|||
#cmakedefine HAVE_O_CLOEXEC 1
|
||||
|
||||
#cmakedefine HAVE_LIBUDEV_H 1
|
||||
#cmakedefine HAVE_LIBSAMPLERATE_H 1
|
||||
#cmakedefine HAVE_LIBSAMPLERATE 1
|
||||
#cmakedefine HAVE_LIBDECOR_H 1
|
||||
|
||||
#cmakedefine HAVE_D3D_H @HAVE_D3D_H@
|
||||
|
|
|
@ -100,7 +100,7 @@ static const AudioBootStrap *const bootstrap[] = {
|
|||
NULL
|
||||
};
|
||||
|
||||
#ifdef HAVE_LIBSAMPLERATE_H
|
||||
#ifdef HAVE_LIBSAMPLERATE
|
||||
#ifdef SDL_LIBSAMPLERATE_DYNAMIC
|
||||
static void *SRC_lib = NULL;
|
||||
#endif
|
||||
|
@ -965,7 +965,7 @@ int SDL_InitAudio(const char *driver_name)
|
|||
/* Make sure we have a list of devices available at startup. */
|
||||
current_audio.impl.DetectDevices();
|
||||
|
||||
#ifdef HAVE_LIBSAMPLERATE_H
|
||||
#ifdef HAVE_LIBSAMPLERATE
|
||||
LoadLibSampleRate();
|
||||
#endif
|
||||
|
||||
|
@ -1590,7 +1590,7 @@ void SDL_QuitAudio(void)
|
|||
SDL_zero(current_audio);
|
||||
SDL_zeroa(open_devices);
|
||||
|
||||
#ifdef HAVE_LIBSAMPLERATE_H
|
||||
#ifdef HAVE_LIBSAMPLERATE
|
||||
UnloadLibSampleRate();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
/* Functions and variables exported from SDL_audio.c for SDL_sysaudio.c */
|
||||
|
||||
#ifdef HAVE_LIBSAMPLERATE_H
|
||||
#ifdef HAVE_LIBSAMPLERATE
|
||||
#include "samplerate.h"
|
||||
extern SDL_bool SRC_available;
|
||||
extern int SRC_converter;
|
||||
|
|
|
@ -494,7 +494,7 @@ static int SDL_BuildAudioTypeCVTFromFloat(SDL_AudioCVT *cvt, const SDL_AudioForm
|
|||
return retval;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBSAMPLERATE_H
|
||||
#ifdef HAVE_LIBSAMPLERATE
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -595,7 +595,7 @@ RESAMPLER_FUNCS(6)
|
|||
RESAMPLER_FUNCS(8)
|
||||
#undef RESAMPLER_FUNCS
|
||||
|
||||
#ifdef HAVE_LIBSAMPLERATE_H
|
||||
#ifdef HAVE_LIBSAMPLERATE
|
||||
#define RESAMPLER_FUNCS(chans) \
|
||||
static void SDLCALL \
|
||||
SDL_ResampleCVT_SRC_c##chans(SDL_AudioCVT *cvt, SDL_AudioFormat format) \
|
||||
|
@ -608,11 +608,11 @@ RESAMPLER_FUNCS(4)
|
|||
RESAMPLER_FUNCS(6)
|
||||
RESAMPLER_FUNCS(8)
|
||||
#undef RESAMPLER_FUNCS
|
||||
#endif /* HAVE_LIBSAMPLERATE_H */
|
||||
#endif /* HAVE_LIBSAMPLERATE */
|
||||
|
||||
static SDL_AudioFilter ChooseCVTResampler(const int dst_channels)
|
||||
{
|
||||
#ifdef HAVE_LIBSAMPLERATE_H
|
||||
#ifdef HAVE_LIBSAMPLERATE
|
||||
if (SRC_available) {
|
||||
switch (dst_channels) {
|
||||
case 1:
|
||||
|
@ -629,7 +629,7 @@ static SDL_AudioFilter ChooseCVTResampler(const int dst_channels)
|
|||
break;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_LIBSAMPLERATE_H */
|
||||
#endif /* HAVE_LIBSAMPLERATE */
|
||||
|
||||
switch (dst_channels) {
|
||||
case 1:
|
||||
|
@ -934,7 +934,7 @@ static Uint8 *EnsureStreamBufferSize(SDL_AudioStream *stream, int newlen)
|
|||
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)
|
||||
{
|
||||
const float *inbuf = (const float *)_inbuf;
|
||||
|
@ -1010,7 +1010,7 @@ static SDL_bool SetupLibSampleRateResampling(SDL_AudioStream *stream)
|
|||
|
||||
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)
|
||||
{
|
||||
|
@ -1141,7 +1141,7 @@ SDL_CreateAudioStream(SDL_AudioFormat src_format,
|
|||
return NULL; /* SDL_BuildAudioCVT should have called SDL_SetError. */
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBSAMPLERATE_H
|
||||
#ifdef HAVE_LIBSAMPLERATE
|
||||
SetupLibSampleRateResampling(retval);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue