Changed: #1251 NeL can't find selected drivers in CMake

hg/feature/sound
kervala 14 years ago
parent b22fc1392a
commit 535b75abd6

@ -86,9 +86,7 @@ NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS()
NL_SETUP_PREFIX_PATHS()
RYZOM_SETUP_PREFIX_PATHS()
IF(NOT WIN32)
NL_CONFIGURE_CHECKS()
ENDIF(NOT WIN32)
#-----------------------------------------------------------------------------
#Platform specifics

@ -43,6 +43,32 @@ MACRO(NL_CONFIGURE_CHECKS)
CHECK_FUNCTION_EXISTS("statvfs" HAVE_STATVFS)
CHECK_FUNCTION_EXISTS("stat64" HAVE_STAT64)
# 3D drivers
IF(WITH_DRIVER_OPENGL)
SET(NL_OPENGL_AVAILABLE 1)
ENDIF(WITH_DRIVER_OPENGL)
IF(WITH_DRIVER_DIRECT3D)
SET(NL_DIRECT3D_AVAILABLE 1)
ENDIF(WITH_DRIVER_DIRECT3D)
# sound drivers
IF(WITH_DRIVER_FMOD)
SET(NL_FMOD_AVAILABLE 1)
ENDIF(WITH_DRIVER_FMOD)
IF(WITH_DRIVER_OPENAL)
SET(NL_OPENAL_AVAILABLE 1)
ENDIF(WITH_DRIVER_OPENAL)
IF(WITH_DRIVER_DSOUND)
SET(NL_DSOUND_AVAILABLE 1)
ENDIF(WITH_DRIVER_DSOUND)
IF(WITH_DRIVER_XAUDIO2)
SET(NL_XAUDIO2_AVAILABLE 1)
ENDIF(WITH_DRIVER_XAUDIO2)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
ADD_DEFINITIONS(-DHAVE_CONFIG_H)

@ -34,6 +34,14 @@
#cmakedefine HAVE_STATVFS 1
#cmakedefine HAVE_STAT64 1
#cmakedefine NL_OPENGL_AVAILABLE ${NL_OPENGL_AVAILABLE}
#cmakedefine NL_DIRECT3D_AVAILABLE ${NL_DIRECT3D_AVAILABLE}
#cmakedefine NL_FMOD_AVAILABLE ${NL_FMOD_AVAILABLE}
#cmakedefine NL_OPENAL_AVAILABLE ${NL_OPENAL_AVAILABLE}
#cmakedefine NL_DSOUND_AVAILABLE ${NL_DSOUND_AVAILABLE}
#cmakedefine NL_XAUDIO2_AVAILABLE ${NL_XAUDIO2_AVAILABLE}
#cmakedefine NL_BIN_PREFIX "${NL_BIN_PREFIX}"
#cmakedefine NL_ETC_PREFIX "${NL_ETC_PREFIX}"
#cmakedefine NL_SHARE_PREFIX "${NL_SHARE_PREFIX}"

