Fix linking of OpenGL driver under MinGW

This commit is contained in:
kaetemi 2014-06-18 01:21:05 +02:00
parent 747e1de97f
commit 4924fb835f
13 changed files with 31 additions and 19 deletions

View file

@ -182,7 +182,7 @@ public:
IDriver(); IDriver();
virtual ~IDriver(); virtual ~IDriver();
virtual bool init(uint windowIcon = 0, emptyProc exitFunc = 0) = 0; virtual bool init(uintptr_t windowIcon = 0, emptyProc exitFunc = 0) = 0;
/// Deriver should calls IDriver::release() first, to destroy all driver components (textures, shaders, VBuffers). /// Deriver should calls IDriver::release() first, to destroy all driver components (textures, shaders, VBuffers).
virtual bool release(); virtual bool release();

View file

@ -123,7 +123,7 @@ public:
/// \name Object /// \name Object
// @{ // @{
CDriverUser (uint windowIcon, UDriver::TDriver driver, emptyProc exitFunc = 0); CDriverUser (uintptr_t windowIcon, UDriver::TDriver driver, emptyProc exitFunc = 0);
virtual ~CDriverUser(); virtual ~CDriverUser();
// @} // @}

View file

@ -24,8 +24,11 @@
#include "nel/misc/geom_ext.h" #include "nel/misc/geom_ext.h"
#include "nel/misc/line.h" #include "nel/misc/line.h"
#if defined (NL_COMP_MINGW)
#ifdef NL_OS_WINDOWS # define NL3D_GL_DLL_NAME "libnel_drv_opengl_win"
# define NL3D_GLES_DLL_NAME "libnel_drv_opengles_win"
# define NL3D_D3D_DLL_NAME "libnel_drv_direct3d_win"
#elif defined (NL_OS_WINDOWS)
# define NL3D_GL_DLL_NAME "nel_drv_opengl_win" # define NL3D_GL_DLL_NAME "nel_drv_opengl_win"
# define NL3D_GLES_DLL_NAME "nel_drv_opengles_win" # define NL3D_GLES_DLL_NAME "nel_drv_opengles_win"
# define NL3D_D3D_DLL_NAME "nel_drv_direct3d_win" # define NL3D_D3D_DLL_NAME "nel_drv_direct3d_win"

View file

