← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2251: 1. compile with package QGLViewer, if installed (package libqglviewer-qt3-dev)

 

------------------------------------------------------------
revno: 2251
committer: Václav Šmilauer <eudoxos@xxxxxxxx>
branch nick: trunk
timestamp: Mon 2010-05-24 23:42:47 +0200
message:
  1. compile with package QGLViewer, if installed (package libqglviewer-qt3-dev)
modified:
  SConstruct
  gui/qt3/GLViewer.hpp
  lib/SConscript


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'SConstruct'
--- SConstruct	2010-05-08 14:53:54 +0000
+++ SConstruct	2010-05-24 21:42:47 +0000
@@ -363,7 +363,12 @@
 		ok=conf.CheckQt(env['QTDIR'])
 		if not ok: featureNotOK('opengl','Building with OpenGL implies qt3 interface, which was not found, although OpenGL was.')
 		env.Tool('qt'); env.Replace(QT_LIB='qt-mt')
-		env['QGLVIEWER_LIB']='yade-QGLViewer';
+		if conf.CheckLibWithHeader(['qglviewer'],'QGLViewer/qglviewer.h','c++','QGLViewer();',autoadd=0):
+			env['QGLVIEWER_LIB']='qglviewer-qt3';
+		else:
+			print"(OK, local version will be used instead)"
+			env['QGLVIEWER_LIB']='yade-QGLViewer';
+			env.Append(CPPDEFINES=['YADE_LOCAL_QGLVIEWER'])
 	if 'vtk' in env['features']:
 		ok=conf.CheckLibWithHeader(['vtkCommon'],'vtkInstantiator.h','c++','vtkInstantiator::New();',autoadd=1)
 		env.Append(LIBS='vtkHybrid')

=== modified file 'gui/qt3/GLViewer.hpp'
--- gui/qt3/GLViewer.hpp	2010-03-27 22:18:10 +0000
+++ gui/qt3/GLViewer.hpp	2010-05-24 21:42:47 +0000
@@ -4,8 +4,15 @@
 
 #include<yade/core/Omega.hpp>
 #include<yade/pkg-common/OpenGLRenderingEngine.hpp>
-#include<yade/lib-QGLViewer/qglviewer.h>
-#include<yade/lib-QGLViewer/constraint.h>
+
+#ifndef YADE_LOCAL_QGLVIEWER
+	#include<QGLViewer/qglviewer.h>
+	#include<QGLViewer/constraint.h>
+#else
+	#include<yade/lib-QGLViewer/qglviewer.h>
+	#include<yade/lib-QGLViewer/constraint.h>
+#endif
+
 #include"YadeQtMainWindow.hpp"
 #include<boost/date_time/posix_time/posix_time.hpp>
 #include<set>

=== modified file 'lib/SConscript'
--- lib/SConscript	2010-05-08 14:53:54 +0000
+++ lib/SConscript	2010-05-24 21:42:47 +0000
@@ -9,49 +9,48 @@
 	#return env.Install('$PREFIX/lib/yade$SUFFIX/lib',env.StaticLibrary(*args,**kw))
 
 if 'opengl' in env['features']:
