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]) Alias('testrunner',[testrunner])
# GUI # GUI
QTDIR = os.popen('qmake -query QT_INSTALL_DATA').read() emptyEnv = Environment()
pkgpath = os.environ.get("PKG_CONFIG_PATH", "") conf = Configure(emptyEnv)
pkgpath += ":%s/lib/pkgconfig" % QTDIR try:
os.environ["PKG_CONFIG_PATH"] = pkgpath QTDIR = os.popen('qmake -query QT_INSTALL_DATA').read()
os.environ["QTDIR"] = QTDIR pkgpath = os.environ.get("PKG_CONFIG_PATH", "")
guiEnv = libEnv.Clone(tools=["default", "qt4"], toolpath=['.']) pkgpath += ":%s/lib/pkgconfig" % QTDIR
guiEnv.Append(CPPPATH = ['gui']) os.environ["PKG_CONFIG_PATH"] = pkgpath
guiEnv.EnableQt4Modules(["QtGui", "QtCore"]) os.environ["QTDIR"] = QTDIR
rccs = [guiEnv.Qrc("gui/gui.qrc", QT4_QRCFLAGS="-name CppcheckGUI")] guiEnv = libEnv.Clone(tools=["default", "qt4"], toolpath=['.'])
uiFiles = Glob('gui/*.ui') guiEnv.Append(CPPPATH = ['gui'])
uis = [guiEnv.Uic4(ui) for ui in uiFiles] guiEnv.EnableQt4Modules(["QtGui", "QtCore"])
guiFiles = Glob('gui/*.cpp')+libObjects rccs = [guiEnv.Qrc("gui/gui.qrc", QT4_QRCFLAGS="-name CppcheckGUI")]
gui = guiEnv.Program(target="gui_cppcheck", source=[rccs, guiFiles]) uiFiles = Glob('gui/*.ui')
Alias('gui',[gui]) 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 # Execute testrunner
test = AlwaysBuild(Alias("test", testrunner, "./$SOURCE")) test = AlwaysBuild(Alias("test", testrunner, "./$SOURCE"))