@ -845,8 +845,8 @@ public:
/** /**
* This is the static function which build a UDriver, the root for all 3D functions. * This is the static function which build a UDriver, the root for all 3D functions.
*/ */
static UDriver *createDriver(uint windowIcon = 0, bool direct3d = false, emptyProc exitFunc = 0); static UDriver *createDriver(uintptr_t windowIcon = 0, bool direct3d = false, emptyProc exitFunc = 0);
static UDriver *createDriver(uint windowIcon, TDriver driver, emptyProc exitFunc = 0); static UDriver *createDriver(uintptr_t windowIcon, TDriver driver, emptyProc exitFunc = 0);
/** /**
* Purge static memory * Purge static memory

View file

@ -1231,7 +1231,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
// *************************************************************************** // ***************************************************************************
bool CDriverD3D::init (uint windowIcon, emptyProc exitFunc) bool CDriverD3D::init (uintptr_t windowIcon, emptyProc exitFunc)
{ {
H_AUTO_D3D(CDriver3D_init ); H_AUTO_D3D(CDriver3D_init );

View file

@ -839,7 +839,7 @@ public:
// *************************************************************************** // ***************************************************************************
// Mode initialisation, requests // Mode initialisation, requests
virtual bool init (uint windowIcon = 0, emptyProc exitFunc = 0); virtual bool init (uintptr_t windowIcon = 0, emptyProc exitFunc = 0);
virtual bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable) throw(EBadDisplay); virtual bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable) throw(EBadDisplay);
virtual bool release(); virtual bool release();
virtual bool setMode(const GfxMode& mode); virtual bool setMode(const GfxMode& mode);

View file

@ -37,7 +37,7 @@ NL_ADD_RUNTIME_FLAGS(${NLDRV_OGL_LIB})
IF(WIN32) IF(WIN32)
INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY}) TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY})
ADD_DEFINITIONS(/DDRIVER_OPENGL_EXPORTS) ADD_DEFINITIONS(-DDRIVER_OPENGL_EXPORTS)
ENDIF(WIN32) ENDIF(WIN32)
IF(APPLE) IF(APPLE)

View file

@ -108,7 +108,10 @@ IDriver* createGlDriverInstance ()
#else #else
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
#ifdef NL_COMP_MINGW
extern "C"
{
#endif
__declspec(dllexport) IDriver* NL3D_createIDriverInstance () __declspec(dllexport) IDriver* NL3D_createIDriverInstance ()
{ {
return new CDriverGL; return new CDriverGL;
@ -118,7 +121,9 @@ __declspec(dllexport) uint32 NL3D_interfaceVersion ()
{ {
return IDriver::InterfaceVersion; return IDriver::InterfaceVersion;
} }
#ifdef NL_COMP_MINGW
}
#endif
#elif defined (NL_OS_UNIX) #elif defined (NL_OS_UNIX)
extern "C" extern "C"

View file

@ -1,2 +1,4 @@
EXPORTS NL3D_createIDriverInstance LIBRARY nel_drv_opengl_win_r
EXPORTS NL3D_interfaceVersion EXPORTS
NL3D_createIDriverInstance
NL3D_interfaceVersion

View file

@ -304,7 +304,7 @@ public:
virtual bool isLost() const { return false; } // there's no notion of 'lost device" in OpenGL virtual bool isLost() const { return false; } // there's no notion of 'lost device" in OpenGL
virtual bool init (uint windowIcon = 0, emptyProc exitFunc = 0); virtual bool init (uintptr_t windowIcon = 0, emptyProc exitFunc = 0);
virtual void disableHardwareVertexProgram(); virtual void disableHardwareVertexProgram();
virtual void disableHardwarePixelProgram(); virtual void disableHardwarePixelProgram();

View file

@ -296,7 +296,7 @@ bool GlWndProc(CDriverGL *driver, XEvent &e)
#endif // NL_OS_UNIX #endif // NL_OS_UNIX
// *************************************************************************** // ***************************************************************************
bool CDriverGL::init (uint windowIcon, emptyProc exitFunc) bool CDriverGL::init (uintptr_t windowIcon, emptyProc exitFunc)
{ {
H_AUTO_OGL(CDriverGL_init) H_AUTO_OGL(CDriverGL_init)

View file

@ -37,7 +37,9 @@
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN
# ifndef NL_COMP_MINGW
# define NOMINMAX # define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
# include <windowsx.h> # include <windowsx.h>
#endif #endif

View file

@ -82,13 +82,13 @@ void UDriver::setMatrixMode2D43()
} }
// *************************************************************************** // ***************************************************************************
UDriver *UDriver::createDriver(uint windowIcon, bool direct3d, emptyProc exitFunc) UDriver *UDriver::createDriver(uintptr_t windowIcon, bool direct3d, emptyProc exitFunc)
{ {
return new CDriverUser (windowIcon, direct3d ? CDriverUser::Direct3d:CDriverUser::OpenGl, exitFunc); return new CDriverUser (windowIcon, direct3d ? CDriverUser::Direct3d:CDriverUser::OpenGl, exitFunc);
} }
// *************************************************************************** // ***************************************************************************
UDriver *UDriver::createDriver(uint windowIcon, TDriver driver, emptyProc exitFunc) UDriver *UDriver::createDriver(uintptr_t windowIcon, TDriver driver, emptyProc exitFunc)
{ {
return new CDriverUser (windowIcon, (CDriverUser::TDriver)driver, exitFunc); return new CDriverUser (windowIcon, (CDriverUser::TDriver)driver, exitFunc);
} }
@ -114,7 +114,7 @@ bool CDriverUser::_StaticInit= false;
// *************************************************************************** // ***************************************************************************
CDriverUser::CDriverUser (uint windowIcon, TDriver driver, emptyProc exitFunc) CDriverUser::CDriverUser (uintptr_t windowIcon, TDriver driver, emptyProc exitFunc)
{ {
// The enum of IDriver and UDriver MUST be the same!!! // The enum of IDriver and UDriver MUST be the same!!!
nlassert((uint)IDriver::idCount == (uint)UDriver::idCount); nlassert((uint)IDriver::idCount == (uint)UDriver::idCount);