From 4b5fae61d3ab116fdf766fde5d2655416bf6e90f Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Mon, 8 May 2006 21:03:01 +0000 Subject: [PATCH] Some fixes to the scons-based building sytem, from Bo Peng (ben.bob@gmail.com) * SConstruct: add extra_inc_path1, fix mingw logged spawn, try to handle QtCore4 etc * src/SConscript: remove lyx_base library * src/frontends/qt4/SConscript: remove some extra files * Move scons_utils.py and qt4.py to config directory git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13813 a592a061-630c-0410-9148-cb99ea01b6c8 --- SConstruct | 24 +++++++++++++++++++----- qt4.py => config/qt4.py | 16 ++++++++-------- scons_utils.py => config/scons_utils.py | 17 +++++++++++------ src/SConscript | 11 ++--------- src/frontends/qt4/SConscript | 5 +---- 5 files changed, 41 insertions(+), 32 deletions(-) rename qt4.py => config/qt4.py (97%) rename scons_utils.py => config/scons_utils.py (99%) diff --git a/SConstruct b/SConstruct index 956e0d2e06..debe41c47c 100644 --- a/SConstruct +++ b/SConstruct @@ -35,6 +35,7 @@ # # * use extra_inc_path, extra_lib_path, qt_dir, qt_inc_path # qt_lib_path to help locate qt and other libraries +# (there are extra_inc_path1, extra_lib_path1 for now) # # * (Important) use scons logfile=logfile.log to enable command line # logging. (default is no logging) @@ -63,7 +64,8 @@ import os, sys -# scons_util defines a few utility function +# config/scons_utils.py defines a few utility function +sys.path.append('config') import scons_utils as utils #---------------------------------------------------------- @@ -205,6 +207,8 @@ opts.AddOptions( # extra include and libpath PathOption('extra_inc_path', 'Extra include path', '.'), PathOption('extra_lib_path', 'Extra library path', '.'), + PathOption('extra_inc_path1', 'Extra include path', '.'), + PathOption('extra_lib_path1', 'Extra library path', '.'), # enable assertion, (config.h has ENABLE_ASSERTIOS BoolOption('assertions', 'Use assertions', True), # enable warning, (config.h has WITH_WARNINGS) @@ -315,6 +319,10 @@ if ARGUMENTS.has_key('extra_inc_path'): env.Append(CPPPATH = [ARGUMENTS['extra_inc_path']]) if ARGUMENTS.has_key('extra_lib_path'): env.Append(LIBPATH = [ARGUMENTS['extra_lib_path']]) +if ARGUMENTS.has_key('extra_inc_path1'): + env.Append(CPPPATH = [ARGUMENTS['extra_inc_path1']]) +if ARGUMENTS.has_key('extra_lib_path1'): + env.Append(LIBPATH = [ARGUMENTS['extra_lib_path1']]) # # this is a bit out of place (after auto-configration) @@ -362,13 +370,14 @@ elif env['frontend'] == 'qt4': succ = False # first: try pkg_config if env['HAS_PKG_CONFIG']: - succ = conf.CheckPackage('QtCore') + succ = conf.CheckPackage('QtCore') or conf.CheckPackage('QtCore4') env['QT4_PKG_CONFIG'] = succ # second: try to link to it if not succ: # FIXME: under linux, I can test the following perfectly # However, under windows, lib names need to passed as libXXX4.a ... - succ = conf.CheckLibWithHeader('QtCore', 'QtGui/QApplication', 'c++', 'QApplication qapp();') + succ = conf.CheckLibWithHeader('QtCore', 'QtGui/QApplication', 'c++', 'QApplication qapp();') or \ + conf.CheckLibWithHeader('QtCore4', 'QtGui/QApplication', 'c++', 'QApplication qapp();') # third: try to look up the path if not succ: succ = True @@ -379,7 +388,9 @@ elif env['frontend'] == 'qt4': succ = False break # still can not find it - if not succ: + if succ: + print "Qt4 libraries are found." + else: print 'Did not find qt libraries, exiting!' Exit(1) @@ -660,7 +671,10 @@ try: elif frontend == 'qt4': # local qt4 toolset from # http://www.iua.upf.es/~dgarcia/Codders/sconstools.html - env['QT_LIB'] = ['QtCore', 'QtGui', 'Qt3Support'] + if platform_name == "win32": + env['QT_LIB'] = ['QtCore4', 'QtGui4', 'Qt3Support4'] + else: + env['QT_LIB'] = ['QtCore', 'QtGui', 'Qt3Support'] env['EXTRA_LIBS'] = env['QT_LIB'] except: print "Can not locate qt tools" diff --git a/qt4.py b/config/qt4.py similarity index 97% rename from qt4.py rename to config/qt4.py index 40aef1271f..593b018386 100644 --- a/qt4.py +++ b/config/qt4.py @@ -22,7 +22,7 @@ if SCons.Util.case_sensitive_suffixes('.h', '.H'): header_extensions.append('.H') #cplusplus = __import__('c++', globals(), locals(), ['Scons.Tools']) #cxx_suffixes = cplusplus.CXXSuffixes -cxx_suffixes = [".c", ".cxx", ".cpp", ".cc", ".C"] +cxx_suffixes = [".C", ".c", ".cxx", ".cpp", ".cc"] def _checkMocIncluded(target, source, env): moc = target[0] @@ -173,8 +173,6 @@ def generate(env): print "Loading qt4 tool..." def locateQt4Command(env, command, qtdir) : - fullpath = env.Detect([command+'-qt4', command]) - if not (fullpath is None) : return fullpath fullpath1 = os.path.join(qtdir,'bin',command +'-qt4') if os.access(fullpath1, os.X_OK) or \ os.access(fullpath1+".exe", os.X_OK): @@ -183,6 +181,8 @@ def generate(env): if os.access(fullpath2, os.X_OK) or \ os.access(fullpath2+".exe", os.X_OK): return fullpath2 + fullpath = env.Detect([command+'-qt4', command]) + if not (fullpath is None) : return fullpath raise "Qt4 command '" + command + "' not found. Tried: " + fullpath1 + " and "+ fullpath2 @@ -259,14 +259,15 @@ def generate(env): env.Append( BUILDERS = { 'Qrc': qrcbuilder } ) # Interface builder - env['QT4_UIC4COM'] = [ - CLVar('$QT4_UIC $QT4_UICDECLFLAGS -o ${TARGETS[0]} $SOURCE'), - ] + #env['QT4_UIC4COM'] = [ + # CLVar('$QT4_UIC $QT4_UICDECLFLAGS -o ${TARGETS[0]} $SOURCE'), + # ] + env['QT4_UIC4COM'] = '$QT4_UIC -o $TARGET $SOURCE' uic4builder = Builder( action='$QT4_UIC4COM', src_suffix='$QT4_UISUFFIX', suffix='$QT4_UICDECLSUFFIX', - prefix='$QT4_UICDECLPREFIX', + #prefix='$QT4_UICDECLPREFIX', single_source = True ) env.Append( BUILDERS = { 'Uic4': uic4builder } ) @@ -351,7 +352,6 @@ def enable_modules(self, modules, debug=False) : self.AppendUnique(LIBPATH=[os.path.join(self["QTDIR"],"lib",module)]) self.AppendUnique(CPPPATH=[os.path.join(self["QTDIR"],"include","qt4",module)]) modules.remove(module) - # modified by Bo Peng (/lib/pkgconfig => /lib) self.ParseConfig('PKG_CONFIG_PATH=%s/lib pkg-config %s --libs --cflags'% ( self['QTDIR'], diff --git a/scons_utils.py b/config/scons_utils.py similarity index 99% rename from scons_utils.py rename to config/scons_utils.py index 7da71d52ec..0d47c41584 100644 --- a/scons_utils.py +++ b/config/scons_utils.py @@ -543,6 +543,17 @@ SECTIONS return(ld_script) +try: + # these will be used under win32 + import win32file + import win32event + import win32process + import win32security +except: + # does not matter if it fails on other systems + pass + + class loggedSpawn: def __init__(self, env, logfile, longarg, info): # save the spawn system @@ -601,12 +612,6 @@ def setLoggedSpawn(env, logfile = '', longarg=False, info=''): commands to a logfile. If the argument is too long a win32 spawn will be used instead of the system one ''' - if longarg: - import win32file - import win32event - import win32process - import win32security - import string # # create a new spwn object ls = loggedSpawn(env, logfile, longarg, info) diff --git a/src/SConscript b/src/SConscript index 4e90038cf0..88fa708dd7 100644 --- a/src/SConscript +++ b/src/SConscript @@ -142,6 +142,7 @@ lyx_source = Split(''' vc-backend.C version.C vspace.C + main.C ''') if env.has_key('USE_ASPELL') and env['USE_ASPELL']: @@ -151,22 +152,14 @@ elif env.has_key('USE_PSPELL') and env['USE_PSPELL']: elif env.has_key('USE_ISPELL') and env['USE_ISPELL']: lyx_source += ['ispell.C'] -# -# Create a static library for this directory as well -# -lyx_base = env.StaticLibrary( - target = '$LOCALLIBPATH/lyx_base', - source = lyx_source -) # # Build lyx with given frontend # lyx = env.Program( target = 'lyx', - source = ['main.C'], + source = lyx_source, LIBS = [ - 'lyx_base', 'mathed', 'insets', 'frontends', diff --git a/src/frontends/qt4/SConscript b/src/frontends/qt4/SConscript index cdec36773a..be55546012 100644 --- a/src/frontends/qt4/SConscript +++ b/src/frontends/qt4/SConscript @@ -21,7 +21,7 @@ qtenv = env.Copy() # NOTE: I have to patch qt4.py since it does not automatically # process .C file!!! (add to cxx_suffixes ) # -qtenv.Tool('qt4', ['$TOP_SRC_DIR']) +qtenv.Tool('qt4', ['$TOP_SRC_DIR/config']) qtenv.EnableQt4Modules(env['QT_LIB'], debug = False) qtenv.Append(CPPPATH = [ @@ -133,7 +133,6 @@ moc_files = Split(''' QBoxDialog.C QBranchDialog.C QBranches.C - QBrowseBox.C QChangesDialog.C QCharacterDialog.C QCitationDialog.C @@ -244,9 +243,7 @@ source_files = Split(''' checkedwidgets.C lyx_gui.C lcolorcache.C - panelstack.h panelstack.C - qcoloritem.C qfontexample.C qfont_loader.C qfont_metrics.C -- 2.39.2