Two solutions: 1) detect a Q_OBJECT inside the header. 2) moc all qt4/*.h
1) is the default for qt4.py but our wonderful .C naming disables it and I have to do it manually. If you can rename all files to .C (at least for qt4), I can change to 1. Attached patch 1. use QtGui4_debug.dll in debug mode 2. adjust for your file rename 3. preliminary pch support (for mathed only). pch=yes mathed. Cheers, Bo
Index: development/scons/qt4.py =================================================================== --- development/scons/qt4.py (revision 14138) +++ development/scons/qt4.py (working copy) @@ -332,9 +332,6 @@ 'QtUiTools', 'QtUiTools_debug', ] - # under windows, they are named QtCore4 etc - validModules += [x+'4' for x in validModules] - pclessModules += [x+'4' for x in pclessModules] invalidModules=[] for module in modules: if module not in validModules : Index: development/scons/SConstruct =================================================================== --- development/scons/SConstruct (revision 14138) +++ development/scons/SConstruct (working copy) @@ -145,8 +145,8 @@ allowed_values = ('windows', 'posix', 'macosx')), # BoolOption('fast_start', 'Whether or not use cached tests and keep current config.h', True), - # FIXME: I do not know how pch is working. Ignore this option now. - BoolOption('pch', '(NA) Whether or not use pch', None), + # + BoolOption('pch', 'Whether or not use pch', False), # enable assertion, (config.h has ENABLE_ASSERTIOS BoolOption('assertions', 'Use assertions', True), # enable warning, (config.h has WITH_WARNINGS) @@ -309,6 +309,8 @@ # for simplicity, use var instead of env[var] frontend = env['frontend'] prefix = env['prefix'] +mode = env['mode'] +use_pch = env['pch'] if platform_name == 'win32': if env.has_key('use_vc'): @@ -330,7 +332,7 @@ env['BUILDDIR'] = env['build_dir'] else: # Determine the name of the build $mode - env['BUILDDIR'] = '#' + env['mode'] + env['BUILDDIR'] = '#' + mode # all built libraries will go to build_dir/libs # (This is different from the make file approach) @@ -443,6 +445,18 @@ env['CC'] = 'g++' env['LINK'] = 'g++' +# only support gcc now +if use_pch and not use_vc: + CCFLAGS_required.extend(['-Winvalid-pch']) + env['CCPCHFLAGS'] = '-x c++-header' + # will be set by each module (directory) + CCFLAGS_required.extend(['--include=$PCH_H']) + #env.Prepend(CPPPATH = ['$PCH_DIR']) + env['PCH_FILE'] = ['pch.h.gch'] +else: + env['CCPCHFLAGS'] = '' + env['PCH_FILE'] = [] + # for debug/release mode if env.has_key('optimization') and env['optimization'] is not None: # if user supplies optimization flags, use it anyway @@ -452,14 +466,14 @@ else: set_default_optimization_flags = True -if env['mode'] == 'debug': +if mode == 'debug': if use_vc: CCFLAGS_required.append('/Zi') LINKFLAGS_required.extend(['/debug', '/map']) else: CCFLAGS_required.append('-g') - CCFLAGS_default.append('-Wall') -elif env['mode'] == 'release' and set_default_optimization_flags: + CCFLAGS_default.extend(['-Wall', '-O']) +elif mode == 'release' and set_default_optimization_flags: if use_vc: CCFLAGS_default.append('/O2') else: @@ -754,6 +768,11 @@ #---------------------------------------------------------- # Generating config.h #---------------------------------------------------------- +aspell_lib = 'aspell' +# assume that we use aspell, aspelld compiled for msvc +if platform_name == 'win32' and mode == 'debug': + aspell_lib = 'aspelld' + if not fast_start: print "Generating src/config.h..." @@ -770,7 +789,7 @@ env['USE_ASPELL'] = False env['USE_PSPELL'] = False env['USE_ISPELL'] = False - if spell_opt in ['auto', 'aspell'] and conf.CheckLib('aspell'): + if spell_opt in ['auto', 'aspell'] and conf.CheckLib(aspell_lib): spell_engine = 'USE_ASPELL' elif spell_opt in ['auto', 'pspell'] and conf.CheckLib('pspell'): spell_engine = 'USE_PSPELL' @@ -1026,11 +1045,19 @@ qt_libs = ['qt-mt'] frontend_libs = ['qt-mt'] elif frontend == 'qt4': - if platform_name == "win32": - qt_libs = ['QtCore4', 'QtGui4'] + qt_libs = ['QtCore', 'QtGui'] + # set the right lib names + if platform_name == 'win32': + if mode == 'debug': + qt_lib_suffix += '4d' + else: + qt_lib_suffix = '4' else: - qt_libs = ['QtCore', 'QtGui'] - frontend_libs = qt_libs + if mode == 'debug': + qt_lib_suffix = '_debug' + else: + qt_lib_suffix = '' + frontend_libs = [x + qt_lib_suffix for x in qt_libs] except: print "Can not locate qt tools" print "What I get is " @@ -1055,7 +1082,7 @@ ('HAVE_ICONV', env['ICONV_LIB']), ('HAVE_LIBGDI32', 'gdi32'), ('HAVE_LIBAIKSAURUS', env['AIKSAURUS_LIB']), - ('USE_ASPELL', 'aspell'), + ('USE_ASPELL', aspell_lib), ('USE_ISPELL', 'ispell'), ('USE_PSPELL', 'pspell'), ] @@ -1082,6 +1109,13 @@ # # install customized builders env['BUILDERS']['substFile'] = Builder(action = utils.env_subst) +if use_pch and not use_vc: + env['BUILDERS']['PCH'] = Builder( + action = '$CXX $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS $CCPCHFLAGS $SOURCES -o $TARGET' + ) +else: + # do nothing + env['BUILDERS']['PCH'] = Builder(action = '') # # A Link script for cygwin see @@ -1588,11 +1622,14 @@ # src/mathed # print "Processing files in src/mathed..." - + env['PCH_H'] = '$TOP_SRCDIR/src/mathed/pch.h' + env.PCH('$BUILDDIR/common/mathed/pch.h.gch', env['PCH_H']) + # mathed = env.StaticLibrary( target = '$LOCALLIBPATH/mathed', source = utils.globSource(dir = env.subst('$TOP_SRCDIR/src/mathed'), pattern = lyx_ext, exclude = ['math_xyarrowinset.C', 'math_mboxinset.C', 'formulamacro.C'], + include = env['PCH_FILE'], build_dir = '$BUILDDIR/common/mathed') ) Alias('mathed', mathed) @@ -1869,7 +1906,7 @@ # process .C file!!! (add to cxx_suffixes ) # qt4env.Tool('qt4', [scons_dir]) - qt4env.EnableQt4Modules(qt_libs, debug = False) + qt4env.EnableQt4Modules(qt_libs, debug = (mode == 'debug')) qt4env.AppendUnique(CPPPATH = [ '$BUILDDIR/common', @@ -1921,7 +1958,7 @@ QGraphicsDialog.C QIncludeDialog.C QIndexDialog.C - QLAction.C + Action.C QLogDialog.C QViewSourceDialog.C QViewSource.C @@ -1970,7 +2007,6 @@ qt4 = qt4env.StaticLibrary( target = '$LOCALLIBPATH/qt4', - LIBS = qt_libs, source = utils.globSource(dir = env.subst('$TOP_SRCDIR/src/frontends/qt4'), pattern = lyx_ext, exclude = ['QBrowseBox.C'], build_dir = '$BUILDDIR/common/frontends/qt4') ) Index: development/scons/scons_utils.py =================================================================== --- development/scons/scons_utils.py (revision 14138) +++ development/scons/scons_utils.py (working copy) @@ -58,10 +58,10 @@ # # glob filenames # -def globSource(dir, pattern, build_dir=None, exclude=[], include=[]): +def globSource(dir, pattern, build_dir = None, exclude = [], include = []): ''' glob files, in dir and use build_dir as returned path name ''' # exclude 'exclude+include' to avoid duplicate items in files - files = filter(lambda x: x not in exclude + include, glob.glob1(dir, pattern)) + include + files = include + filter(lambda x: x not in exclude + include, glob.glob1(dir, pattern)) if build_dir is None: return files else: