From d80241a2037f526d8d97f778345d1a6810f2cae1 Mon Sep 17 00:00:00 2001 From: Nils Leif Fischer Date: Fri, 28 Jan 2022 11:40:02 +0100 Subject: spectre: allow disabling debug symbols (#28511) * spectre: allow disabling debug symbols * spectre: fix PCH builds * spectre: support builds with shared libs --- .../repos/builtin/packages/spectre/package.py | 37 ++++++++++++++++++---- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/var/spack/repos/builtin/packages/spectre/package.py b/var/spack/repos/builtin/packages/spectre/package.py index ba1d911fca..73abce11f6 100644 --- a/var/spack/repos/builtin/packages/spectre/package.py +++ b/var/spack/repos/builtin/packages/spectre/package.py @@ -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, @@ -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 @@ -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), @@ -168,8 +191,8 @@ class Spectre(CMakePackage): 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: -- cgit v1.2.3-60-g2f50