Add universal build_type variant to CMakePackage (#4797)
* Add universal build_type variant to CMakePackage * Override build_type in some packages with different possible values * Remove reference to no longer existent debug variant * Update CBTF packages with new build_type variant * Keep note on build size of LLVM
This commit is contained in:

committed by
Todd Gamblin

parent
4b996e9f49
commit
07aec4366f
@@ -29,7 +29,7 @@
|
||||
|
||||
import spack.build_environment
|
||||
from llnl.util.filesystem import working_dir, join_path
|
||||
from spack.directives import depends_on
|
||||
from spack.directives import depends_on, variant
|
||||
from spack.package import PackageBase, run_after
|
||||
|
||||
|
||||
@@ -49,11 +49,6 @@ class CMakePackage(PackageBase):
|
||||
+-----------------------------------------------+--------------------+
|
||||
| **Method** | **Purpose** |
|
||||
+===============================================+====================+
|
||||
| :py:meth:`~.CMakePackage.build_type` | Specify the value |
|
||||
| | for the |
|
||||
| | CMAKE_BUILD_TYPE |
|
||||
| | variable |
|
||||
+-----------------------------------------------+--------------------+
|
||||
| :py:meth:`~.CMakePackage.root_cmakelists_dir` | Location of the |
|
||||
| | root CMakeLists.txt|
|
||||
+-----------------------------------------------+--------------------+
|
||||
@@ -74,15 +69,13 @@ class CMakePackage(PackageBase):
|
||||
|
||||
build_time_test_callbacks = ['check']
|
||||
|
||||
# https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html
|
||||
variant('build_type', default='RelWithDebInfo',
|
||||
description='The build type to build',
|
||||
values=('Debug', 'Release', 'RelWithDebInfo', 'MinSizeRel'))
|
||||
|
||||
depends_on('cmake', type='build')
|
||||
|
||||
def build_type(self):
|
||||
"""Returns the correct value for the ``CMAKE_BUILD_TYPE`` variable
|
||||
|
||||
:return: value for ``CMAKE_BUILD_TYPE``
|
||||
"""
|
||||
return 'RelWithDebInfo'
|
||||
|
||||
@property
|
||||
def root_cmakelists_dir(self):
|
||||
"""The relative path to the directory containing CMakeLists.txt
|
||||
@@ -108,8 +101,8 @@ def std_cmake_args(self):
|
||||
def _std_args(pkg):
|
||||
"""Computes the standard cmake arguments for a generic package"""
|
||||
try:
|
||||
build_type = pkg.build_type()
|
||||
except AttributeError:
|
||||
build_type = pkg.spec.variants['build_type'].value
|
||||
except KeyError:
|
||||
build_type = 'RelWithDebInfo'
|
||||
|
||||
args = ['-DCMAKE_INSTALL_PREFIX:PATH={0}'.format(pkg.prefix),
|
||||
|
Reference in New Issue
Block a user