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 535b75abd6
commit 1266d1d5a4
3 changed files with 41 additions and 9 deletions

View file

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

View file

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

View file

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