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>
This commit is contained in:

committed by
GitHub

parent
600955edd4
commit
86d3bad1e0
@@ -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"),
|
||||
)
|
||||
|
Reference in New Issue
Block a user