From 2f3f12e03486f018a1bab7c1ad0b9935b286fd1f Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 18 Jun 2014 00:28:08 +0200 Subject: [PATCH] Fix linking of OpenAL driver under MinGW --- code/nel/src/misc/CMakeLists.txt | 2 +- code/nel/src/misc/report.cpp | 2 ++ .../src/sound/driver/openal/driver_openal.def | 10 ++++++---- .../sound/driver/openal/sound_driver_al.cpp | 13 ++++++++++-- code/nel/src/sound/driver/sound_driver.cpp | 20 ++++++++++++++----- 5 files changed, 35 insertions(+), 12 deletions(-) diff --git a/code/nel/src/misc/CMakeLists.txt b/code/nel/src/misc/CMakeLists.txt index dc5b87e2c..0f61fd850 100644 --- a/code/nel/src/misc/CMakeLists.txt +++ b/code/nel/src/misc/CMakeLists.txt @@ -27,7 +27,7 @@ ENDIF(WITH_STATIC OR WIN32) # For DirectInput (di_event_emitter) IF(WIN32) INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR}) - TARGET_LINK_LIBRARIES(nelmisc ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY}) + TARGET_LINK_LIBRARIES(nelmisc ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY} winmm dbghelp) ENDIF(WIN32) IF(UNIX) diff --git a/code/nel/src/misc/report.cpp b/code/nel/src/misc/report.cpp index f440b8d46..20b2b1c11 100644 --- a/code/nel/src/misc/report.cpp +++ b/code/nel/src/misc/report.cpp @@ -159,8 +159,10 @@ static LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM // if the dtor call order is not good. //exit(EXIT_SUCCESS); #ifdef NL_OS_WINDOWS +#ifndef NL_COMP_MINGW // disable the Windows popup telling that the application aborted and disable the dr watson report. _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT); +#endif #endif // quit without calling atexit or static object dtors. abort(); diff --git a/code/nel/src/sound/driver/openal/driver_openal.def b/code/nel/src/sound/driver/openal/driver_openal.def index 41e42cf9d..a8b0c2781 100644 --- a/code/nel/src/sound/driver/openal/driver_openal.def +++ b/code/nel/src/sound/driver/openal/driver_openal.def @@ -1,4 +1,6 @@ -EXPORTS NLSOUND_createISoundDriverInstance -EXPORTS NLSOUND_interfaceVersion -EXPORTS NLSOUND_outputProfile -EXPORTS NLSOUND_getDriverType +LIBRARY nel_drv_openal_win_r +EXPORTS + NLSOUND_createISoundDriverInstance + NLSOUND_interfaceVersion + NLSOUND_outputProfile + NLSOUND_getDriverType \ No newline at end of file diff --git a/code/nel/src/sound/driver/openal/sound_driver_al.cpp b/code/nel/src/sound/driver/openal/sound_driver_al.cpp index 40ea39d0b..82f52b782 100644 --- a/code/nel/src/sound/driver/openal/sound_driver_al.cpp +++ b/code/nel/src/sound/driver/openal/sound_driver_al.cpp @@ -92,7 +92,12 @@ NLMISC_DECL_PURE_LIB(CSoundDriverALNelLibrary) * Sound driver instance creation */ #ifdef NL_OS_WINDOWS - +#ifdef NL_COMP_MINGW +#ifndef NL_STATIC +extern "C" +{ +#endif +#endif // ****************************************************************** #ifdef NL_STATIC @@ -140,7 +145,11 @@ __declspec(dllexport) ISoundDriver::TDriver NLSOUND_getDriverType() } // ****************************************************************** - +#ifdef NL_COMP_MINGW +#ifndef NL_STATIC +} +#endif +#endif #elif defined (NL_OS_UNIX) #ifndef NL_STATIC diff --git a/code/nel/src/sound/driver/sound_driver.cpp b/code/nel/src/sound/driver/sound_driver.cpp index a1c0a94fd..4a87df307 100644 --- a/code/nel/src/sound/driver/sound_driver.cpp +++ b/code/nel/src/sound/driver/sound_driver.cpp @@ -153,7 +153,9 @@ ISoundDriver *ISoundDriver::createDriver(IStringMapperProvider *stringMapper, TD switch(driverType) { case DriverFMod: -#if defined (NL_OS_WINDOWS) +#if defined (NL_COMP_MINGW) + dllName = "libnel_drv_fmod_win"; +#elif defined (NL_OS_WINDOWS) dllName = "nel_drv_fmod_win"; #elif defined (NL_OS_UNIX) dllName = "nel_drv_fmod"; @@ -162,7 +164,9 @@ ISoundDriver *ISoundDriver::createDriver(IStringMapperProvider *stringMapper, TD #endif // NL_OS_UNIX / NL_OS_WINDOWS break; case DriverOpenAl: -#ifdef NL_OS_WINDOWS +#if defined (NL_COMP_MINGW) + dllName = "libnel_drv_openal_win"; +#elif defined (NL_OS_WINDOWS) dllName = "nel_drv_openal_win"; #elif defined (NL_OS_UNIX) dllName = "nel_drv_openal"; @@ -171,7 +175,9 @@ ISoundDriver *ISoundDriver::createDriver(IStringMapperProvider *stringMapper, TD #endif break; case DriverDSound: -#ifdef NL_OS_WINDOWS +#if defined (NL_COMP_MINGW) + dllName = "libnel_drv_dsound_win"; +#elif defined (NL_OS_WINDOWS) dllName = "nel_drv_dsound_win"; #elif defined (NL_OS_UNIX) nlerror("DriverDSound doesn't exist on Unix because it requires DirectX"); @@ -180,7 +186,9 @@ ISoundDriver *ISoundDriver::createDriver(IStringMapperProvider *stringMapper, TD #endif break; case DriverXAudio2: -#ifdef NL_OS_WINDOWS +#if defined (NL_COMP_MINGW) + dllName = "libnel_drv_xaudio2_win"; +#elif defined (NL_OS_WINDOWS) dllName = "nel_drv_xaudio2_win"; #elif defined (NL_OS_UNIX) nlerror("DriverXAudio2 doesn't exist on Unix because it requires DirectX"); @@ -189,7 +197,9 @@ ISoundDriver *ISoundDriver::createDriver(IStringMapperProvider *stringMapper, TD #endif break; default: -#ifdef NL_OS_WINDOWS +#if defined (NL_COMP_MINGW) + dllName = "libnel_drv_xaudio2_win"; +#elif defined (NL_OS_WINDOWS) dllName = "nel_drv_xaudio2_win"; #elif defined (NL_OS_UNIX) dllName = "nel_drv_openal";