SConstruct, fix compiling on systems where qt4 is not installed

This commit is contained in:
Reijo Tomperi 2010-02-19 22:47:37 +02:00
parent fce0cb80a2
commit 50b5278315
1 changed files with 21 additions and 14 deletions

View File

@ -42,20 +42,27 @@ testrunner = testEnv.Program('testrunner', testFiles)
Alias('testrunner',[testrunner])
# GUI
QTDIR = os.popen('qmake -query QT_INSTALL_DATA').read()
pkgpath = os.environ.get("PKG_CONFIG_PATH", "")
pkgpath += ":%s/lib/pkgconfig" % QTDIR
os.environ["PKG_CONFIG_PATH"] = pkgpath
os.environ["QTDIR"] = QTDIR
guiEnv = libEnv.Clone(tools=["default", "qt4"], toolpath=['.'])
guiEnv.Append(CPPPATH = ['gui'])
guiEnv.EnableQt4Modules(["QtGui", "QtCore"])
rccs = [guiEnv.Qrc("gui/gui.qrc", QT4_QRCFLAGS="-name CppcheckGUI")]
uiFiles = Glob('gui/*.ui')
uis = [guiEnv.Uic4(ui) for ui in uiFiles]
guiFiles = Glob('gui/*.cpp')+libObjects
gui = guiEnv.Program(target="gui_cppcheck", source=[rccs, guiFiles])
Alias('gui',[gui])
emptyEnv = Environment()
conf = Configure(emptyEnv)
try:
QTDIR = os.popen('qmake -query QT_INSTALL_DATA').read()
pkgpath = os.environ.get("PKG_CONFIG_PATH", "")
pkgpath += ":%s/lib/pkgconfig" % QTDIR
os.environ["PKG_CONFIG_PATH"] = pkgpath
os.environ["QTDIR"] = QTDIR
guiEnv = libEnv.Clone(tools=["default", "qt4"], toolpath=['.'])
guiEnv.Append(CPPPATH = ['gui'])
guiEnv.EnableQt4Modules(["QtGui", "QtCore"])
rccs = [guiEnv.Qrc("gui/gui.qrc", QT4_QRCFLAGS="-name CppcheckGUI")]
uiFiles = Glob('gui/*.ui')
uis = [guiEnv.Uic4(ui) for ui in uiFiles]
guiFiles = Glob('gui/*.cpp')+libObjects
gui = guiEnv.Program(target="gui_cppcheck", source=[rccs, guiFiles])
Alias('gui',[gui])
except:
gui = Alias('gui','')
if 'gui' in COMMAND_LINE_TARGETS:
print "Qt4 not found. It is required for gui"
# Execute testrunner
test = AlwaysBuild(Alias("test", testrunner, "./$SOURCE"))