2021-01-02 15:10:28 +08:00
|
|
|
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
|
2018-10-08 04:52:23 +08:00
|
|
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
2017-11-28 05:43:03 +08:00
|
|
|
#
|
2018-10-08 04:52:23 +08:00
|
|
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
2017-11-28 05:43:03 +08:00
|
|
|
from spack import *
|
|
|
|
|
|
|
|
|
|
|
|
class Amp(CMakePackage):
|
2021-05-06 23:10:13 +08:00
|
|
|
"""The Advanced Multi-Physics (AMP) package.
|
|
|
|
|
|
|
|
The Advanced Multi-Physics (AMP) package is an open source parallel
|
2017-11-28 05:43:03 +08:00
|
|
|
object-oriented computational framework that is designed with single
|
2021-05-06 23:10:13 +08:00
|
|
|
and multi-domain multi-physics applications in mind.
|
|
|
|
"""
|
2017-11-28 05:43:03 +08:00
|
|
|
|
2018-07-23 15:00:15 +08:00
|
|
|
homepage = "https://bitbucket.org/AdvancedMultiPhysics/amp"
|
2021-05-06 23:10:13 +08:00
|
|
|
hg = homepage
|
2017-11-28 05:43:03 +08:00
|
|
|
|
2018-07-23 15:00:15 +08:00
|
|
|
version('develop')
|
2017-11-28 05:43:03 +08:00
|
|
|
|
2021-05-06 23:10:13 +08:00
|
|
|
variant('boost', default=True, description='Build with support for Boost')
|
|
|
|
variant('hdf5', default=True, description='Build with support for HDF5')
|
|
|
|
variant('hypre', default=True, description='Build with support for hypre')
|
|
|
|
variant('libmesh', default=True, description='Build with libmesh support')
|
|
|
|
variant('mpi', default=True, description='Build with MPI support')
|
|
|
|
variant('netcdf', default=True, description='Build with NetCDF support')
|
|
|
|
variant('petsc', default=True, description='Build with Petsc support')
|
|
|
|
variant('shared', default=True, description='Build shared libraries')
|
|
|
|
variant('silo', default=True, description='Build with support for Silo')
|
|
|
|
variant('sundials', default=True, description='Build with support for Sundials')
|
|
|
|
variant('trilinos', default=True, description='Build with support for Trilinos')
|
|
|
|
variant('zlib', default=True, description='Build with support for zlib')
|
|
|
|
|
2017-11-28 05:43:03 +08:00
|
|
|
# Everything should be compiled position independent (-fpic)
|
|
|
|
depends_on('blas')
|
|
|
|
depends_on('lapack')
|
|
|
|
depends_on('boost', when='+boost')
|
|
|
|
depends_on('hdf5', when='+hdf5')
|
2021-05-06 23:10:13 +08:00
|
|
|
depends_on('hypre', when='+hypre')
|
|
|
|
depends_on('libmesh', when='+libmesh')
|
|
|
|
depends_on('netcdf-c', when='+netcdf')
|
|
|
|
depends_on('petsc', when='+petsc')
|
2017-11-28 05:43:03 +08:00
|
|
|
depends_on('silo', when='+silo')
|
2021-05-06 23:10:13 +08:00
|
|
|
depends_on('sundials', when='+sundials')
|
|
|
|
depends_on('trilinos', when='+trilinos')
|
2017-11-28 05:43:03 +08:00
|
|
|
depends_on('zlib', when="+zlib")
|
|
|
|
|
|
|
|
# MPI related dependencies
|
|
|
|
depends_on('mpi', when='+mpi')
|
|
|
|
|
|
|
|
def cmake_args(self):
|
|
|
|
spec = self.spec
|
|
|
|
|
2021-05-06 23:10:13 +08:00
|
|
|
options = [
|
|
|
|
self.define('TPL_URL', 'https://bitbucket.org/AdvancedMultiPhysics/tpl-builder'),
|
|
|
|
self.define('AMP_DATA_URL', 'https://bitbucket.org/AdvancedMultiPhysics/amp/downloads/AMP-Data.tar.gz'),
|
|
|
|
self.define('AMP_ENABLE_TESTS', 'OFF'),
|
|
|
|
self.define('AMP_ENABLE_EXAMPLES', 'OFF'),
|
|
|
|
self.define('AMP_ENABLE_CXX11', 'ON'),
|
|
|
|
self.define('CXX_STD', '11'),
|
|
|
|
self.define_from_variant('BUILD_SHARED_LIBS', 'shared'),
|
|
|
|
self.define('USE_MPI', '0'),
|
|
|
|
]
|
2017-11-28 05:43:03 +08:00
|
|
|
|
|
|
|
if '+mpi' in spec:
|
|
|
|
options.extend([
|
2021-05-06 23:10:13 +08:00
|
|
|
self.define('CMAKE_C_COMPILER', spec['mpi'].mpicc),
|
|
|
|
self.define('CMAKE_CXX_COMPILER', spec['mpi'].mpicxx),
|
|
|
|
self.define('CMAKE_Fortran_COMPILER', spec['mpi'].mpifc),
|
|
|
|
self.define('MPI_COMPILER', '1'),
|
|
|
|
self.define('MPIEXEC', spec['mpi'].prefix.bin),
|
2017-11-28 05:43:03 +08:00
|
|
|
])
|
|
|
|
else:
|
|
|
|
options.extend([
|
2021-05-06 23:10:13 +08:00
|
|
|
self.define('CMAKE_C_COMPILER', self.compiler.cc),
|
|
|
|
self.define('CMAKE_CXX_COMPILER', self.compiler.cxx),
|
|
|
|
self.define('CMAKE_Fortran_COMPILER', self.compiler.fc),
|
2017-11-28 05:43:03 +08:00
|
|
|
])
|
|
|
|
|
2021-05-06 23:10:13 +08:00
|
|
|
tpl_list = ["LAPACK"]
|
|
|
|
blas, lapack = spec['blas'].libs, spec['lapack'].libs
|
2017-11-28 05:43:03 +08:00
|
|
|
options.extend([
|
2021-05-06 23:10:13 +08:00
|
|
|
self.define('TPL_LAPACK_INSTALL_DIR', spec['lapack'].prefix),
|
|
|
|
self.define('TPL_BLAS_LIBRARY_NAMES', ';'.join(blas.names)),
|
|
|
|
self.define('TPL_BLAS_LIBRARY_DIRS', ';'.join(blas.directories)),
|
|
|
|
self.define('TPL_LAPACK_LIBRARY_NAMES', ';'.join(lapack.names)),
|
|
|
|
self.define('TPL_LAPACK_LIBRARY_DIRS', ';'.join(lapack.directories)),
|
2017-11-28 05:43:03 +08:00
|
|
|
])
|
2021-05-06 23:10:13 +08:00
|
|
|
|
|
|
|
for vname in (
|
|
|
|
'boost', 'hdf5', 'hypre', 'libmesh', 'petsc',
|
|
|
|
'silo', 'sundials', 'trilinos', 'zlib',
|
|
|
|
):
|
|
|
|
if '+' + vname in spec:
|
|
|
|
tpl_list.append(vname.upper())
|
|
|
|
options.append(self.define(
|
|
|
|
'TPL_{0}_INSTALL_DIR'.format(vname.upper()),
|
|
|
|
spec[vname].prefix
|
|
|
|
))
|
|
|
|
|
2017-11-28 05:43:03 +08:00
|
|
|
if '+netcdf' in spec:
|
2021-05-06 23:10:13 +08:00
|
|
|
tpl_list.append("NETCDF")
|
|
|
|
options.append(self.define(
|
|
|
|
'TPL_NETCDF_INSTALL_DIR', spec['netcdf-c'].prefix
|
|
|
|
))
|
2017-11-28 05:43:03 +08:00
|
|
|
|
2021-05-06 23:10:13 +08:00
|
|
|
options.append(self.define('TPL_LIST', ';'.join(tpl_list)))
|
2017-11-28 05:43:03 +08:00
|
|
|
return options
|