@ -66,7 +66,8 @@ void alExtInitDevice(ALCdevice *device)
}
}
#if !defined(NL_STATIC) || defined(NL_OS_MAC)
// Windows and Mac OS always link to shared OpenAL library
#if defined(NL_OS_WINDOWS) || defined(NL_OS_MAC) || !defined(NL_STATIC)
// EFX
if ((AlExtEfx = (alcIsExtensionPresent(device, "ALC_EXT_EFX") == ALC_TRUE)) == true)
{
@ -136,7 +137,7 @@ EAXGetBufferMode eaxGetBufferMode = NULL;
// ALC_EXT_EFX
bool AlExtEfx = false;
// effect objects
#if !defined(NL_STATIC) || defined(NL_OS_MAC)
#if defined(NL_OS_WINDOWS) || defined(NL_OS_MAC) || !defined(NL_STATIC)
LPALGENEFXOBJECTS alGenEffects = NULL;
LPALDELETEEFXOBJECTS alDeleteEffects = NULL;
LPALISEFXOBJECT alIsEffect = NULL;

@ -20,6 +20,17 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#elif defined(NL_STATIC)
// Driver availability for NL_STATIC compilation.
# undef NL_FMOD_AVAILABLE
# undef NL_OPENAL_AVAILABLE
# undef NL_DSOUND_AVAILABLE
# undef NL_XAUDIO2_AVAILABLE
# if defined( NL_OS_WINDOWS )
# define NL_FMOD_AVAILABLE
# else
# define NL_OPENAL_AVAILABLE
# endif
#endif // HAVE_CONFIG_H
#ifdef NL_OS_WINDOWS
@ -34,28 +45,6 @@
using namespace NLMISC;
// Driver availability for NL_STATIC compilation.
#if defined( NL_OS_WINDOWS )
# define NL_FMOD_AVAILABLE 1
# define NL_OPENAL_AVAILABLE 0
# define NL_DSOUND_AVAILABLE 0
# define NL_XAUDIO2_AVAILABLE 0
#elif defined( NL_OS_UNIX )
#ifdef NL_STATIC
# define NL_FMOD_AVAILABLE 0
#else
# define NL_FMOD_AVAILABLE 1
#endif
# define NL_OPENAL_AVAILABLE 1
# define NL_DSOUND_AVAILABLE 0
# define NL_XAUDIO2_AVAILABLE 0
#else
# define NL_FMOD_AVAILABLE 0
# define NL_OPENAL_AVAILABLE 0
# define NL_DSOUND_AVAILABLE 0
# define NL_XAUDIO2_AVAILABLE 0
#endif
namespace NLSOUND
{
@ -72,16 +61,16 @@ const uint32 ISoundDriver::InterfaceVersion = 0x16; // Kaetemi
extern void outputProfile##__soundDriver(std::string &out); \
extern ISoundDriver::TDriver getDriverType##__soundDriver();
#if NL_FMOD_AVAILABLE
#ifdef NL_FMOD_AVAILABLE
NLSOUND_DECLARE_DRIVER(FMod)
#endif
#if NL_OPENAL_AVAILABLE
#ifdef NL_OPENAL_AVAILABLE
NLSOUND_DECLARE_DRIVER(OpenAl)
#endif
#if NL_DSOUND_AVAILABLE
#ifdef NL_DSOUND_AVAILABLE
NLSOUND_DECLARE_DRIVER(DSound)
#endif
#if NL_XAUDIO2_AVAILABLE
#ifdef NL_XAUDIO2_AVAILABLE
NLSOUND_DECLARE_DRIVER(XAudio2)
#endif
@ -122,26 +111,26 @@ ISoundDriver *ISoundDriver::createDriver(IStringMapperProvider *stringMapper, TD
switch (driverType)
{
// switch between available drivers
# if NL_FMOD_AVAILABLE
# ifdef NL_FMOD_AVAILABLE
case DriverFMod: result = createISoundDriverInstanceFMod(stringMapper); break;
# endif
# if NL_OPENAL_AVAILABLE
# ifdef NL_OPENAL_AVAILABLE
case DriverOpenAl: result = createISoundDriverInstanceOpenAl(stringMapper); break;
# endif
# if NL_DSOUND_AVAILABLE
# ifdef NL_DSOUND_AVAILABLE
case DriverDSound: result = createISoundDriverInstanceDSound(stringMapper); break;
# endif
# if NL_XAUDIO2_AVAILABLE
# ifdef NL_XAUDIO2_AVAILABLE
case DriverXAudio2: result = createISoundDriverInstanceXAudio2(stringMapper); break;
# endif
// auto driver = first available in this order: FMod, OpenAl, XAudio2, DSound
# if NL_FMOD_AVAILABLE
# if defined(NL_FMOD_AVAILABLE)
case DriverAuto: result = createISoundDriverInstanceFMod(stringMapper); break;
# elif NL_OPENAL_AVAILABLE
# elif defined(NL_OPENAL_AVAILABLE)
case DriverAuto: result = createISoundDriverInstanceOpenAl(stringMapper); break;
# elif NL_XAUDIO2_AVAILABLE
# elif defined(NL_XAUDIO2_AVAILABLE)
case DriverAuto: result = createISoundDriverInstanceXAudio2(stringMapper); break;
# elif NL_DSOUND_AVAILABLE
# elif defined(NL_DSOUND_AVAILABLE)
case DriverAuto: result = createISoundDriverInstanceDSound(stringMapper); break;
# endif
// unavailable driver = FAIL

Loading…
Cancel
Save