boost: Fix build of versions < 1.62.0 (#10910)
Improve management of the Fiber library and C++ standard support: * Remove Fiber from list of libraries to build * Improve variant management for Fiber; add variants for Context and Coroutine libraries. * Add known conflict with C++17 for boost < 1.63.0 * Remove C++ standard "default" option, which left the choice of C++ standard to the compiler used to build boost
This commit is contained in:
parent
89b9880719
commit
1bd8c0c460
@ -72,7 +72,6 @@ class Boost(Package):
|
|||||||
'chrono',
|
'chrono',
|
||||||
'date_time',
|
'date_time',
|
||||||
'exception',
|
'exception',
|
||||||
'fiber',
|
|
||||||
'filesystem',
|
'filesystem',
|
||||||
'graph',
|
'graph',
|
||||||
'iostreams',
|
'iostreams',
|
||||||
@ -93,7 +92,8 @@ class Boost(Package):
|
|||||||
# mpi/python are not installed by default because they pull in many
|
# mpi/python are not installed by default because they pull in many
|
||||||
# dependencies and/or because there is a great deal of customization
|
# dependencies and/or because there is a great deal of customization
|
||||||
# possible (and it would be difficult to choose sensible defaults)
|
# possible (and it would be difficult to choose sensible defaults)
|
||||||
default_noinstall_libs = set(['mpi', 'python'])
|
default_noinstall_libs\
|
||||||
|
= set(['context', 'coroutine', 'fiber', 'mpi', 'python'])
|
||||||
|
|
||||||
all_libs = default_install_libs | default_noinstall_libs
|
all_libs = default_install_libs | default_noinstall_libs
|
||||||
|
|
||||||
@ -102,8 +102,8 @@ class Boost(Package):
|
|||||||
description="Compile with {0} library".format(lib))
|
description="Compile with {0} library".format(lib))
|
||||||
|
|
||||||
variant('cxxstd',
|
variant('cxxstd',
|
||||||
default='default',
|
default='98',
|
||||||
values=('default', '98', '11', '14', '17'),
|
values=('98', '11', '14', '17'),
|
||||||
multi=False,
|
multi=False,
|
||||||
description='Use the specified C++ standard when building.')
|
description='Use the specified C++ standard when building.')
|
||||||
variant('debug', default=False,
|
variant('debug', default=False,
|
||||||
@ -135,6 +135,18 @@ class Boost(Package):
|
|||||||
depends_on('zlib', when='+iostreams')
|
depends_on('zlib', when='+iostreams')
|
||||||
depends_on('py-numpy', when='+numpy', type=('build', 'run'))
|
depends_on('py-numpy', when='+numpy', type=('build', 'run'))
|
||||||
|
|
||||||
|
# Coroutine, Context, Fiber, etc., are not straightforward.
|
||||||
|
conflicts('+context', when='@:1.50.99') # Context since 1.51.0.
|
||||||
|
conflicts('cxxstd=98', when='+context') # Context requires >=C++11.
|
||||||
|
conflicts('+coroutine', when='@:1.52.99') # Context since 1.53.0.
|
||||||
|
conflicts('~context', when='+coroutine') # Coroutine requires Context.
|
||||||
|
conflicts('+fiber', when='@:1.61.99') # Fiber since 1.62.0.
|
||||||
|
conflicts('cxxstd=98', when='+fiber') # Fiber requires >=C++11.
|
||||||
|
conflicts('~context', when='+fiber') # Fiber requires Context.
|
||||||
|
|
||||||
|
# C++17 is not supported by Boost<1.63.0.
|
||||||
|
conflicts('cxxstd=17', when='@:1.62.99')
|
||||||
|
|
||||||
conflicts('+taggedlayout', when='+versionedlayout')
|
conflicts('+taggedlayout', when='+versionedlayout')
|
||||||
conflicts('+numpy', when='~python')
|
conflicts('+numpy', when='~python')
|
||||||
|
|
||||||
@ -244,26 +256,6 @@ def determine_bootstrap_options(self, spec, with_libs, options):
|
|||||||
if '+python' in spec:
|
if '+python' in spec:
|
||||||
f.write(self.bjam_python_line(spec))
|
f.write(self.bjam_python_line(spec))
|
||||||
|
|
||||||
def cxxstd_to_flag(self, std):
|
|
||||||
flag = ''
|
|
||||||
if self.spec.variants['cxxstd'].value == '98':
|
|
||||||
flag = self.compiler.cxx98_flag
|
|
||||||
elif self.spec.variants['cxxstd'].value == '11':
|
|
||||||
flag = self.compiler.cxx11_flag
|
|
||||||
elif self.spec.variants['cxxstd'].value == '14':
|
|
||||||
flag = self.compiler.cxx14_flag
|
|
||||||
elif self.spec.variants['cxxstd'].value == '17':
|
|
||||||
flag = self.compiler.cxx17_flag
|
|
||||||
elif self.spec.variants['cxxstd'].value == 'default':
|
|
||||||
# Let the compiler do what it usually does.
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
# The user has selected a (new?) legal value that we've
|
|
||||||
# forgotten to deal with here.
|
|
||||||
tty.die("INTERNAL ERROR: cannot accommodate unexpected variant ",
|
|
||||||
"cxxstd={0}".format(spec.variants['cxxstd'].value))
|
|
||||||
return flag
|
|
||||||
|
|
||||||
def determine_b2_options(self, spec, options):
|
def determine_b2_options(self, spec, options):
|
||||||
if '+debug' in spec:
|
if '+debug' in spec:
|
||||||
options.append('variant=debug')
|
options.append('variant=debug')
|
||||||
@ -318,11 +310,10 @@ def determine_b2_options(self, spec, options):
|
|||||||
|
|
||||||
# Deal with C++ standard.
|
# Deal with C++ standard.
|
||||||
if spec.satisfies('@1.66:'):
|
if spec.satisfies('@1.66:'):
|
||||||
if spec.variants['cxxstd'].value != 'default':
|
options.append('cxxstd={0}'.format(spec.variants['cxxstd'].value))
|
||||||
options.append('cxxstd={0}'.format(
|
|
||||||
spec.variants['cxxstd'].value))
|
|
||||||
else: # Add to cxxflags for older Boost.
|
else: # Add to cxxflags for older Boost.
|
||||||
flag = self.cxxstd_to_flag(spec.variants['cxxstd'].value)
|
cxxstd = spec.variants['cxxstd'].value
|
||||||
|
flag = getattr(self.compiler, 'cxx{0}_flag'.format(cxxstd))
|
||||||
if flag:
|
if flag:
|
||||||
cxxflags.append(flag)
|
cxxflags.append(flag)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user