xyce: Add cxxstd variant with only valid value of 11 (#28616)

This commit is contained in:
Paul Kuberry 2022-01-27 09:40:57 -07:00 committed by GitHub
parent 28ea1bab68
commit ec9748eaf3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,7 +38,12 @@ class Xyce(CMakePackage):
variant('mpi', default=True, description='Enable MPI support') variant('mpi', default=True, description='Enable MPI support')
depends_on('mpi', when='+mpi') depends_on('mpi', when='+mpi')
# any option other than cxxstd=11 would be ignored in Xyce
# this defaults to 11, consistent with what will be used,
# and produces an error if any other value is attempted
cxxstd_choices = ['11']
variant('shared', default=False, description='Enable shared libraries for Xyce') variant('shared', default=False, description='Enable shared libraries for Xyce')
variant('cxxstd', default='11', values=cxxstd_choices, multi=False)
variant('pymi', default=False, description='Enable Python Model Interpreter for Xyce') variant('pymi', default=False, description='Enable Python Model Interpreter for Xyce')
depends_on('python@3:', type=('build', 'link', 'run'), when='+pymi') depends_on('python@3:', type=('build', 'link', 'run'), when='+pymi')
@ -58,6 +63,10 @@ class Xyce(CMakePackage):
# installation of many more packages than are needed for Xyce. # installation of many more packages than are needed for Xyce.
depends_on('trilinos~float~ifpack2~ml~muelu~zoltan2') depends_on('trilinos~float~ifpack2~ml~muelu~zoltan2')
# ensures trilinos built with same cxxstd as Xyce (which Xyce was tested against)
for cxxstd_ in cxxstd_choices:
depends_on('trilinos cxxstd={0}'.format(cxxstd_), when='cxxstd={0}'.format(cxxstd_))
def cmake_args(self): def cmake_args(self):
spec = self.spec spec = self.spec
@ -82,6 +91,7 @@ def cmake_args(self):
options.append('-DCMAKE_CXX_COMPILER:STRING={0}'.format(self.compiler.cxx)) options.append('-DCMAKE_CXX_COMPILER:STRING={0}'.format(self.compiler.cxx))
options.append(self.define_from_variant('BUILD_SHARED_LIBS', 'shared')) options.append(self.define_from_variant('BUILD_SHARED_LIBS', 'shared'))
options.append(self.define_from_variant('CMAKE_CXX_STANDARD', 'cxxstd'))
if '+pymi' in spec: if '+pymi' in spec:
pybind11 = spec['py-pybind11'] pybind11 = spec['py-pybind11']