Commit 331d62d5 authored by nfoy's avatar nfoy

Merge remote-tracking branch 'origin/wip-jlindgre-debug-baddrawable' into integration-1.2

parents e2d46466 f530324b
......@@ -112,11 +112,13 @@ ELSEIF(UNIX)
endif ()
if(EXISTS "/etc/debian_version")
set (PLATFORM "Debian")
set (PLATFORM "Debian")
ADD_DEFINITIONS("-DTARGET_OS_Linux_Debian")
endif(EXISTS "/etc/debian_version")
if(EXISTS "/etc/fedora-release")
set (PLATFORM "Fedora")
set (PLATFORM "Fedora")
ADD_DEFINITIONS("-DTARGET_OS_Linux_Fedora")
endif(EXISTS "/etc/fedora-release")
ELSE(WIN32)
......
......@@ -6,6 +6,9 @@
#export OV_PATH_LIB="$OV_PATH_ROOT/lib"
#export OV_PATH_DATA="$OV_PATH_ROOT/share/openvibe"
# Dump core...
# ulimit -c unlimited
# Tries to locate matlab executable from $PATH, and set the library path to the corresponding matlab libs.
if [ "`which matlab`" != "" ] ; then
MATLAB_ROOT=`matlab -e | grep "^MATLAB=" | sed -e "s/^MATLAB=//"`
......
......@@ -11,6 +11,26 @@
#include "Overlay/OgreOverlaySystem.h"
#endif
#if defined(TARGET_OS_Linux_Fedora)
// @FIXME this is an awful hack to avoid crashes on our Fedora CI running on CloudStack VM.
// It seems that there we get difficult to track X11 errors from inside Ogre that
// 1) abort the application
// 2) do not seem to appear on a non-VM computer
// 3) seem to be of no concern to the automatic testing?
// Hence we just specify a dummy error handler until we can solve the problem.
#include <stdio.h>
#include <X11/Xlib.h>
static int errorHandlerHack(Display *display, XErrorEvent *event)
{
(void) fprintf(stderr,
"WARNING: Ignored Xlib error: error_code=%d, request_code=%d\n",
event->error_code,
event->request_code) ;
return 0 ;
}
#endif
using namespace std;
using namespace Ogre;
using namespace OpenViBE;
......@@ -24,6 +44,7 @@ COgreVisualisation::COgreVisualisation(const OpenViBE::Kernel::IKernelContext& r
,m_bOgreInitialised(false)
,m_bResourcesInitialised(false)
,m_pRoot(NULL)
,m_pLogManager(NULL)
,m_pLog(NULL)
,m_pOverlaySystem(NULL)
{
......@@ -82,10 +103,13 @@ boolean COgreVisualisation::initializeOgre(void) throw (std::exception)
//configure custom log
//--------------------
LogManager* l_pLogManager = new LogManager();
m_pLogManager = new LogManager();
//create custom log
const CString l_sLogFile = this->getConfigurationManager().expand("${Kernel_3DVisualisationOgreLogPath}");
m_pLog = l_pLogManager->createLog(l_sLogFile.toASCIIString(),
this->getLogManager() << LogLevel_Trace << "Ogre log will be written to [" << l_sLogFile << "]\n";
m_pLog = m_pLogManager->createLog(l_sLogFile.toASCIIString(),
true /* is default log */, false /* send log messages to debugger */, (l_sLogFile == CString("") ? true : false) /* suppress file log */);
if (!m_pLog)
{
......@@ -131,6 +155,10 @@ boolean COgreVisualisation::initializeOgre(void) throw (std::exception)
//init Ogre w/o creating a default window
m_pRoot->initialise(false);
m_bOgreInitialised = true;
#if defined(TARGET_OS_Linux_Fedora)
XSetErrorHandler(errorHandlerHack);
#endif
}
#if (OGRE_VERSION_MAJOR > 1) || ((OGRE_VERSION_MAJOR == 1) && (OGRE_VERSION_MINOR >= 9))
......@@ -142,8 +170,7 @@ boolean COgreVisualisation::initializeOgre(void) throw (std::exception)
catch(Ogre::Exception& e)
{
this->getLogManager()
<< LogLevel_Trace << "<" << LogColor_PushStateBit << LogColor_ForegroundBlue << "Ogre3D" << LogColor_PopStateBit << "::Exception> "
<< "Failed to initialize Ogre : " << e.what() << "\n";
<< LogLevel_Error << "<Ogre3D::Exception> Failed to initialize Ogre : " << e.what() << "\n";
}
return m_bOgreInitialised;
......@@ -170,8 +197,7 @@ boolean COgreVisualisation::initializeResources() throw (Ogre::Exception)
catch(Ogre::Exception& e)
{
this->getLogManager()
<< LogLevel_Trace << "<" << LogColor_PushStateBit << LogColor_ForegroundBlue << "Ogre3D" << LogColor_PopStateBit << "::Exception> "
<< "Failed to initialize Ogre resources : " << e.what() << "\n";
<< LogLevel_Error << "<Ogre3D::Exception> Failed to initialize Ogre resources : " << e.what() << "\n";
}
m_bResourcesInitialised = true;
......@@ -215,16 +241,34 @@ boolean COgreVisualisation::finish()
itResources = m_mOgreResourceGroups.begin();
}
#if (OGRE_VERSION_MAJOR > 1) || ((OGRE_VERSION_MAJOR == 1) && (OGRE_VERSION_MINOR >= 9))
if(m_pOverlaySystem)
{
OGRE_DELETE m_pOverlaySystem;
m_pOverlaySystem = NULL;
}
#endif
if(m_pRoot != NULL)
{
delete m_pRoot;
m_pRoot = NULL;
}
if(m_pLog) {
m_pLog->removeListener(this);
m_pLogManager->destroyLog(m_pLog);
m_pLog = NULL;
}
if(m_pLogManager) {
delete m_pLogManager;
m_pLogManager = NULL;
}
}
catch(Ogre::Exception)
catch(Ogre::Exception e)
{
//
this->getLogManager() << LogLevel_Error << "<Ogre3D::Exception> During finish() : " << e.what() << "\n";
return false;
}
......
......@@ -270,6 +270,8 @@ private:
OpenViBE::boolean m_bResourcesInitialised;
/// Ogre3D root
Ogre::Root* m_pRoot;
/// Ogre log manager
Ogre::LogManager* m_pLogManager;
/// Ogre log
Ogre::Log* m_pLog;
/// Maps scene Ids to scene pointers
......
......@@ -270,7 +270,7 @@ message(" -- Finished ${MODEL} - ${CTEST_BUILD_NAME} --")
IF(${MODEL} MATCHES Nightly)
message(" -- clean ${MODEL} - ${CTEST_BUILD_NAME} --")
ctest_empty_binary_directory(${CTEST_SOURCE_DIRECTORY})
ctest_empty_binary_directory(${CTEST_SOURCE_DIRECTORY})
ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
exec_program("rm" ARGS "-rf ${CTEST_SOURCE_DIRECTORY}" OUTPUT_VARIABLE "cleanScript")
ENDIF(${MODEL} MATCHES Nightly)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment