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

This commit is contained in:
kervala 2011-02-24 18:42:09 +01:00
parent c16cfbcf4d
commit a5bb497c71
3 changed files with 41 additions and 9 deletions

View file

@ -36,6 +36,9 @@
#include "nel/misc/hierarchical_timer.h" #include "nel/misc/hierarchical_timer.h"
#include "nel/misc/event_emitter.h" #include "nel/misc/event_emitter.h"
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif // HAVE_CONFIG_H
using namespace NLMISC; using namespace NLMISC;
@ -131,13 +134,16 @@ CDriverUser::CDriverUser (uint windowIcon, bool direct3d, emptyProc exitFunc)
CScene::registerBasics(); CScene::registerBasics();
} }
_Driver = NULL;
// Create/Init Driver. // Create/Init Driver.
#ifdef NL_OS_WINDOWS #if defined(NL_OS_WINDOWS) && defined(NL_DIRECT3D_AVAILABLE)
if (direct3d) if (direct3d)
_Driver= CDRU::createD3DDriver(); _Driver= CDRU::createD3DDriver();
else #endif
_Driver= CDRU::createGlDriver();
#else #ifdef NL_OPENGL_AVAILABLE
if (!_Driver)
_Driver= CDRU::createGlDriver(); _Driver= CDRU::createGlDriver();
#endif #endif

View file

@ -50,9 +50,12 @@ typedef uint32 (*IDRV_VERSION_PROC)(void);
const char *IDRV_VERSION_PROC_NAME = "NL3D_interfaceVersion"; const char *IDRV_VERSION_PROC_NAME = "NL3D_interfaceVersion";
#ifdef NL_STATIC #ifdef NL_STATIC
extern IDriver* createGlDriverInstance ();
#ifdef NL_OS_WINDOWS #ifdef NL_OPENGL_AVAILABLE
extern IDriver* createGlDriverInstance ();
#endif
#if defined(NL_OS_WINDOWS) && defined(NL_DIRECT3D_AVAILABLE)
extern IDriver* createD3DDriverInstance (); extern IDriver* createD3DDriverInstance ();
#endif #endif
@ -63,7 +66,11 @@ IDriver *CDRU::createGlDriver() throw (EDru)
{ {
#ifdef NL_STATIC #ifdef NL_STATIC
#ifdef NL_OPENGL_AVAILABLE
return createGlDriverInstance (); return createGlDriverInstance ();
#else
return NULL;
#endif // NL_OPENGL_AVAILABLE
#else #else
@ -158,7 +165,11 @@ IDriver *CDRU::createD3DDriver() throw (EDru)
{ {
#ifdef NL_STATIC #ifdef NL_STATIC
#ifdef NL_DIRECT3D_AVAILABLE
return createD3DDriverInstance (); return createD3DDriverInstance ();
#else
return NULL;
#endif // NL_DIRECT3D_AVAILABLE
#else #else

View file

@ -26,6 +26,11 @@
#include "nel/3d/init_3d.h" #include "nel/3d/init_3d.h"
#include "nel/3d/vertex_stream_manager.h" #include "nel/3d/vertex_stream_manager.h"
#include "nel/misc/debug.h" #include "nel/misc/debug.h"
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif // HAVE_CONFIG_H
using namespace std; using namespace std;
using namespace NLMISC; using namespace NLMISC;
@ -54,18 +59,28 @@ bool CNELU::initDriver (uint w, uint h, uint bpp, bool windowed, nlWindow syst
ShapeBank = new CShapeBank; ShapeBank = new CShapeBank;
CNELU::Driver = NULL;
// Init driver. // Init driver.
#ifdef NL_OS_WINDOWS #if defined(NL_OS_WINDOWS) && defined(NL_DIRECT3D_AVAILABLE)
if (direct3d) if (direct3d)
{ {
CNELU::Driver= CDRU::createD3DDriver(); CNELU::Driver= CDRU::createD3DDriver();
} }
else #endif
#endif // NL_OS_WINDOWS
#ifdef NL_OPENGL_AVAILABLE
if (!CNELU::Driver)
{ {
CNELU::Driver= CDRU::createGlDriver(); CNELU::Driver= CDRU::createGlDriver();
} }
#endif
if (!CNELU::Driver)
{
nlwarning ("CNELU::initDriver: no driver found");
return false;
}
if (!CNELU::Driver->init()) if (!CNELU::Driver->init())
{ {
nlwarning ("CNELU::initDriver: init() failed"); nlwarning ("CNELU::initDriver: init() failed");