summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2023-05-04 17:33:35 +0200
committerGitHub <noreply@github.com>2023-05-04 11:33:35 -0400
commit86d3bad1e05140398f6e19919de38928f3d0c484 (patch)
treef1bc0fa88f22ce038298e57bb6868be5e25110bf /lib
parent600955edd4ca22b2d94e725706fc4733d5c4e4d9 (diff)
downloadspack-86d3bad1e05140398f6e19919de38928f3d0c484.tar.gz
spack-86d3bad1e05140398f6e19919de38928f3d0c484.tar.bz2
spack-86d3bad1e05140398f6e19919de38928f3d0c484.tar.xz
spack-86d3bad1e05140398f6e19919de38928f3d0c484.zip
cmake build system: change default build type to `Release` (#36679)
This switches the default Make build type to `build_type=Release`. This offers: - higher optimization level, including loop vectorization on older GCC - adds NDEBUG define, which disables assertions, which could cause speedups if assertions are in loops etc - no `-g` means smaller install size Downsides are: - worse backtraces (though this does NOT strip symbols) - perf reports may be useless - no function arguments / local variables in debugger (could be of course) - no file path / line numbers in debugger The downsides can be mitigated by overriding to `build_type=RelWithDebInfo` in `packages.yaml`, if needed. The upside is that builds will be MUCH smaller (and faster) with this change. --------- Co-authored-by: Gregory Becker <becker33@llnl.gov>
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/build_systems/cmake.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/spack/spack/build_systems/cmake.py b/lib/spack/spack/build_systems/cmake.py
index 5230aa240e..f3b4ad35d6 100644
--- a/lib/spack/spack/build_systems/cmake.py
+++ b/lib/spack/spack/build_systems/cmake.py
@@ -90,9 +90,13 @@ class CMakePackage(spack.package_base.PackageBase):
with when("build_system=cmake"):
# https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html
+ # See https://github.com/spack/spack/pull/36679 and related issues for a
+ # discussion of the trade-offs between Release and RelWithDebInfo for default
+ # builds. Release is chosen to maximize performance and reduce disk-space burden,
+ # at the cost of more difficulty in debugging.
variant(
"build_type",
- default="RelWithDebInfo",
+ default="Release",
description="CMake build type",
values=("Debug", "Release", "RelWithDebInfo", "MinSizeRel"),
)