Fix scons for Andre's Resource.cpp change

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21041 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Bo Peng 2007-10-18 18:32:09 +00:00
parent 7deaa64d7e
commit c67b21683d
2 changed files with 18 additions and 3 deletions

View File

@ -1294,6 +1294,7 @@ if platform_name == 'cygwin':
# #
if frontend == 'qt4': if frontend == 'qt4':
frontend_env = env.Copy() frontend_env = env.Copy()
frontend_env['BUILDERS']['qtResource'] = Builder(action = utils.env_qtResource)
# handle qt related user specified paths # handle qt related user specified paths
# set environment so that moc etc can be found even if its path is not set properly # set environment so that moc etc can be found even if its path is not set properly
@ -1565,15 +1566,18 @@ frontend_env['QT4_MOCHSUFFIX'] = '_moc.cpp'
# (or are actually generated). # (or are actually generated).
qt4_moced_files = [frontend_env.Moc4('$BUILDDIR/src/frontends/qt4/%s' % x) qt4_moced_files = [frontend_env.Moc4('$BUILDDIR/src/frontends/qt4/%s' % x)
for x in src_frontends_qt4_header_files ] for x in src_frontends_qt4_header_files ]
resources = [frontend_env.Uic4('$BUILDDIR/src/frontends/qt4/ui/%s' % x.split('.')[0]) ui_files = [frontend_env.Uic4('$BUILDDIR/src/frontends/qt4/ui/%s' % x.split('.')[0])
for x in src_frontends_qt4_ui_files] for x in src_frontends_qt4_ui_files]
resource = frontend_env.Qrc(frontend_env.qtResource(
'$BUILDDIR/src/frontends/qt4/Resource.qrc',
['$TOP_SRCDIR/lib/images/%s' % x for x in lib_images_files] +
['$TOP_SRCDIR/lib/images/math/%s' % x for x in lib_images_math_files]))
# #
# moc qt4_moc_files, the moced files are included in the original files # moc qt4_moc_files, the moced files are included in the original files
# #
qt4 = frontend_env.StaticLibrary( qt4 = frontend_env.StaticLibrary(
target = '$LOCALLIBPATH/qt4', target = '$LOCALLIBPATH/qt4',
source = ['$BUILDDIR/src/frontends/qt4/%s' % x for x in src_frontends_qt4_files], source = ['$BUILDDIR/src/frontends/qt4/%s' % x for x in src_frontends_qt4_files] + resource,
CPPPATH = [ CPPPATH = [
'$CPPPATH', '$CPPPATH',
'$BUILDDIR/src', '$BUILDDIR/src',

View File

@ -186,6 +186,17 @@ def createResFromIcon(env, icon_file, rc_file):
return [] return []
def env_qtResource(target, source, env):
'''Create resource.qrc'''
qrc = open(str(target[0]), 'w')
print >> qrc, "<!DOCTYPE RCC><RCC version='1.0'><qresource>"
for file in source:
rel_file = relativePath(str(file), env.subst('$TOP_SRCDIR/lib'))
abs_file = str(file.abspath)
print >> qrc, '<file alias="%s">%s</file>' % (rel_file, abs_file)
print >> qrc, '</qresource></RCC>'
qrc.close()
# #
# autoconf tests # autoconf tests
# #