From Jannik Heller, "I've added the check for Qt version mismatches into osgQt as suggested in http://forum.openscenegraph.org/viewtopic.php?t=14999.

When an application is built with Qt4, but osgQt was built with Qt5 (or vice versa), upon #includeing osgQt users will receive an #error aborting the build.

This at least provides a proper error message rather than a crash, while we are working on better fixes for the problem."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14918 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield 2015-06-15 19:59:01 +00:00
parent 824cc95518
commit 1e0d682979
7 changed files with 23 additions and 0 deletions

View File

@ -18,6 +18,7 @@
#include <osgViewer/GraphicsWindow> #include <osgViewer/GraphicsWindow>
#include <osgQt/Export> #include <osgQt/Export>
#include <osgQt/Version>
#include <QMutex> #include <QMutex>
#include <QEvent> #include <QEvent>

View File

@ -15,6 +15,7 @@
#include <osgText/Font> #include <osgText/Font>
#include <osgQt/Export> #include <osgQt/Export>
#include <osgQt/Version>
#include <QtGui/QFont> #include <QtGui/QFont>

View File

@ -19,6 +19,7 @@
#include <osg/Image> #include <osg/Image>
#include <osg/observer_ptr> #include <osg/observer_ptr>
#include <osgQt/Export> #include <osgQt/Export>
#include <osgQt/Version>
#include <QPointer> #include <QPointer>
#include <QGraphicsScene> #include <QGraphicsScene>

View File

@ -26,6 +26,7 @@
#include <osgWidget/Browser> #include <osgWidget/Browser>
#include <osgQt/QGraphicsViewAdapter> #include <osgQt/QGraphicsViewAdapter>
#include <osgQt/Version>
namespace osgQt namespace osgQt
{ {

View File

@ -15,6 +15,7 @@
#define QWIDGETIMAGE #define QWIDGETIMAGE
#include <osgQt/QGraphicsViewAdapter> #include <osgQt/QGraphicsViewAdapter>
#include <osgQt/Version>
#include <osg/Image> #include <osg/Image>
namespace osgQt namespace osgQt

View File

@ -15,10 +15,15 @@ SET(SOURCES_H
IF ( Qt5Widgets_FOUND ) IF ( Qt5Widgets_FOUND )
QT5_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS QT5_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS
"-fosgQt/QGraphicsViewAdapter" ) "-fosgQt/QGraphicsViewAdapter" )
set(OSGQT_QT_VERSION 5)
ELSE() ELSE()
QT4_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-f" ) QT4_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-f" )
set(OSGQT_QT_VERSION 4)
ENDIF() ENDIF()
SET(OSGQT_VERSION_HEADER "${PROJECT_BINARY_DIR}/include/osgQt/Version")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/Version.in" ${OSGQT_VERSION_HEADER})
SET(TARGET_H SET(TARGET_H
${HEADER_PATH}/Export ${HEADER_PATH}/Export
${HEADER_PATH}/GraphicsWindowQt ${HEADER_PATH}/GraphicsWindowQt
@ -26,6 +31,7 @@ SET(TARGET_H
${HEADER_PATH}/QGraphicsViewAdapter ${HEADER_PATH}/QGraphicsViewAdapter
${HEADER_PATH}/QWidgetImage ${HEADER_PATH}/QWidgetImage
${HEADER_PATH}/QWebViewImage ${HEADER_PATH}/QWebViewImage
${OSGQT_VERSION_HEADER}
) )

12
src/osgQt/Version.in Normal file
View File

@ -0,0 +1,12 @@
#ifndef OSGQT_VERSION
#define OSGQT_VERSION
#define OSGQT_QT_VERSION @OSGQT_QT_VERSION@
#include <QtGlobal>
#if (QT_VERSION < QT_VERSION_CHECK(OSGQT_QT_VERSION,0,0))
#error "Qt version mismatch detected! Make sure to compile applications using osgQt with the same major Qt version that osgQt has been compiled against."
#endif
#endif