Hi Marcus,
thank you for the hint... attached is the "line feed clean" version ;-)
Cheers,
Christoph
Marcus Lindblom schrieb:
Nice!
However, your patch isn't whitespace-clean, i.e. there are many more
added/removed lines than necessary, especially for CMakeLists.txt.
Cleaning that up will help the devs to see what you actually did change.
I'm looking forward to try OSGQ4GLWindow. :)
Cheers,
/Marcus
Christoph Schäfer wrote:
Hi,
here goes the working version.
Cheers,
Christoph
Christoph Schäfer schrieb:
Hi,
I was a little bit too fast with this one, it is incomplete. I will
post a working version later on. Sorry for the inconvinience!
Cheers,
Christoph
Christoph Schäfer schrieb:
Hi,
attached you find a patch adding the QT4 support to the OpenSG cmake
build system. So you don't need to start from scratch in case you
start porting the QT4 stuff someday.
The patch also adds the OSGQ4GLWindow from OpenSG 1.8 code.
Cheers,
Christoph
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
------------------------------------------------------------------------
_______________________________________________
Opensg-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-core
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Opensg-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-core
Index: CMake/BuildFunctions.cmake
===================================================================
--- CMake/BuildFunctions.cmake (revision 1708)
+++ CMake/BuildFunctions.cmake (working copy)
@@ -385,8 +385,42 @@
ENDIF(OSG_ENABLE_FCD2CODE AND PYTHONINTERP_FOUND)
############
+ # Qt4
+ ############
+
+ IF(${PROJ_DEFINE} STREQUAL "OSG_COMPILEWINDOWQT4LIB")
+ # Here only the OSG_WITH_QT define is passes to qt moc.
+ # VS wraps defines as rguments between "" which is disliked by
moc.
+
+ # QT4_GET_MOC_FLAGS(moc_flags)
+ #SET(moc_flags ${${moc_flags}} ${CMAKE_CXX_FLAGS})
+ SET(moc_flags -DOSG_WITH_QT)
+
+ # Replace /D with -D for Qt moc
+ #STRING(REGEX REPLACE "/D(\\w*)" "-D" moc_flags ${moc_flags})
+ # Remove everything not a define from string
+ #STRING(REGEX REPLACE " /[^D][^ ]*" "" moc_flags ${moc_flags})
+ # Remove leading space if it is there
+ #STRING(REGEX REPLACE "^ " "" moc_flags ${moc_flags})
+ #MESSAGE(${moc_flags})
+
+ SET(${PROJECT_NAME}_INC ${${PROJECT_NAME}_INC}
${CMAKE_CURRENT_BINARY_DIR})
+
+ FOREACH (it ${${PROJECT_NAME}_HDR})
+ GET_FILENAME_COMPONENT(it ${it} ABSOLUTE)
+ QT4_MAKE_OUTPUT_FILE(${it} moc_ cxx outfile)
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
+ COMMAND ${QT_MOC_EXECUTABLE}
+ ARGS ${moc_flags} ${moc_options} -o ${outfile} ${it}
+ DEPENDS ${infile})
+ LIST(APPEND ${PROJECT_NAME}_SRC ${outfile})
+ ENDFOREACH(it)
+ ENDIF(${PROJ_DEFINE} STREQUAL "OSG_COMPILEWINDOWQT4LIB")
+
+ ############
# Flex/Bison
- ############
+ ############
IF(OSG_ENABLE_SCANPARSE_REGEN AND FLEX_EXE AND BISON_EXE)
@@ -457,6 +491,18 @@
VERSION 2.0.0
SOVERSION 2.0.0
DEBUGRT_POSTFIX "_d")
+
+ # Qt specific project settings
+ IF(${PROJ_DEFINE} STREQUAL "OSG_COMPILEWINDOWQT4LIB")
+ IF(MSVC)
+ SET(QT_OSG_FLAGS " /DOSG_WITH_QT /DQT_THREAD_SUPPORT
/DQT_ACCESSIBILITY_SUPPORT /DQT_NO_DEBUG /DQT_CLEAN_NAMESPACE")
+ ELSE(MSVC)
+ SET(QT_OSG_FLAGS " -DOSG_WITH_QT -DQT_THREAD_SUPPORT
-DQT_ACCESSIBILITY_SUPPORT -DQT_NO_DEBUG -DQT_CLEAN_NAMESPACE")
+ ENDIF(MSVC)
+ SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
+ COMPILE_FLAGS ${QT_OSG_FLAGS}
+ VS_KEYWORD Qt4VSv1.0)
+ ENDIF(${PROJ_DEFINE} STREQUAL "OSG_COMPILEWINDOWQT4LIB")
# dependencies - OpenSG
FOREACH(OSGDEP ${${PROJECT_NAME}_DEP_OSG_LIB})
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt (revision 1708)
+++ CMakeLists.txt (working copy)
@@ -357,7 +357,22 @@
OSG_SET(OSG_GLUT_INC_DIR)
OSG_SET(OSG_GLUT_LIBS)
ENDIF(GLUT_FOUND)
+
+ #############
+ #### QT
+ #############
+ OSG_FIND_PACKAGE(QT4)
+
+ IF(QT4_FOUND)
+ OSG_SET(OSG_WITH_QT 1)
+ OSG_SET(OSG_QT4_INC_DIR ${QT_INCLUDE_DIR})
+ OSG_SET(OSG_QT4_LIBS ${QT_LIBRARY_DIR})
+ ELSE(QT4_FOUND)
+ OSG_SET(OSG_QT4_INC_DIR)
+ OSG_SET(OSG_QT4_LIBS)
+ ENDIF(QT4_FOUND)
+
#############
#### OpenGL
#############
Index: Source/WindowSystem/QT4/CMakeLists.Lib.OSGWindowQT4.txt
===================================================================
--- Source/WindowSystem/QT4/CMakeLists.Lib.OSGWindowQT4.txt (revision 0)
+++ Source/WindowSystem/QT4/CMakeLists.Lib.OSGWindowQT4.txt (revision 0)
@@ -0,0 +1,63 @@
+
+PROJECT("OSGWindowQT4")
+
+OSG_ADD_PROJECT()
+
+IF(NOT QT4_FOUND)
+ MESSAGE(STATUS "Dependency (QT4) not found, can not build
(${PROJECT_NAME}).\n")
+ SET(OSGBUILD_${PROJECT_NAME} OFF)
+ENDIF(NOT QT4_FOUND)
+
+IF(${OSGBUILD_OSGWindowQT4})
+ MESSAGE("Jup")
+ SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} OSG_WITH_QT)
+ENDIF(${OSGBUILD_OSGWindowQT4})
+
+OSG_SELECT_PROJECT()
+
+##############################################################################
+# dependencies
+##############################################################################
+
+# dependencies - OpenSG
+SET(${PROJECT_NAME}_DEP_OSG_LIB OSGBase
+ OSGSystem
+ OSGWindow)
+SET(${PROJECT_NAME}_DEP_TEST_OSG_LIB OSGDrawable
+ OSGFileIO
+ OSGGroup
+ OSGImageFileIO
+ OSGState
+ OSGText
+ OSGUtil
+ OSGWindow)
+
+# dependencies - External
+SET(${PROJECT_NAME}_DEP_LIB
+ QT_QTCORE_LIBRARY
+ QT_QTGUI_LIBRARY
+ QT_QTOPENGL_LIBRARY
+ )
+# SET(${PROJECT_NAME}_DEP_LIBDIR)
+SET(${PROJECT_NAME}_DEP_INCDIR OSG_QT4_INC_DIR)
+
+# SET(${PROJECT_NAME}_DEP_TEST_LIB)
+# SET(${PROJECT_NAME}_DEP_TEST_LIBDIR)
+# SET(${PROJECT_NAME}_DEP_TEST_INCDIR)
+
+# dependencies - Additional
+# SET(${PROJECT_NAME}_DEP_ADD_INCDIR)
+
+OSG_STORE_PROJECT_DEPENDENCIES()
+
+##############################################################################
+# collect sources
+##############################################################################
+
+OSG_ADD_DIRECTORY("Source/WindowSystem/QT4")
+
+##############################################################################
+# setup build
+##############################################################################
+
+OSG_SETUP_PROJECT("OSG_COMPILEWINDOWQT4LIB")
Index: Source/WindowSystem/QT4/CMakeLists.txt
===================================================================
--- Source/WindowSystem/QT4/CMakeLists.txt (revision 0)
+++ Source/WindowSystem/QT4/CMakeLists.txt (revision 0)
@@ -0,0 +1,5 @@
+
+# CMake's ADD_SUBDIRECTORY only looks for CMakeLists.txt, so we include
+# the real file here
+
+INCLUDE("CMakeLists.Lib.OSGWindowQT4.txt")
Index: Source/WindowSystem/QT4/OSGQ4GLWidget_qt.cpp
===================================================================
--- Source/WindowSystem/QT4/OSGQ4GLWidget_qt.cpp (revision 0)
+++ Source/WindowSystem/QT4/OSGQ4GLWidget_qt.cpp (revision 0)
@@ -0,0 +1,145 @@
+/*---------------------------------------------------------------------------*\
+ * OpenSG *
+ * *
+ * *
+ * Copyright (C) 2000-2002 by the OpenSG Forum *
+ * *
+ * www.opensg.org *
+ * *
+ * contact: [email protected], [email protected], [email protected] *
+ * *
+\*---------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*\
+ * License *
+ * *
+ * This library is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Library General Public License as published *
+ * by the Free Software Foundation, version 2. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
+ * *
+\*---------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*\
+ * Changes *
+ * *
+ * *
+ * *
+ * *
+ * *
+ * *
+\*---------------------------------------------------------------------------*/
+
+//---------------------------------------------------------------------------
+// Includes
+//---------------------------------------------------------------------------
+
+#ifdef OSG_WITH_QT
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "OSGConfig.h"
+
+#include "OSGQ4GLWidget_qt.h"
+
+OSG_USING_NAMESPACE
+
+/*! \class osg::QTWindow
+
+The class for QT-based windows. See \ref PageWindowQT for a description.
+
+*/
+
+/***************************************************************************\
+ * Instance methods *
+\***************************************************************************/
+
+/*-------------------------------------------------------------------------*\
+ - public -
+\*-------------------------------------------------------------------------*/
+
+/*------------- constructors & destructors --------------------------------*/
+
+/*! Constructor
+*/
+
+
+OSGQGLWidget::OSGQGLWidget( QWidget *parent, const char *name,
+ const QGLWidget * shareWidget, Qt::WFlags f ) :
+ QGLWidget( parent, shareWidget, f )
+{
+}
+
+OSGQGLWidget::OSGQGLWidget( const QGLFormat & format,
+ QWidget *parent, const char *name,
+ const QGLWidget * shareWidget, Qt::WFlags f
+ ) :
+ QGLWidget( format, parent, shareWidget, f )
+{
+}
+
+
+/*! Destructor
+*/
+
+OSGQGLWidget::~OSGQGLWidget( void )
+{
+}
+
+
+/*------------------------------ access -----------------------------------*/
+
+void OSGQGLWidget::initializeGL(void)
+{
+}
+
+void OSGQGLWidget::paintGL(void)
+{
+}
+
+void OSGQGLWidget::resizeGL(int, int)
+{
+}
+
+void OSGQGLWidget::makeCurrent(void)
+{
+}
+
+void OSGQGLWidget::swapBuffers(void)
+{
+}
+
+#ifdef __sgi
+#pragma set woff 1375
+#endif
+
+#ifdef __sgi
+#pragma reset woff 1375
+#endif
+
+/*-------------------------------------------------------------------------*/
+/* cvs id's */
+
+#ifdef __sgi
+#pragma set woff 1174
+#endif
+
+#ifdef OSG_LINUX_ICC
+#pragma warning( disable : 177 )
+#endif
+
+namespace
+{
+ static char cvsid_cpp[] = "@(#)$Id: OSGQ4GLWidget_qt.cpp,v 1.1 2006/03/10
18:30:35 a-m-z Exp $";
+ static char cvsid_hpp[] = OSGQGLWIDGET_HEADER_CVSID;
+ static char cvsid_inl[] = OSGQGLWIDGET_INLINE_CVSID;
+}
+
+#endif /* OSG_WITH_QT */
Index: Source/WindowSystem/QT4/OSGQ4GLWidget_qt.h
===================================================================
--- Source/WindowSystem/QT4/OSGQ4GLWidget_qt.h (revision 0)
+++ Source/WindowSystem/QT4/OSGQ4GLWidget_qt.h (revision 0)
@@ -0,0 +1,151 @@
+/*---------------------------------------------------------------------------*\
+ * OpenSG *
+ * *
+ * *
+ * Copyright (C) 2000-2002 by the OpenSG Forum *
+ * *
+ * www.opensg.org *
+ * *
+ * contact: [email protected], [email protected], [email protected] *
+ * *
+\*---------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*\
+ * License *
+ * *
+ * This library is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Library General Public License as published *
+ * by the Free Software Foundation, version 2. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
+ * *
+\*---------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*\
+ * Changes *
+ * *
+ * *
+ * *
+ * *
+ * *
+ * *
+\*---------------------------------------------------------------------------*/
+
+#ifndef _OSG_QGLWIDGET_H_
+#define _OSG_QGLWIDGET_H_
+#ifdef __sgi
+#pragma once
+#endif
+
+//---------------------------------------------------------------------------
+// Includes
+//---------------------------------------------------------------------------
+
+#ifdef OSG_WITH_QT
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#ifdef __sgi
+#pragma set woff 1375
+#endif
+
+#ifdef OSG_WIN32_ICL
+#pragma warning (disable : 171)
+#endif
+
+#include <QtOpenGl/QGLWidget>
+
+#ifdef OSG_WIN32_ICL
+#pragma warning (default : 171)
+#endif
+
+#ifdef __sgi
+#pragma reset woff 1375
+#endif
+
+#include "OSGConfig.h"
+#include "OSGWindowQT4Def.h"
+#include <OSGBaseTypes.h>
+
+namespace OSG {
+
+/*! \brief OSGQGL widget class. See \ref PageWindowQT for a description. */
+
+class OSG_WINDOWQTLIB_DLLMAPPING OSGQGLWidget : public QGLWidget
+{
+ Q_OBJECT
+
+ /*========================== PUBLIC =================================*/
+ public:
+
+ /*---------------------------------------------------------------------*/
+ /*! \name Constructors */
+ /*! \{ */
+
+ OSGQGLWidget( QWidget *parent,
+ const Char8 *name = 0,
+ const QGLWidget *shareWidget = 0,
+ Qt::WFlags f = 0);
+
+ OSGQGLWidget(const QGLFormat &format = QGLFormat::defaultFormat(),
+ QWidget *parent = 0,
+ const Char8 *name = 0,
+ const QGLWidget *shareWidget = 0,
+ Qt::WFlags f = 0);
+ /*! \} */
+ /*---------------------------------------------------------------------*/
+ /*! \name Desstructor */
+ /*! \{ */
+
+ virtual ~OSGQGLWidget();
+
+ /*! \} */
+ /*---------------------------------------------------------------------*/
+ /*! \name OpenGL handling */
+ /*! \{ */
+
+ virtual void makeCurrent(void);
+ virtual void swapBuffers(void);
+
+ /*! \} */
+ /*========================= PROTECTED ===============================*/
+ protected:
+
+ /*---------------------------------------------------------------------*/
+ /*! \name OpenGL handling */
+ /*! \{ */
+
+ virtual void initializeGL(void);
+ virtual void paintGL (void);
+ virtual void resizeGL (int w, int h);
+
+ /*! \} */
+ /*========================== PRIVATE ================================*/
+ private:
+
+ /* prohibit default function (move to 'public' if needed) */
+ OSGQGLWidget(const OSGQGLWidget &source);
+ /* prohibit default function (move to 'public' if needed) */
+ void operator =(const OSGQGLWidget &source);
+};
+
+typedef OSGQGLWidget *OSGQGLWidgetP;
+
+} // OSG namespace
+
+#include <OSGQ4GLWidget_qt.inl>
+
+#define OSGQGLWIDGET_HEADER_CVSID "@(#)$Id: OSGQ4GLWidget_qt.h,v 1.2
2007/02/26 13:37:38 yjung Exp $"
+
+#endif /* OSG_WITH_QT */
+
+#endif /* _OSG_QGLWIDGET_H_ */
+
+
+
Index: Source/WindowSystem/QT4/OSGQ4GLWidget_qt.inl
===================================================================
--- Source/WindowSystem/QT4/OSGQ4GLWidget_qt.inl (revision 0)
+++ Source/WindowSystem/QT4/OSGQ4GLWidget_qt.inl (revision 0)
@@ -0,0 +1,52 @@
+/*---------------------------------------------------------------------------*\
+ * OpenSG *
+ * *
+ * *
+ * Copyright 2000-2002 by OpenSG Forum *
+ * *
+ * contact: [email protected], [email protected], [email protected] *
+ * *
+\*---------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*\
+ * License *
+ * *
+ * This library is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Library General Public License as published *
+ * by the Free Software Foundation, version 2. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
+ * *
+\*---------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*\
+ * Changes *
+ * *
+ * *
+ * *
+ * *
+ * *
+ * *
+\*---------------------------------------------------------------------------*/
+
+//---------------------------------------------------------------------------
+// Includes
+//---------------------------------------------------------------------------
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "OSGConfig.h"
+
+OSG_BEGIN_NAMESPACE
+
+OSG_END_NAMESPACE
+
+#define OSGQGLWIDGET_INLINE_CVSID "@(#)$Id: OSGQ4GLWidget_qt.inl,v 1.1
2006/03/10 18:30:35 a-m-z Exp $"
+
Index: Source/WindowSystem/QT4/OSGWindowQT4Def.h
===================================================================
--- Source/WindowSystem/QT4/OSGWindowQT4Def.h (revision 0)
+++ Source/WindowSystem/QT4/OSGWindowQT4Def.h (revision 0)
@@ -0,0 +1,63 @@
+/*---------------------------------------------------------------------------*\
+ * OpenSG *
+ * *
+ * *
+ * Copyright (C) 2000-2002 by the OpenSG Forum *
+ * *
+ * www.opensg.org *
+ * *
+ * contact: [email protected], [email protected], [email protected] *
+ * *
+\*---------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*\
+ * License *
+ * *
+ * This library is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Library General Public License as published *
+ * by the Free Software Foundation, version 2. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
+ * *
+\*---------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*\
+ * Changes *
+ * *
+ * *
+ * *
+ * *
+ * *
+ * *
+\*---------------------------------------------------------------------------*/
+
+
+#ifndef _OSGWINDOWQTDEF_H_
+#define _OSGWINDOWQTDEF_H_
+#ifdef __sgi
+#pragma once
+#endif
+
+//---------------------------------------------------------------------------
+// Defines
+//---------------------------------------------------------------------------
+
+#if defined(WIN32)
+# ifdef OSG_COMPILEWINDOWQT4LIB
+# define OSG_WINDOWQTLIB_DLLMAPPING __declspec(dllexport)
+# define OSG_WINDOWQTLIB_DLLTMPLMAPPING __declspec(dllexport)
+# else
+# define OSG_WINDOWQTLIB_DLLMAPPING __declspec(dllimport)
+# define OSG_WINDOWQTLIB_DLLTMPLMAPPING __declspec(dllimport)
+# endif
+#else
+#define OSG_WINDOWQTLIB_DLLMAPPING
+#define OSG_WINDOWQTLIB_DLLTMPLMAPPING
+#endif
+
+#endif /* _OSGWINDOWQTDEF_H_ */
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Opensg-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-core