Binary installers for Coin3d and SoQt on MinGW
Here are some binary installers for Coin (aka Coin3d) and SoQt for use with the MinGW GCC 3.4.5 compiler. In order to use these, you will first need to install the open source version of Qt 4.3.3:
- <a href="/images/a/af/Coin3d-2.5.0.exe" class="internal" title="Coin3d-2.5.0.exe">coin3d-2.5.0.exe</a> (6M binary installer)
- <a href="/images/b/bd/Soqt-1.4.1.exe" class="internal" title="Soqt-1.4.1.exe">soqt-1.4.1.exe</a> (1.4M binary installer)
These installers were created with NSIS. I can provide the installer scripts to anyone who's interested.
Using SoQt with MinGW
To demonstrate the use of the above binaries, you can compile the following simple example:
//SoQt example #include <Inventor/Qt/SoQt.h> #include <Inventor/Qt/viewers/SoQtExaminerViewer.h> #include <Inventor/nodes/SoCube.h> int main(int argc, char **argv) { // Initialize SoQt and Open Inventor libraries. This returns a main // window to use. QWidget * mainwin = SoQt::init(argv[0]); // Make a dead simple scene graph, only containing a single cube. SoCube * cube = new SoCube; // Use one of the convenient viewer classes. SoQtExaminerViewer * eviewer = new SoQtExaminerViewer(mainwin); eviewer->setSceneGraph(cube); eviewer->setTitle("SoQt example"); eviewer->show(); SoQt::show(mainwin); SoQt::mainLoop(); return 0; }
This may be compiled using the following commands, using the MSYS command-line:
export QTDIR=/c/Qt/4.3.3 export PATH=$PATH/c/PROGRA~1/Coin-2.5.0/bin:/c/Program Files/SoQt-1.4.1/bin:/c/Qt/4.3.3/bin g++ soqtexample.cpp -I/c/Progra~1/SoQt-1.4.1/include -DSOQT_DLL -DCOIN_DLL -I/c/PROGRA~1/Coin-2.5.0/include \ -I/c/PROGRA~1/Coin-2.5.0/include/Inventor/annex -I/c/Qt/4.3.3//include -I/c/Qt/4.3.3//include/Qt -DSOQT_DLL \ -L/c/Progra~1/SoQt-1.4.1/bin -L/c/PROGRA~1/Coin-2.5.0/bin -L/c/Qt/4.3.3/bin \ -lSoQt -lQtOpenGL4 -lQtGui4 -lQtCore4 -lQt3Support4 -lCoin -lopengl32 -lgdi32 -lwinmm -luser32
Note that it should be possible to do the above using just g++ soqtexample.cpp `soqt-config --libs --cppflags --ldflags`, however a problem with the presence of spaces in the output from the soqt-config script causes problems.
You can then run the resulting ./a.exe program, which will appear as shown below.
Cross-platform build script
Here is a minimal build script that allows the above program to be build on both Windows and Linux using the Scons build tool. Note that on Linux, we can make use of the 'soqt-config' script to detect compile-time settings for this library.
import platform if platform.system()=="Windows": t=['mingw'] else: t=['default'] env = Environment(tools=t) if platform.system()=="Windows": env.Append( LIBS = ['SoQt','Coin'] ,CPPPATH = ['c:/Qt/4.3.3/include' ,'c:/Qt/4.3.3/include/Qt' ,'c:/PROGRA~1/Coin-2.5.0/include' ,'c:/PROGRA~1/SoQt-1.4.1/include' ,'c:/PROGRA~1/Coin-2.5.0/include/Inventor/annex' ] ,LIBPATH = ['c:/PROGRA~1/SoQt-1.4.1/lib','c:/PROGRA~1/Coin-2.5.0/lib' ,'c:/Qt/4.3.3/lib' ] ,CPPDEFINES = ['COIN_DLL','SOQT_DLL'] ) else: env.ParseConfig(['soqt-config --cppflags --ldflags --libs']) env.Program('soqtexample',['soqtexample.cpp'])
SCons 'tool' for detecting SoQt/Coin
The following rather more rigorous detection script works on Windows with the above MinGW binaries for SoQt/Coin3D as well as on Linux. Note that on Windows, it will happily detect if you installed SoQt or Coin3D in non-standard locations by using the Windows registry, but that it is hard-wired for the c:\Qt\4.3.3 folder in the case of Qt.
import os, platform from SCons.Script import * def generate(env): """ Detect SOQT settings and add them to the environment. """ try: if platform.system()=="Windows": import _winreg x=_winreg.ConnectRegistry(None,_winreg.HKEY_LOCAL_MACHINE) y= _winreg.OpenKey(x,r"SOFTWARE\soqt") LIB,t = _winreg.QueryValueEx(y,"INSTALL_LIB") BIN,t = _winreg.QueryValueEx(y,"INSTALL_BIN") INCLUDE,t = _winreg.QueryValueEx(y,"INSTALL_INCLUDE") env['SOQT_CPPPATH'] = [INCLUDE] env['SOQT_LIBPATH'] = [LIB] env['SOQT_LIBS'] = ['SoQt'] env['SOQT_CPPDEFINES'] = ['SOQT_DLL'] x=_winreg.ConnectRegistry(None,_winreg.HKEY_LOCAL_MACHINE) y= _winreg.OpenKey(x,r"SOFTWARE\coin3d") LIB,t = _winreg.QueryValueEx(y,"INSTALL_LIB") BIN,t = _winreg.QueryValueEx(y,"INSTALL_BIN") INCLUDE,t = _winreg.QueryValueEx(y,"INSTALL_INCLUDE") env.AppendUnique( SOQT_CPPPATH = [INCLUDE] ,SOQT_LIBPATH = [LIB] ,SOQT_LIBS = ['Coin'] ,SOQT_CPPDEFINES = ['COIN_DLL'] ) env.AppendUnique( QT_PREFIX = r'c:/Qt/4.3.3' ,SOQT_CPPPATH = ["$QT_PREFIX/include","$QT_PREFIX/include/Qt"] ,SOQT_LIBPATH = ["$QT_PREFIX/lib"] ) else: cmd = ['soqt-config','--cppflags','--ldflags','--libs'] env1 = env.Copy() env1.ParseConfig(cmd) env['SOQT_CPPPATH'] = env1.get('CPPPATH') env['SOQT_LIBPATH'] = env1.get('LIBPATH') env['SOQT_LIBS'] = env1.get('LIBS') print "SOQT_LIBS =",env.get('SOQT_LIBS') print "SOQT_LIBPATH =",env.get('SOQT_LIBPATH') print "SOQT_CPPPATH =",env.get('SOQT_CPPPATH') except: print "FAILED TO SET UP SOQT" pass def exists(env): """ Make sure this tool exists. """ if platform.system()=="Windows": try: import _winreg x=_winreg.ConnectRegistry(None,_winreg.HKEY_LOCAL_MACHINE) y= _winreg.OpenKey(x,r"SOFTWARE\soqt") INCLUDE,t = _winreg.QueryValueEx(y,'INSTALL_INCLUDE') return True except: return False else: if env.Which('soqt-config'): return True return False
Here is an example of how to use the 'soqt.py' tool with SCons to build a simple SoQt app:
ctools=['default'] if platform.system()=="Windows": ctools=['mingw'] env = Environment( , toolpath=['.'] , tools=ctools+['soqt'] ) env.AppendUnique( LIBS = env.get('SOQT_LIBS') ,CPPPATH = env.get('SOQT_CPPPATH') ,LIBPATH = env.get('SOQT_LIBPATH') ,CPPDEFINES = env.get('SOQT_CPPDEFINES') ) env.Program('mysoqtapp',['mysoqtapp.cpp'])