-	yadeStaticOrSharedLib('yade-serialization-qt',['serialization-qt/QtGUIGenerator.cpp'],
-		#LIBS=env['LIBS']+['yade-suypportbase','XMLFormatManager']),
-		LIBS=['yade-support']),
-	yadeStaticOrSharedLib('yade-QGLViewer',Split('''
-		QGLViewer/VRenderInterface_Qt3.ui
-		QGLViewer/ImageInterface_Qt3.ui
-		QGLViewer/qglviewer.cpp 
-		QGLViewer/camera.cpp 
-		QGLViewer/manipulatedFrame.cpp 
-		QGLViewer/manipulatedCameraFrame.cpp 
-		QGLViewer/frame.cpp 
-		QGLViewer/saveSnapshot.cpp 
-		QGLViewer/constraint.cpp 
-		QGLViewer/keyFrameInterpolator.cpp 
-		QGLViewer/mouseGrabber.cpp 
-		QGLViewer/quaternion.cpp 
-		QGLViewer/vec.cpp
-		QGLViewer/VRender/BackFaceCullingOptimizer.cpp 
-		QGLViewer/VRender/BSPSortMethod.cpp 
-		QGLViewer/VRender/EPSExporter.cpp 
-		QGLViewer/VRender/Exporter.cpp 
-		QGLViewer/VRender/FIGExporter.cpp 
-		QGLViewer/VRender/gpc.cpp 
-		QGLViewer/VRender/ParserGL.cpp 
-		QGLViewer/VRender/Primitive.cpp 
-		QGLViewer/VRender/PrimitivePositioning.cpp 
-		QGLViewer/VRender/TopologicalSortMethod.cpp 
-		QGLViewer/VRender/VisibilityOptimizer.cpp 
-		QGLViewer/VRender/Vector2.cpp 
-		QGLViewer/VRender/Vector3.cpp 
-		QGLViewer/VRender/NVector3.cpp 
-		QGLViewer/VRender/VRender.cpp
-		'''),
-		# we want to REALLY optimize this, even in debug builds of yade; and suppress all warnings also
-		CXXFLAGS=[x for x in env['CXXFLAGS'] if x not in ['-ggdb3','-g','-pg'] ]+['-O3','-g0','-w'],
-		# HACK: uic generates files in the buildDir, but gcc is invoked on files in the original dir;
-		# since the generated header is #include'd "...", it looks for it in the original dir
-		# no idea why this _does_ work with gui/qt3. Go figure.
-		CPPPATH=env['CPPPATH']+['${TARGET.dir}'],
-		LIBS=env['LIBS']+['GLU','GL']
-	)
+	yadeStaticOrSharedLib('yade-serialization-qt',['serialization-qt/QtGUIGenerator.cpp'],LIBS=['yade-support'])
 	yadeStaticOrSharedLib('yade-opengl',env.Combine('yade-opengl.cpp',['opengl/FpsTracker.cpp','opengl/GLTextLabel.cpp','opengl/GLWindow.cpp','opengl/GLWindowsManager.cpp','opengl/GLUtils.cpp']),LIBS=env['LIBS']+['glut','GL','$QGLVIEWER_LIB']),
-#env.Install('$PREFIX/lib/yade$SUFFIX/lib',env.StaticLibrary
+	if 'YADE_LOCAL_QGLVIEWER' in env['CPPDEFINES']:
+		yadeStaticOrSharedLib('yade-QGLViewer',Split('''
+			QGLViewer/VRenderInterface_Qt3.ui
+			QGLViewer/ImageInterface_Qt3.ui
+			QGLViewer/qglviewer.cpp 
+			QGLViewer/camera.cpp 
+			QGLViewer/manipulatedFrame.cpp 
+			QGLViewer/manipulatedCameraFrame.cpp 
+			QGLViewer/frame.cpp 
+			QGLViewer/saveSnapshot.cpp 
+			QGLViewer/constraint.cpp 
+			QGLViewer/keyFrameInterpolator.cpp 
+			QGLViewer/mouseGrabber.cpp 
+			QGLViewer/quaternion.cpp 
+			QGLViewer/vec.cpp
+			QGLViewer/VRender/BackFaceCullingOptimizer.cpp 
+			QGLViewer/VRender/BSPSortMethod.cpp 
+			QGLViewer/VRender/EPSExporter.cpp 
+			QGLViewer/VRender/Exporter.cpp 
+			QGLViewer/VRender/FIGExporter.cpp 
+			QGLViewer/VRender/gpc.cpp 
+			QGLViewer/VRender/ParserGL.cpp 
+			QGLViewer/VRender/Primitive.cpp 
+			QGLViewer/VRender/PrimitivePositioning.cpp 
+			QGLViewer/VRender/TopologicalSortMethod.cpp 
+			QGLViewer/VRender/VisibilityOptimizer.cpp 
+			QGLViewer/VRender/Vector2.cpp 
+			QGLViewer/VRender/Vector3.cpp 
+			QGLViewer/VRender/NVector3.cpp 
+			QGLViewer/VRender/VRender.cpp
+			'''),
+			# we want to REALLY optimize this, even in debug builds of yade; and suppress all warnings also
+			CXXFLAGS=[x for x in env['CXXFLAGS'] if x not in ['-ggdb3','-g','-pg'] ]+['-O3','-g0','-w'],
+			# HACK: uic generates files in the buildDir, but gcc is invoked on files in the original dir;
+			# since the generated header is #include'd "...", it looks for it in the original dir
+			# no idea why this _does_ work with gui/qt3. Go figure.
+			CPPPATH=env['CPPPATH']+['${TARGET.dir}'],
+			LIBS=env['LIBS']+['GLU','GL']
+		)
+
 yadeStaticOrSharedLib('yade-support',[
 	env.Combine('yade-support.cpp',['base/Math.cpp']+
 		['factory/ClassFactory.cpp','serialization/SerializableSingleton.cpp','factory/DynLibManager.cpp','factory/FactoryExceptions.cpp',


Follow ups