diff options
author | Axel Huebl <axel.huebl@plasma.ninja> | 2021-02-26 01:29:52 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-26 10:29:52 +0100 |
commit | 46905bb4458fe6cca124f3e24261d70041aaf0f1 (patch) | |
tree | fdde957fd4e8fb10fd847da4b7a02300cd66d998 | |
parent | f28ca41d02ce9af1b83c16b1d9a0d00ab4a2ad12 (diff) | |
download | spack-46905bb4458fe6cca124f3e24261d70041aaf0f1.tar.gz spack-46905bb4458fe6cca124f3e24261d70041aaf0f1.tar.bz2 spack-46905bb4458fe6cca124f3e24261d70041aaf0f1.tar.xz spack-46905bb4458fe6cca124f3e24261d70041aaf0f1.zip |
openPMD-api: use cmake helpers (#21973)
Modernize the `openpmd-api` package to use fancy new `CMakePackage`
helpers when setting options from variants :-)
-rw-r--r-- | var/spack/repos/builtin/packages/openpmd-api/package.py | 51 |
1 files changed, 21 insertions, 30 deletions
diff --git a/var/spack/repos/builtin/packages/openpmd-api/package.py b/var/spack/repos/builtin/packages/openpmd-api/package.py index b1bd25b5b2..0e730fc438 100644 --- a/var/spack/repos/builtin/packages/openpmd-api/package.py +++ b/var/spack/repos/builtin/packages/openpmd-api/package.py @@ -10,7 +10,7 @@ class OpenpmdApi(CMakePackage): """API for easy reading and writing of openPMD files""" homepage = "http://www.openPMD.org" - url = "https://github.com/openPMD/openPMD-api/archive/0.13.1.tar.gz" + url = "https://github.com/openPMD/openPMD-api/archive/0.13.2.tar.gz" git = "https://github.com/openPMD/openPMD-api.git" maintainers = ['ax3l'] @@ -62,42 +62,33 @@ class OpenpmdApi(CMakePackage): spec = self.spec args = [ - '-DBUILD_SHARED_LIBS:BOOL={0}'.format( - 'ON' if '+shared' in spec else 'OFF'), + self.define_from_variant('BUILD_SHARED_LIBS', 'shared'), # variants - '-DopenPMD_USE_MPI:BOOL={0}'.format( - 'ON' if '+mpi' in spec else 'OFF'), - '-DopenPMD_USE_HDF5:BOOL={0}'.format( - 'ON' if '+hdf5' in spec else 'OFF'), - '-DopenPMD_USE_ADIOS1:BOOL={0}'.format( - 'ON' if '+adios1' in spec else 'OFF'), - '-DopenPMD_USE_ADIOS2:BOOL={0}'.format( - 'ON' if '+adios2' in spec else 'OFF'), - '-DopenPMD_USE_PYTHON:BOOL={0}'.format( - 'ON' if '+python' in spec else 'OFF'), + self.define_from_variant('openPMD_USE_MPI', 'mpi'), + self.define_from_variant('openPMD_USE_HDF5', 'hdf5'), + self.define_from_variant('openPMD_USE_ADIOS1', 'adios1'), + self.define_from_variant('openPMD_USE_ADIOS2', 'adios2'), + self.define_from_variant('openPMD_USE_PYTHON', 'python'), # tests and examples - '-DBUILD_TESTING:BOOL={0}'.format( - 'ON' if self.run_tests else 'OFF'), - '-DBUILD_EXAMPLES:BOOL={0}'.format( - 'ON' if self.run_tests else 'OFF'), + self.define('BUILD_TESTING', self.run_tests), + self.define('BUILD_EXAMPLES', self.run_tests) ] # switch internally shipped third-party libraries for spack if spec.satisfies('+python'): - args.append('-DopenPMD_USE_INTERNAL_PYBIND11:BOOL=OFF') - if spec.version >= Version('0.13.0'): - args.append('-DPython_ROOT_DIR:FILEPATH={0}'.format( - self.spec['python'].prefix)) - else: - args.append('-DPYTHON_EXECUTABLE:FILEPATH={0}'.format( - self.spec['python'].command.path)) - - args.extend([ - '-DopenPMD_USE_INTERNAL_JSON:BOOL=OFF', - '-DopenPMD_USE_INTERNAL_VARIANT:BOOL=OFF' - ]) + py_exe_define = 'Python_EXECUTABLE' \ + if spec.version >= Version('0.13.0') else 'PYTHON_EXECUTABLE' + args += [ + self.define(py_exe_define, self.spec['python'].command.path), + self.define('openPMD_USE_INTERNAL_PYBIND11', False) + ] + + args += [ + self.define('openPMD_USE_INTERNAL_JSON', False), + self.define('openPMD_USE_INTERNAL_VARIANT', False) + ] if self.run_tests: - args.append('-DopenPMD_USE_INTERNAL_CATCH:BOOL=OFF') + args.append(self.define('openPMD_USE_INTERNAL_CATCH', False)) return args |