Skip to content

Commit

Permalink
spectre: allow disabling debug symbols (spack#28511)
Browse files Browse the repository at this point in the history
* spectre: allow disabling debug symbols

* spectre: fix PCH builds

* spectre: support builds with shared libs
  • Loading branch information
nilsvu authored Jan 28, 2022
1 parent 1e1e3ae commit d80241a
Showing 1 changed file with 30 additions and 7 deletions.
37 changes: 30 additions & 7 deletions var/spack/repos/builtin/packages/spectre/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,18 @@ class Spectre(CMakePackage):
description="Executables to install")
variant('python', default=False, description="Build Python bindings")
variant('doc', default=False, description="Build documentation")
# TODO: support installation of executables with shared libs
# variant('shared',
# default=False,
# description="Build shared libraries instead of static")
# Build type and debug symbols:
# - Both Debug and Release builds have debug symbols enabled by default in
# the SpECTRE build system, so we can view backtraces, etc., when
# production code fails.
variant('build_type', values=('Debug', 'Release'),
default='Release', description='CMake build type')
# - Allow disabling debug symbols to reduce memory usage and executable size
variant('debug_symbols', default=True,
description="Build with debug symbols")
variant('shared',
default=False,
description="Build shared libraries instead of static")
variant('memory_allocator',
values=('system', 'jemalloc'),
multi=False,
Expand Down Expand Up @@ -110,6 +118,11 @@ class Spectre(CMakePackage):
depends_on('py-beautifulsoup4', type='build')
depends_on('py-pybtex', type='build')

# Incompatibilities
# - Shared libs builds on macOS don't work before
# https://github.com/sxs-collaboration/spectre/pull/2680
conflicts('+shared', when='@:2022.01.03 platform=darwin')

# These patches backport updates to the SpECTRE build system to earlier
# releases, to support installing them with Spack. In particular, we try to
# support releases associated with published papers, so their results are
Expand Down Expand Up @@ -155,11 +168,21 @@ class Spectre(CMakePackage):
'https://github.com/sxs-collaboration/spectre/commit/1b61e62a27b02b658cc6a74c4d46af1f5b5d0a4d.patch',
sha256='07be176ca4dda74a2dd8e71c31dab638a9f3567c3a58eb7fddbfde001646fb8c',
when='@:2022.01.03')
# - Backport fix for PCH builds with Spack
patch(
'https://github.com/sxs-collaboration/spectre/commit/4bb3f25f905f83d8295a28a8036f6971dc4e75a2.patch',
sha256='cd39217614a40f080d812e20220044aa8b26b9413324a7cd7a304e2378a2b426',
when='@:2022.01.03')
# - Backport installation of shared libs
patch(
'https://github.com/sxs-collaboration/spectre/commit/b7c54a2a20c6d62aae6b1c97e3468d4cd39ed6ad.patch',
sha256='29ad44594ecfd6442a64d2cb57ed2d712cb8d93707c6bceea8030a9a2682b7ed',
when='@:2022.01.03 +shared')

def cmake_args(self):
args = [
self.define('CHARM_ROOT', self.spec['charmpp'].prefix),
# self.define_from_variant('BUILD_SHARED_LIBS', 'shared'),
self.define_from_variant('BUILD_SHARED_LIBS', 'shared'),
self.define('Python_EXECUTABLE', self.spec['python'].command.path),
self.define_from_variant('BUILD_PYTHON_BINDINGS', 'python'),
self.define('BUILD_TESTING', self.run_tests),
Expand All @@ -168,8 +191,8 @@ def cmake_args(self):
self.define_from_variant('USE_FORMALINE', 'formaline'),
self.define_from_variant('MEMORY_ALLOCATOR').upper(),
self.define_from_variant('ENABLE_PROFILING', 'profiling'),
# TODO: Fix PCH builds to reduce compile time
self.define('USE_PCH', False),
self.define('USE_PCH', True),
self.define_from_variant('DEBUG_SYMBOLS'),
]
# Allow for more time on slower machines
if self.run_tests:
Expand Down

0 comments on commit d80241a

Please sign in to comment.