More bugs fixes to scons system, and finer target control.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13834 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Bo Peng 2006-05-11 17:20:25 +00:00
parent 93adc6658e
commit e1a132eda7
2 changed files with 567 additions and 518 deletions

View File

@ -12,10 +12,29 @@ import os, sys
Import('env')
targets = env['BUILD_TARGETS']
if targets == [] or 'lyx' in targets:
targets += ['supports', 'mathed', 'insets', 'frontends', \
'graphics', 'controllers', env['frontend'], 'lyx']
if env['INCLUDED_BOOST']:
targets.append('boost')
elif 'client' in targets:
targets.append('supports')
if env['INCLUDED_BOOST']:
targets.append('boost')
elif 'tex2lyx' in targets:
targets.append('supports')
if env['INCLUDED_BOOST']:
targets.append('boost')
# unique target in the set (then I will need python 2.4)
#targets = set(targets)
#
# boost libraries
#
if env['INCLUDED_BOOST']:
if env['INCLUDED_BOOST'] or 'boost' in targets:
env.BuildDir('$BUILDDIR/boost', '$TOP_SRC_DIR/boost/libs', duplicate = 0)
boostenv = env.Copy()
@ -75,7 +94,10 @@ if env['INCLUDED_BOOST']:
zlib.cpp
''') ]
)
Alias('boost', filesystem)
Alias('boost', regex)
Alias('boost', signals)
Alias('boost', iostreams)
#
# Now, src code under src/
@ -87,6 +109,7 @@ env.BuildDir('$BUILDDIR/common', '$TOP_SRC_DIR/src', duplicate = 0)
# src/support
#
if 'supports' in targets:
print "Processing files in src/support"
env.Append(CPPPATH = ['.'])
@ -127,11 +150,13 @@ supports = env.StaticLibrary(
unlink.C
''')]
)
Alias('supports', supports)
#
# src/mathed
#
if 'mathed' in targets:
print "Processing files in src/mathed"
mathed = env.StaticLibrary(
@ -211,7 +236,10 @@ mathed = env.StaticLibrary(
ref_inset.C
''')]
)
Alias('mathed', mathed)
if 'insets' in targets:
#
# src/insets
#
@ -273,7 +301,7 @@ insets = env.StaticLibrary(
''')]
)
if 'frontends' in targets:
#
# src/frontends
#
@ -294,8 +322,10 @@ frontends = env.StaticLibrary(
screen.C
''')]
)
Alias('frontends', frontends)
if 'graphics' in targets:
#
# src/graphics
#
@ -318,7 +348,10 @@ graphics = env.StaticLibrary(
Previews.C
''')]
)
Alias('graphics', graphics)
if 'controllers' in targets:
#
# src/frontends/controllers
#
@ -377,14 +410,22 @@ controllers = env.StaticLibrary(
helper_funcs.h
''')]
)
Alias('controllers', controllers)
#
# src/frontend/qt3/4
#
if env['frontend'] in targets:
frontend = env['frontend']
env.BuildDir('$BUILDDIR/$frontend', '$TOP_SRC_DIR/src/frontend/$frontend', duplicate = 0)
else:
# frontend is qt3, but specify target qt4, OK
if 'qt3' in targets:
frontned = 'qt3'
elif 'qt4' in targets:
frontend = 'qt4'
else:
frontend = None
if frontend == 'qt3':
print "Processing files in src/frontends/qt3"
@ -397,11 +438,11 @@ if frontend == 'qt3':
qt3env.Append(CPPPATH = [
'$BUILDDIR/common',
'$BUILDDIR/common/frontends',
'$BUILDDIR/common/frontends/qt3',
'$BUILDDIR/common/images',
'$BUILDDIR/common/frontends/controllers',
'$BUILDDIR/common/frontends/qt3',
'$QT_INC_DIR',
'.']
'$QT_INC_DIR']
)
qt3_ui_files = Split('''
@ -543,7 +584,7 @@ if frontend == 'qt3':
# file extension from .C to .cpp
qt3_moced_files = []
if os.name == 'nt' or sys.platform == 'cygwin':
qt3_moced_files = [qt3env.Moc('$BUILDDIR/common/frontends/qt3/'+x.replace('.C', '.h')) for x in qt3_moc_files]
qt3_moced_files = [qt3env.Moc(x.replace('.C', '.h')) for x in qt3_moc_files]
qt3 = qt3env.StaticLibrary(
target = '$LOCALLIBPATH/qt3',
@ -612,6 +653,9 @@ if frontend == 'qt3':
qt3_moc_files + qt3_moced_files +
['$BUILDDIR/common/frontends/qt3/ui/' + x for x in qt3_ui_files]
)
Alias('qt3', qt3)
elif frontend == 'qt4':
print "Processing files in src/frontends/qt4"
@ -623,7 +667,6 @@ elif frontend == 'qt4':
# NOTE: I have to patch qt4.py since it does not automatically
# process .C file!!! (add to cxx_suffixes )
#
if frontend == 'qt4':
qt4env.Tool('qt4', [env['SCONS_DIR']])
qt4env.EnableQt4Modules(env['QT_LIB'], debug = False)
@ -860,17 +903,18 @@ elif frontend == 'qt4':
source = ["$BUILDDIR/common/frontends/qt4/%s" % x for x in qt4_source_files] + \
["$BUILDDIR/common/frontends/qt4/%s" % x for x in qt4_moc_files]
)
Alias('qt4', qt4)
if 'client' in targets:
#
# src/client
#
env.BuildDir('$BUILDDIR/common', '$TOP_SRC_DIR/src', duplicate = 0)
print "Processing files in src/client"
lyxclient = env.Program(
client = env.Program(
target = '$BUILDDIR/common/client/lyxclient',
LIBS = env['BOOST_LIBRARIES'] + env['socket_libs'] + ['supports'],
source = ["$BUILDDIR/common/client/%s" % x for x in Split('''
@ -882,8 +926,10 @@ lyxclient = env.Program(
''')]
)
env.fileCopy('$BUILDDIR/lyxclient', '$BUILDDIR/common/client/lyxclient')
Alias('lyxclient', lyxclient)
Alias('client', client)
if 'tex2lyx' in targets:
#
# tex2lyx
#
@ -935,6 +981,7 @@ Alias('tex2lyx', tex2lyx)
# src/
#
if 'lyx' in targets:
print "Processing files in src"
env['SUBST_KEYS'] = ['PACKAGE_VERSION', 'VERSION_INFO']
@ -1079,6 +1126,7 @@ lyx = env.Program(
)
Alias('lyx', lyx)
if 'install' in targets:
env.fileCopy('$BUILDDIR/lyx$frontend', '$BUILDDIR/$frontend/lyx')
# other targets include client, tex2lyx

View File

@ -885,7 +885,6 @@ opts.Save('options.cache', env)
Help(opts.GenerateHelpText(env))
#----------------------------------------------------------
# Start building
#----------------------------------------------------------
@ -893,6 +892,8 @@ Export('env')
SConsignFile(os.path.abspath('%s/sconsign' % env['BUILDDIR']))
env['BUILD_TARGETS'] = BUILD_TARGETS
print "Building all targets recursively"
env.SConscript('$SCONS_DIR/SConscript', duplicate = 0)