diff options
author | Thomas Dickerson <elfprince13@gmail.com> | 2022-05-06 10:14:45 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-06 16:14:45 +0200 |
commit | 6c6685b5fa1b720477ab8c5317562eebdee41ed2 (patch) | |
tree | 0700c2b7959a6eda8932d277bb1dad379b0f1930 /var | |
parent | 17c32811fbdc4e370384e996f9c744cd44f48b1f (diff) | |
download | spack-6c6685b5fa1b720477ab8c5317562eebdee41ed2.tar.gz spack-6c6685b5fa1b720477ab8c5317562eebdee41ed2.tar.bz2 spack-6c6685b5fa1b720477ab8c5317562eebdee41ed2.tar.xz spack-6c6685b5fa1b720477ab8c5317562eebdee41ed2.zip |
boost: add support for alternate boost-context backends (#30496)
The fcontext backend is the default high-performance backend.
The ucontext backend is needed when using Boost context in conjunction with ASAN.
The WinFibers backend...also exists.
https://www.boost.org/doc/libs/1_79_0/libs/context/doc/html/context/cc/implementations__fcontext_t__ucontext_t_and_winfiber.html
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/repos/builtin/packages/boost/package.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/boost/package.py b/var/spack/repos/builtin/packages/boost/package.py index bce3ce038b..b9b0cabf0b 100644 --- a/var/spack/repos/builtin/packages/boost/package.py +++ b/var/spack/repos/builtin/packages/boost/package.py @@ -156,6 +156,13 @@ class Boost(Package): libraries, root=self.prefix, shared=shared, recursive=True ) + variant('context-impl', + default='fcontext', + values=('fcontext', 'ucontext', 'winfib'), + multi=False, + description='Use the specified backend for boost-context', + when='+context') + variant('cxxstd', default='98', values=( @@ -481,6 +488,10 @@ class Boost(Package): raise RuntimeError("At least one of {singlethreaded, " + "multithreaded} must be enabled") + # If we are building context, tell b2 which backend to use + if '+context' in spec: + options.extend(['context-impl=%s' % spec.variants['context-impl'].value]) + if '+taggedlayout' in spec: layout = 'tagged' elif '+versionedlayout' in spec: @@ -667,3 +678,12 @@ class Boost(Package): return ['-DBoost_NO_BOOST_CMAKE=ON'] + args_fn(self) type(dependent_spec.package).cmake_args = _cmake_args + + def setup_dependent_build_environment(self, env, dependent_spec): + if '+context' in self.spec: + context_impl = self.spec.variants['context-impl'].value + # fcontext, as the default, has no corresponding macro + if context_impl == 'ucontext': + env.append_flags('CXXFLAGS', '-DBOOST_USE_UCONTEXT') + elif context_impl == 'winfib': + env.append_flags('CXXFLAGS', '-DBOOST_USE_WINFIB') |