Scons: add qt2 frontend for lyx1.4

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14096 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Bo Peng 2006-06-13 14:16:54 +00:00
parent bbc587ee9a
commit 56134789f7
2 changed files with 163 additions and 70 deletions

View File

@ -36,6 +36,7 @@ build_tex2lyx = True in ['tex2lyx' in x for x in targets] \
or 'install' in targets or 'all' in targets or 'install' in targets or 'all' in targets
build_lyxbase = build_lyx or 'lyxbase' in targets build_lyxbase = build_lyx or 'lyxbase' in targets
build_po = 'po' in targets or 'install' in targets or 'all' in targets build_po = 'po' in targets or 'install' in targets or 'all' in targets
build_qt2 = (build_lyx and env['frontend'] == 'qt2') or 'qt2' in targets
build_qt3 = (build_lyx and env['frontend'] == 'qt3') or 'qt3' in targets build_qt3 = (build_lyx and env['frontend'] == 'qt3') or 'qt3' in targets
build_qt4 = (build_lyx and env['frontend'] == 'qt4') or 'qt4' in targets build_qt4 = (build_lyx and env['frontend'] == 'qt4') or 'qt4' in targets
build_msvs_projects = env['USE_VC'] and 'msvs_projects' in targets build_msvs_projects = env['USE_VC'] and 'msvs_projects' in targets
@ -63,11 +64,15 @@ if rebuild_targets:
build_graphics = ifBuildLib('graphics', 'graphics', build_graphics) build_graphics = ifBuildLib('graphics', 'graphics', build_graphics)
build_controllers = ifBuildLib('controllers', 'controllers', build_controllers) build_controllers = ifBuildLib('controllers', 'controllers', build_controllers)
build_lyxbase = ifBuildLib('lyxbase', 'lyxbase_pre', build_lyxbase) build_lyxbase = ifBuildLib('lyxbase', 'lyxbase_pre', build_lyxbase)
build_qt2 = ifBuildLib('qt2', 'qt2', build_qt2)
build_qt3 = ifBuildLib('qt3', 'qt3', build_qt3) build_qt3 = ifBuildLib('qt3', 'qt3', build_qt3)
build_qt4 = ifBuildLib('qt4', 'qt4', build_qt4) build_qt4 = ifBuildLib('qt4', 'qt4', build_qt4)
# sync frontend and env['frontend'] (maybe build qt4 with frontend=qt3) # sync frontend and env['frontend'] (maybe build qt4 with frontend=qt3)
if build_qt3: if build_qt2:
frontend = 'qt2'
env['frontend'] = 'qt2'
elif build_qt3:
frontend = 'qt3' frontend = 'qt3'
env['frontend'] = 'qt3' env['frontend'] = 'qt3'
elif build_qt4: elif build_qt4:
@ -87,41 +92,19 @@ if build_boost:
boostenv = env.Copy() boostenv = env.Copy()
boostenv.AppendUnique(CCFLAGS = '-DBOOST_USER_CONFIG="<config.h>"') boostenv.AppendUnique(CCFLAGS = '-DBOOST_USER_CONFIG="<config.h>"')
print 'Processing files in boost/libs/filesystem/src...' for lib in ['filesystem', 'regex', 'signals', 'iostreams']:
# lyx 1.4 does not have iostreams
if not os.path.isdir(os.path.join(env.subst('$TOP_SRC_DIR'), 'boost', 'libs', lib)):
continue
print 'Processing files in boost/libs/%s/src...' % lib
filesystem = boostenv.StaticLibrary( boostlib = boostenv.StaticLibrary(
target = '$LOCALLIBPATH/included_boost_filesystem', target = '$LOCALLIBPATH/included_boost_%s' % lib,
source = globSource(dir = env.subst('$TOP_SRC_DIR/boost/libs/filesystem/src'), source = globSource(dir = env.subst('$TOP_SRC_DIR/boost/libs/%s/src' % lib),
pattern = '*.cpp', build_dir = '$BUILDDIR/boost/filesystem/src') pattern = '*.cpp', build_dir = '$BUILDDIR/boost/%s/src' % lib)
) )
Alias('boost', boostlib)
print 'Processing files in boost/libs/regex/src...'
regex = boostenv.StaticLibrary(
target = '$LOCALLIBPATH/included_boost_regex',
source = globSource(dir = env.subst('$TOP_SRC_DIR/boost/libs/regex/src'),
pattern = '*.cpp', build_dir = '$BUILDDIR/boost/regex/src')
)
print 'Processing files in boost/libs/signals/src...'
signals = boostenv.StaticLibrary(
target = '$LOCALLIBPATH/included_boost_signals',
source = globSource(dir = env.subst('$TOP_SRC_DIR/boost/libs/signals/src'),
pattern = '*.cpp', build_dir = '$BUILDDIR/boost/signals/src')
)
print 'Processing files in boost/libs/iostreams/src...'
iostreams = boostenv.StaticLibrary(
target = '$LOCALLIBPATH/included_boost_iostreams',
source = globSource(dir = env.subst('$TOP_SRC_DIR/boost/libs/iostreams/src'),
pattern = '*.cpp', build_dir = '$BUILDDIR/boost/iostreams/src')
)
Alias('boost', filesystem)
Alias('boost', regex)
Alias('boost', signals)
Alias('boost', iostreams)
if build_intl: if build_intl:
@ -186,7 +169,7 @@ if build_support:
support = env.StaticLibrary( support = env.StaticLibrary(
target = '$LOCALLIBPATH/support', target = '$LOCALLIBPATH/support',
source = globSource(dir = env.subst('$TOP_SRC_DIR/src/support'), pattern = env['LYX_EXT'], source = globSource(dir = env.subst('$TOP_SRC_DIR/src/support'), pattern = env['LYX_EXT'],
exclude = ['os_win32.C', 'os_unix.C', 'os_cygwin.C', 'atexit.c'], exclude = ['os_win32.C', 'os_unix.C', 'os_cygwin.C', 'os_os2.C', 'atexit.c'],
include = ['package.C'], build_dir = '$BUILDDIR/common/support') include = ['package.C'], build_dir = '$BUILDDIR/common/support')
) )
Alias('support', support) Alias('support', support)
@ -264,11 +247,109 @@ if build_controllers:
# #
# src/frontend/qt3/4 # src/frontend/qt2/3/4
# #
if build_qt3 or build_qt4: if build_qt2 or build_qt3 or build_qt4:
env.BuildDir('$BUILDDIR/$frontend', '$TOP_SRC_DIR/src/frontend/$frontend', duplicate = 0) env.BuildDir('$BUILDDIR/$frontend', '$TOP_SRC_DIR/src/frontend/$frontend', duplicate = 0)
if build_qt2:
print "Processing files in src/frontends/qt2..."
qt2env = env.Copy()
# disable auto scan to speed up non build time
qt2env['QT_AUTOSCAN'] = 0
qt2env['QT_MOCHPREFIX'] = ''
# load qt2 tools
qt2env.Tool('qt')
qt2env.AppendUnique(CPPPATH = [
'$BUILDDIR/common',
'$BUILDDIR/common/images',
'$BUILDDIR/common/frontends',
'$BUILDDIR/common/frontends/qt2',
'$BUILDDIR/common/frontends/controllers',
'$QT_INC_PATH']
)
qt2_moc_files = ["$BUILDDIR/common/frontends/qt2/%s" % x for x in Split('''
BulletsModule.C
emptytable.C
FileDialog_private.C
floatplacement.C
iconpalette.C
lengthcombo.C
panelstack.C
QAboutDialog.C
QBibitemDialog.C
QBibtexDialog.C
QBoxDialog.C
QBranchDialog.C
QBrowseBox.C
QChangesDialog.C
QCharacterDialog.C
QCitationDialog.C
QCommandBuffer.C
QCommandEdit.C
QContentPane.C
QDelimiterDialog.C
QDocumentDialog.C
QErrorListDialog.C
QERTDialog.C
QExternalDialog.C
QFloatDialog.C
QGraphicsDialog.C
QIncludeDialog.C
QIndexDialog.C
QLogDialog.C
QLPopupMenu.C
QLPrintDialog.C
QMathDialog.C
QMathMatrixDialog.C
QNoteDialog.C
QParagraphDialog.C
QPrefsDialog.C
QRefDialog.C
QSearchDialog.C
QSendtoDialog.C
qsetborder.C
QShowFileDialog.C
QSpellcheckerDialog.C
QDialogView.C
QTabularCreateDialog.C
QTabularDialog.C
QTexinfoDialog.C
QThesaurusDialog.C
QTocDialog.C
qttableview.C
QtView.C
QURLDialog.C
QVSpaceDialog.C
QWrapDialog.C
QLToolbar.C
socket_callback.C
validators.C
''')]
# manually moc and uic files for better performance
qt2_moced_files = [qt2env.Moc(x.replace('.C', '_moc.cpp'), x.replace('.C', '.h')) for x in qt2_moc_files]
qt2_uiced_files = [qt2env.Uic('$BUILDDIR/common/frontends/qt2/ui/'+x) for x in \
globSource(dir = env.subst('$TOP_SRC_DIR/src/frontends/qt2/ui'), pattern = '*.ui')]
qt2_uiced_cc_files = []
for x in qt2_uiced_files:
qt2_uiced_cc_files.extend(x[1:])
qt2 = qt2env.StaticLibrary(
target = '$LOCALLIBPATH/qt2',
source = globSource(dir = env.subst('$TOP_SRC_DIR/src/frontends/qt2/'), pattern = env['LYX_EXT'],
build_dir = '$BUILDDIR/common/frontends/qt2') + qt2_moced_files + qt2_uiced_cc_files
)
Alias('qt2', qt2)
if build_qt3: if build_qt3:
print "Processing files in src/frontends/qt3..." print "Processing files in src/frontends/qt3..."

