mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-27 14:29:21 +00:00
Scons: do not build boost dependency tree, use debug/release boost system library, check for boost system header files
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14338 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
efc3b4e52a
commit
e85cfec957
@ -701,42 +701,43 @@ if not fast_start:
|
|||||||
# check boost libraries
|
# check boost libraries
|
||||||
boost_opt = ARGUMENTS.get('boost', 'auto')
|
boost_opt = ARGUMENTS.get('boost', 'auto')
|
||||||
# check for system boost
|
# check for system boost
|
||||||
paths = env['LIBPATH'] + ['/usr/lib', '/usr/local/lib']
|
lib_paths = env['LIBPATH'] + ['/usr/lib', '/usr/local/lib']
|
||||||
# real libraries (included or system)
|
inc_paths = env['CPPPATH'] + ['/usr/include', '/usr/local/include']
|
||||||
boost_libraries = []
|
# default to $BUILDDIR/libs (use None since this path will be added anyway)
|
||||||
boost_libpath = None
|
boost_libpath = None
|
||||||
# here I assume that all libraries are in the same directory
|
# here I assume that all libraries are in the same directory
|
||||||
for lib in boost_libs:
|
if boost_opt == 'included':
|
||||||
if boost_opt == 'included':
|
boost_libraries = ['included_boost_%s' % x for x in boost_libs]
|
||||||
boost_libraries.append('included_boost_%s' % lib)
|
included_boost = True
|
||||||
env['INCLUDED_BOOST'] = True
|
env['BOOST_INC_PATH'] = '$TOP_SRCDIR/boost'
|
||||||
elif boost_opt == 'auto':
|
elif boost_opt == 'auto':
|
||||||
res = conf.CheckBoostLibraries('boost_%s' % lib , paths)
|
res = conf.CheckBoostLibraries(boost_libs, lib_paths, inc_paths, mode == 'debug')
|
||||||
# if not found
|
# if not found, use local boost
|
||||||
if res[0] == '':
|
if res[0] is None:
|
||||||
boost_libraries.append('included_boost_%s' % lib)
|
boost_libraries = ['included_boost_%s' % x for x in boost_libs]
|
||||||
env['INCLUDED_BOOST'] = True
|
included_boost = True
|
||||||
else:
|
env['BOOST_INC_PATH'] = '$TOP_SRCDIR/boost'
|
||||||
boost_libraries.append(res[1])
|
else:
|
||||||
env['INCLUDED_BOOST'] = False
|
included_boost = False
|
||||||
boost_libpath = res[0]
|
(boost_libraries, boost_libpath, env['BOOST_INC_PATH']) = res
|
||||||
elif boost_opt == 'system':
|
elif boost_opt == 'system':
|
||||||
res = conf.CheckBoostLibraries('boost_%s' % lib , paths)
|
res = conf.CheckBoostLibraries(boost_libs, lib_paths, inc_paths, mode == 'debug')
|
||||||
if res[0] == '':
|
if res[0] is None:
|
||||||
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:
|
||||||
boost_libraries.append(res[1])
|
included_boost = False
|
||||||
env.AppendUnique(LIBPATH = [res[0]])
|
(boost_libraries, boost_libpath, env['BOOST_INC_PATH']) = res
|
||||||
boost_libpath = res[0]
|
|
||||||
env_cache['BOOST_LIBRARIES'] = boost_libraries
|
env_cache['BOOST_LIBRARIES'] = boost_libraries
|
||||||
env_cache['INCLUDED_BOOST'] = env['INCLUDED_BOOST']
|
env_cache['INCLUDED_BOOST'] = included_boost
|
||||||
|
env_cache['BOOST_INC_PATH'] = env['BOOST_INC_PATH']
|
||||||
env_cache['BOOST_LIBPATH'] = boost_libpath
|
env_cache['BOOST_LIBPATH'] = boost_libpath
|
||||||
else:
|
else:
|
||||||
boost_libraries = env_cache['BOOST_LIBRARIES']
|
boost_libraries = env_cache['BOOST_LIBRARIES']
|
||||||
env['INCLUDED_BOOST'] = env_cache['INCLUDED_BOOST']
|
included_boost = env_cache['INCLUDED_BOOST']
|
||||||
|
env['BOOST_INC_PATH'] = env_cache['BOOST_INC_PATH']
|
||||||
boost_libpath = env_cache['BOOST_LIBPATH']
|
boost_libpath = env_cache['BOOST_LIBPATH']
|
||||||
|
|
||||||
if boost_libpath is not None:
|
if boost_libpath is not None:
|
||||||
@ -1307,7 +1308,16 @@ if env['X11']:
|
|||||||
# BUILDDIR/common: for config.h
|
# BUILDDIR/common: for config.h
|
||||||
# TOP_SRCDIR/src: for support/* etc
|
# TOP_SRCDIR/src: for support/* etc
|
||||||
#
|
#
|
||||||
env['CPPPATH'] += ['$TOP_SRCDIR/boost', '$BUILDDIR/common', '$TOP_SRCDIR/src']
|
env['CPPPATH'] += ['$BUILDDIR/common', '$TOP_SRCDIR/src']
|
||||||
|
#
|
||||||
|
# Separating boost directories from CPPPATH stops scons from building
|
||||||
|
# the dependency tree of boost header files, and effectively reduce
|
||||||
|
# the null build time of lyx from 29s to 16s.
|
||||||
|
if use_vc:
|
||||||
|
env.AppendUnique(CCFLAGS = ['/I$BOOST_INC_PATH'])
|
||||||
|
else:
|
||||||
|
env.AppendUnique(CCFLAGS = ['-I$BOOST_INC_PATH'])
|
||||||
|
|
||||||
# for intl/config.h, intl/libintl.h and intl/libgnuintl.h
|
# for intl/config.h, intl/libintl.h and intl/libgnuintl.h
|
||||||
if env['nls'] and included_gettext:
|
if env['nls'] and included_gettext:
|
||||||
env['CPPPATH'].append('$BUILDDIR/intl')
|
env['CPPPATH'].append('$BUILDDIR/intl')
|
||||||
@ -1429,7 +1439,7 @@ targets = BUILD_TARGETS
|
|||||||
# msvc need to pass full target name, so I have to look for path/lyx etc
|
# msvc need to pass full target name, so I have to look for path/lyx etc
|
||||||
build_lyx = targets == [] or True in ['lyx' in x for x in targets] \
|
build_lyx = targets == [] or True in ['lyx' in x for x in targets] \
|
||||||
or 'install' in targets or 'all' in targets
|
or 'install' in targets or 'all' in targets
|
||||||
build_boost = (env['INCLUDED_BOOST'] and not libExists('boost_regex')) or 'boost' in targets
|
build_boost = (included_boost and not libExists('boost_regex')) or 'boost' in targets
|
||||||
build_intl = (included_gettext and not libExists('included_intl')) or 'intl' in targets
|
build_intl = (included_gettext and not libExists('included_intl')) or 'intl' in targets
|
||||||
build_support = build_lyx or True in [x in targets for x in ['support', 'client', 'tex2lyx']]
|
build_support = build_lyx or True in [x in targets for x in ['support', 'client', 'tex2lyx']]
|
||||||
build_mathed = build_lyx or 'mathed' in targets
|
build_mathed = build_lyx or 'mathed' in targets
|
||||||
|
@ -153,24 +153,69 @@ int main()
|
|||||||
return ('int', 'int *', 'struct timeval *')
|
return ('int', 'int *', 'struct timeval *')
|
||||||
|
|
||||||
|
|
||||||
def checkBoostLibraries(conf, lib, pathes):
|
def checkBoostLibraries(conf, libs, lib_paths, inc_paths, isDebug):
|
||||||
''' look for boost libraries '''
|
''' look for boost libraries
|
||||||
conf.Message('Checking for boost library %s... ' % lib)
|
libs: library names
|
||||||
for path in pathes:
|
lib_paths: try these paths for boost libraries
|
||||||
|
inc_paths: try these paths for boost headers
|
||||||
|
isDebug: if true, use debug libraries
|
||||||
|
'''
|
||||||
|
conf.Message('Checking for boost library %s... ' % ', '.join(libs))
|
||||||
|
found_lib = False
|
||||||
|
found_inc = False
|
||||||
|
lib_names = []
|
||||||
|
lib_path = None
|
||||||
|
inc_path = None
|
||||||
|
for path in lib_paths:
|
||||||
# direct form: e.g. libboost_iostreams.a
|
# direct form: e.g. libboost_iostreams.a
|
||||||
if os.path.isfile(os.path.join(path, 'lib%s.a' % lib)):
|
# ignore isDebug
|
||||||
|
if False not in [os.path.isfile(os.path.join(path, 'libboost_%s.a' % lib)) for lib in libs]:
|
||||||
conf.Result('yes')
|
conf.Result('yes')
|
||||||
return (path, lib)
|
found_lib = True
|
||||||
# check things like libboost_iostreams-gcc.a
|
lib_path = path
|
||||||
files = glob.glob(os.path.join(path, 'lib%s-*.a' % lib))
|
lib_names = libs
|
||||||
# if there are more than one, choose the first one
|
break
|
||||||
# FIXME: choose the best one.
|
for lib in libs:
|
||||||
if len(files) >= 1:
|
# get all the libs, then filter for the right library
|
||||||
# get xxx-gcc from /usr/local/lib/libboost_xxx-gcc.a
|
files = glob.glob(os.path.join(path, 'libboost_%s-*.a' % lib))
|
||||||
conf.Result('yes')
|
# check things like libboost_iostreams-gcc-mt-d-1_33_1.a
|
||||||
return (path, files[0].split(os.sep)[-1][3:-2])
|
if len(files) > 0:
|
||||||
conf.Result('n')
|
if isDebug:
|
||||||
return ('','')
|
files = filter(lambda x: re.search('libboost_%s-\w+-mt-d-[\d-]+' % lib, x), files)
|
||||||
|
else:
|
||||||
|
files = filter(lambda x: re.search('libboost_%s-\w+-mt-[\d-]+' % lib, x), files)
|
||||||
|
if len(files) == 0:
|
||||||
|
print 'Warning: %s directory seems to have the boost libraries, but ' % path
|
||||||
|
print 'I can not find one that has the form lib%s-xxx-mt[-d]-x_xx_x.a' % lib
|
||||||
|
print 'Check your boost installation, or change select criteria in scons_util.py'
|
||||||
|
if len(files) > 0:
|
||||||
|
# get xxx-gcc-1_33_1 from /usr/local/lib/libboost_xxx-gcc-1_33_1.a
|
||||||
|
lib_names.append(files[0].split(os.sep)[-1][3:-2])
|
||||||
|
if len(lib_names) == len(libs):
|
||||||
|
found_lib = True
|
||||||
|
lib_path = path
|
||||||
|
break
|
||||||
|
if not found_lib:
|
||||||
|
conf.Result('no')
|
||||||
|
return (None, None, None)
|
||||||
|
# check for boost header file
|
||||||
|
for path in inc_paths:
|
||||||
|
# check path/boost/regex.h
|
||||||
|
if os.path.isfile(os.path.join(path, 'boost', 'regex.h')):
|
||||||
|
inc_path = path
|
||||||
|
found_inc = True
|
||||||
|
else: # check path/boost_1_xx_x/boost
|
||||||
|
dirs = glob.glob(os.path.join(path, 'boost-*'))
|
||||||
|
if len(dirs) > 0 and os.path.isfile(os.path.join(dirs[0], 'boost', 'regex.h')):
|
||||||
|
inc_path = dirs[0]
|
||||||
|
found_inc = True
|
||||||
|
# return result
|
||||||
|
if found_inc:
|
||||||
|
conf.Result('yes')
|
||||||
|
return (lib_names, lib_path, inc_path)
|
||||||
|
else:
|
||||||
|
conf.Result('no')
|
||||||
|
return (None, None, None)
|
||||||
|
|
||||||
|
|
||||||
def checkCommand(conf, cmd):
|
def checkCommand(conf, cmd):
|
||||||
@ -314,7 +359,7 @@ def createConfigFile(conf, config_file,
|
|||||||
result[lib[2]] = ll
|
result[lib[2]] = ll
|
||||||
cont += configString('#define %s 1' % lib[1], desc = description)
|
cont += configString('#define %s 1' % lib[1], desc = description)
|
||||||
break
|
break
|
||||||
# if not found
|
# if not found
|
||||||
if not result[lib[1]]:
|
if not result[lib[1]]:
|
||||||
cont += configString('/* #undef %s */' % lib[1], desc = description)
|
cont += configString('/* #undef %s */' % lib[1], desc = description)
|
||||||
# custom tests
|
# custom tests
|
||||||
|
Loading…
Reference in New Issue
Block a user