Make scons work on mingw/windows, from Bo Peng (ben.bob@gmail.com)

* SConstruct: force the use of g++ under windows, and use the right libraries 
	* config/qt4.py: check QtGui4 etc as well.
	* src/SConscript: link to the right libraries
	* src/tex2lyx/SConscript: use the right libraries
	* src/frontends/qt3/SConscript: manually moc .h files under windows


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13814 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Bo Peng 2006-05-09 13:01:45 +00:00
parent 4b5fae61d3
commit 97e53edb81
5 changed files with 33 additions and 9 deletions

View File

@ -258,6 +258,13 @@ env['ENV']['HOME'] = os.environ.get('HOME')
env['ENV']['PKG_CONFIG_PATH'] = os.environ.get('PKG_CONFIG_PATH') env['ENV']['PKG_CONFIG_PATH'] = os.environ.get('PKG_CONFIG_PATH')
env['TOP_SRC_DIR'] = Dir('.').abspath env['TOP_SRC_DIR'] = Dir('.').abspath
# under windows, scons is confused by .C/.c and uses gcc instead of
# g++. I am forcing the use of g++ here. This is expected to change
# after lyx renames all .C files to .cpp
if platform_name in ['win32', 'cygwin']:
env['CC'] = 'g++'
env['LINK'] = 'g++'
# #
# frontend, mode, BUILDDIR and LOCALLIBPATH=BUILDDIR/libs # frontend, mode, BUILDDIR and LOCALLIBPATH=BUILDDIR/libs
# #
@ -675,12 +682,19 @@ try:
env['QT_LIB'] = ['QtCore4', 'QtGui4', 'Qt3Support4'] env['QT_LIB'] = ['QtCore4', 'QtGui4', 'Qt3Support4']
else: else:
env['QT_LIB'] = ['QtCore', 'QtGui', 'Qt3Support'] env['QT_LIB'] = ['QtCore', 'QtGui', 'Qt3Support']
env['EXTRA_LIBS'] = env['QT_LIB'] env['EXTRA_LIBS'] = [x for x in env['QT_LIB']]
except: except:
print "Can not locate qt tools" print "Can not locate qt tools"
print "What I get is " print "What I get is "
print " QTDIR: ", env['QTDIR'] print " QTDIR: ", env['QTDIR']
if platform_name == 'win32':
env['SYSTEM_LIBS'] = ['shlwapi', 'zlib1']
elif platform_name == 'cygwin':
env['SYSTEM_LIBS'] = ['shlwapi', 'z']
else:
env['SYSTEM_LIBS'] = ['z']
# #
# Build parameters CPPPATH etc # Build parameters CPPPATH etc
# #

View File

@ -332,6 +332,9 @@ def enable_modules(self, modules, debug=False) :
'QtUiTools', 'QtUiTools',
'QtUiTools_debug', 'QtUiTools_debug',
] ]
# under windows, they are named QtCore4 etc
validModules += [x+'4' for x in validModules]
pclessModules += [x+'4' for x in pclessModules]
invalidModules=[] invalidModules=[]
for module in modules: for module in modules:
if module not in validModules : if module not in validModules :

View File

@ -166,9 +166,9 @@ lyx = env.Program(
env['frontend'], env['frontend'],
'controllers', 'controllers',
'graphics', 'graphics',
'supports', 'supports'] +
'z' ] +
env['EXTRA_LIBS'] + env['EXTRA_LIBS'] +
env['SYSTEM_LIBS'] +
env['BOOST_LIBRARIES'] env['BOOST_LIBRARIES']
) )

View File

@ -9,6 +9,7 @@
# Full author contact details are available in file CREDITS. # Full author contact details are available in file CREDITS.
Import('env') Import('env')
import os, sys
print "Entering src/frontends/qt3" print "Entering src/frontends/qt3"
@ -97,6 +98,7 @@ ui_files = Split('''
QVSpaceDialogBase.ui QVSpaceDialogBase.ui
QWrapDialogBase.ui QWrapDialogBase.ui
''') ''')
moc_files = Split(''' moc_files = Split('''
BulletsModule.C BulletsModule.C
@ -157,7 +159,15 @@ moc_files = Split('''
socket_callback.C socket_callback.C
validators.C validators.C
''') ''')
# under windows, because of the .C/.c confusion
# moc_files are not moced automatically.
# I am doing it manually here, until lyx changes
# file extension from .C to .cpp
moced_files = []
if os.name == 'nt' or sys.platform == 'cygwin':
moced_files = [qtenv.Moc(x.replace('.C', '.h')) for x in moc_files]
qt3 = qtenv.StaticLibrary( qt3 = qtenv.StaticLibrary(
target = '$LOCALLIBPATH/qt3', target = '$LOCALLIBPATH/qt3',
source = Split(''' source = Split('''
@ -222,7 +232,7 @@ qt3 = qtenv.StaticLibrary(
qscreen.C qscreen.C
qt_helpers.C qt_helpers.C
''') + ''') +
moc_files + moc_files + moced_files +
['ui/' + x for x in ui_files] ['ui/' + x for x in ui_files]
) )

View File

@ -30,10 +30,7 @@ tex2lyx_env.fileCopy('lyxtextclass.C', '#$BUILDDIR/lyxtextclass.C')
tex2lyx = tex2lyx_env.Program( tex2lyx = tex2lyx_env.Program(
target = 'tex2lyx', target = 'tex2lyx',
LIBS = [ LIBS = ['supports'] + env['BOOST_LIBRARIES'] + env['SYSTEM_LIBS'],
'supports',
'z',
] + env['BOOST_LIBRARIES'],
source = Split(''' source = Split('''
FloatList.C FloatList.C
Floating.C Floating.C