View File

@ -23,7 +23,8 @@
# default to lyx, you can use 'scons all' to build all targets except # default to lyx, you can use 'scons all' to build all targets except
# for install # for install
# * options: use scons -h for details about options, the most important # * options: use scons -h for details about options, the most important
# one is frontend=qt3|qt4. # one is frontend=qt2|qt3|qt4.
# - qt2 is used by lyx1.4.x
# - qt3 is used by default on linux, cygwin and mac # - qt3 is used by default on linux, cygwin and mac
# - qt4 is used by default on win32/mingw # - qt4 is used by default on win32/mingw
# #
@ -102,7 +103,14 @@ else:
#---------------------------------------------------------- #----------------------------------------------------------
# some global settings # some global settings
PACKAGE_VERSION = '1.5.0svn' #
# detect version of lyx
# only 1.4.x has frontends/qt2
if os.path.isdir(os.path.join(TOP_SRC_DIR, 'src', 'frontends', 'qt2')):
PACKAGE_VERSION = '1.4.2svn'
else:
PACKAGE_VERSION = '1.5.0svn'
DEVEL_VERSION = True DEVEL_VERSION = True
default_build_mode = 'debug' default_build_mode = 'debug'
lyx_ext = '*.C' lyx_ext = '*.C'
@ -209,7 +217,7 @@ opts = Options(['config.py'])
opts.AddOptions( opts.AddOptions(
# frontend, # frontend,
EnumOption('frontend', 'Main GUI', default_frontend, EnumOption('frontend', 'Main GUI', default_frontend,
allowed_values = ('xform', 'qt3', 'qt4', 'gtk') ), allowed_values = ('xform', 'qt2', 'qt3', 'qt4', 'gtk') ),
# debug or release build # debug or release build
EnumOption('mode', 'Building method', default_build_mode, EnumOption('mode', 'Building method', default_build_mode,
allowed_values = ('debug', 'release') ), allowed_values = ('debug', 'release') ),
@ -328,7 +336,7 @@ if (not ARGUMENTS.has_key('load_option') or \
opt_cache.pop('qt_dir') opt_cache.pop('qt_dir')
# some options will require full rebuild # some options will require full rebuild
# these are in general things that will change src/config.h # these are in general things that will change src/config.h
for arg in ['version_suffix', 'nls']: for arg in ['version_suffix', 'nls', 'boost']:
if ARGUMENTS.has_key(arg) and ((not opt_cache.has_key(arg)) or \ if ARGUMENTS.has_key(arg) and ((not opt_cache.has_key(arg)) or \
ARGUMENTS[arg] != opt_cache[arg]): ARGUMENTS[arg] != opt_cache[arg]):
if fast_start: if fast_start:
@ -336,7 +344,7 @@ if (not ARGUMENTS.has_key('load_option') or \
print print
fast_start = False fast_start = False
# and we do not cache some options # and we do not cache some options
for arg in ['fast_start']: for arg in ['fast_start', 'load_option']:
if opt_cache.has_key(arg): if opt_cache.has_key(arg):
opt_cache.pop(arg) opt_cache.pop(arg)
for key in opt_cache.keys(): for key in opt_cache.keys():
@ -595,7 +603,7 @@ if not fast_start:
if not fast_start: if not fast_start:
# #
# qt3 does not use pkg_config # qt3 does not use pkg_config
if frontend == 'qt3': if frontend in ['qt2', 'qt3']:
if not conf.CheckLibWithHeader('qt-mt', 'qapp.h', 'c++', 'QApplication qapp();'): if not conf.CheckLibWithHeader('qt-mt', 'qapp.h', 'c++', 'QApplication qapp();'):
print 'Did not find qt libraries, exiting!' print 'Did not find qt libraries, exiting!'
Exit(1) Exit(1)
@ -653,34 +661,38 @@ if not fast_start:
# check boost libraries # check boost libraries
boost_opt = ARGUMENTS.get('boost', default_boost_opt) boost_opt = ARGUMENTS.get('boost', default_boost_opt)
# check for system boost # check for system boost
succ = False paths = env['LIBPATH'] + ['/usr/lib', '/usr/local/lib']
env['BOOST_LIBRARIES'] = []
boost_libpath = None boost_libpath = None
if boost_opt in ['auto', 'system']: # here I assume that all libraries are in the same directory
paths = env['LIBPATH'] + ['/usr/lib', '/usr/local/lib'] for lib in ['signals', 'regex', 'filesystem', 'iostreams']:
sig = conf.CheckBoostLibraries('boost_signals', paths) # lyx1.4 does not use iostreams
reg = conf.CheckBoostLibraries('boost_regex', paths) if not os.path.isdir(os.path.join(env.subst('$TOP_SRC_DIR'), 'boost', 'libs', lib)):
fil = conf.CheckBoostLibraries('boost_filesystem', paths) continue
ios = conf.CheckBoostLibraries('boost_iostreams', paths) if boost_opt == 'included':
# if any of them is not found env['BOOST_LIBRARIES'].append('included_boost_%s' % lib)
if ('' in [sig[0], reg[0], fil[0], ios[0]]): env['INCLUDED_BOOST'] = True
if boost_opt == 'system': elif boost_opt == 'auto':
res = conf.CheckBoostLibraries('boost_%s' % lib , paths)
# if not found
if res[0] == '':
env['BOOST_LIBRARIES'].append('included_boost_%s' % lib)
env['INCLUDED_BOOST'] = True
else:
env['BOOST_LIBRARIES'].append(res[1])
env['INCLUDED_BOOST'] = False
boost_libpath = res[0]
elif boost_opt == 'system':
res = conf.CheckBoostLibraries('boost_%s' % lib , paths)
if res[0] == '':
print "Can not find system boost libraries" print "Can not find system boost libraries"
print "Please supply a path through extra_lib_path and try again." print "Please supply a path through extra_lib_path and try again."
print "Or use boost=included to use included boost libraries." print "Or use boost=included to use included boost libraries."
Exit(2) Exit(2)
else: else:
env['BOOST_LIBRARIES'] = [sig[1], reg[1], fil[1], ios[1]] env['BOOST_LIBRARIES'].append(res[1])
# assume all boost libraries are in the same path... env.AppendUnique(LIBPATH = [res[0]])
boost_libpath = sig[0] boost_libpath = res[0]
env.AppendUnique(LIBPATH = [sig[0]])
env['INCLUDED_BOOST'] = False
succ = True
# now, auto and succ = false, or boost=included
if not succ:
# we do not need to set LIBPATH now.
env['BOOST_LIBRARIES'] = ['included_boost_signals', 'included_boost_regex',
'included_boost_filesystem', 'included_boost_iostreams']
env['INCLUDED_BOOST'] = True
env_cache['BOOST_LIBRARIES'] = env['BOOST_LIBRARIES'] env_cache['BOOST_LIBRARIES'] = env['BOOST_LIBRARIES']
env_cache['INCLUDED_BOOST'] = env['INCLUDED_BOOST'] env_cache['INCLUDED_BOOST'] = env['INCLUDED_BOOST']
env_cache['BOOST_LIBPATH'] = boost_libpath env_cache['BOOST_LIBPATH'] = boost_libpath
@ -804,7 +816,7 @@ if not fast_start:
('alloca.h', 'HAVE_ALLOCA_H', 'c'), ('alloca.h', 'HAVE_ALLOCA_H', 'c'),
('stddef.h', 'HAVE_STDDEF_H', 'c'), ('stddef.h', 'HAVE_STDDEF_H', 'c'),
('stdint.h', 'HAVE_STDINT_H', 'c'), ('stdint.h', 'HAVE_STDINT_H', 'c'),
('sys/param.h', 'HAVE_SYS_PARAM_H', 'c') ('sys/param.h', 'HAVE_SYS_PARAM_H', 'c'),
] ]
for header in headers: for header in headers:
@ -1180,7 +1192,7 @@ env = conf.Finish()
# NOTE: Tool('qt') or Tool('qt4') will be loaded later # NOTE: Tool('qt') or Tool('qt4') will be loaded later
# in their respective directory and specialized env. # in their respective directory and specialized env.
try: try:
if frontend == 'qt3': if frontend in ['qt2', 'qt3']:
# note: env.Tool('qt') my set QT_LIB to qt # note: env.Tool('qt') my set QT_LIB to qt
env['QT_LIB'] = 'qt-mt' env['QT_LIB'] = 'qt-mt'
env['FRONTEND_LIBS'] = ['qt-mt'] env['FRONTEND_LIBS'] = ['qt-mt']
@ -1316,7 +1328,7 @@ Frontend:
env['frontend'], packaging_method, env['frontend'], packaging_method,
env['PREFIX'], env['BIN_DEST_DIR'], env['SHARE_DIR']) env['PREFIX'], env['BIN_DEST_DIR'], env['SHARE_DIR'])
if env['frontend'] in ['qt3', 'qt4']: if env['frontend'] in ['qt2', 'qt3', 'qt4']:
env['VERSION_INFO'] += ''' include dir: %s env['VERSION_INFO'] += ''' include dir: %s
library dir: %s library dir: %s
X11: %s X11: %s