summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth R. Johnson <johnsonsr@ornl.gov>2021-06-01 03:32:20 -0400
committerGitHub <noreply@github.com>2021-06-01 09:32:20 +0200
commit976a97f045ccb29ca8c7cd8cff65532fae27ac4c (patch)
tree3b05d669ca83b14460201544aa9dbfa1d3d692ad
parentbb5fd5c56714a81a3bea84b4827af70eddc32b18 (diff)
downloadspack-976a97f045ccb29ca8c7cd8cff65532fae27ac4c.tar.gz
spack-976a97f045ccb29ca8c7cd8cff65532fae27ac4c.tar.bz2
spack-976a97f045ccb29ca8c7cd8cff65532fae27ac4c.tar.xz
spack-976a97f045ccb29ca8c7cd8cff65532fae27ac4c.zip
formetis: add new package (#24048)
-rw-r--r--var/spack/repos/builtin/packages/formetis/package.py71
1 files changed, 71 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/formetis/package.py b/var/spack/repos/builtin/packages/formetis/package.py
new file mode 100644
index 0000000000..5d4a0e47ab
--- /dev/null
+++ b/var/spack/repos/builtin/packages/formetis/package.py
@@ -0,0 +1,71 @@
+# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
+from spack import *
+
+
+class Formetis(CMakePackage):
+ """Automated Fortran bindings to METIS and ParMETIS."""
+
+ homepage = "https://github.com/swig-fortran/formetis"
+ url = "https://github.com/swig-fortran/formetis/archive/refs/tags/v0.0.1.tar.gz"
+
+ maintainers = ['sethrj']
+
+ version('0.0.2', sha256='d0d778fd76185d395041f8bc0ecc2b1f3785cf55db31eb77323bd7cce741c5cb')
+
+ variant('mpi', default=False, description='Enable ParMETIS support')
+ variant('shared', default=True, description='Build shared libraries')
+ variant('swig', default=False,
+ description='Regenerate source files using SWIG')
+
+ depends_on('metis@5')
+ depends_on('parmetis', when='+mpi')
+ depends_on('mpi', when='+mpi')
+ depends_on('swig@4.0.2-fortran', when='+swig')
+
+ # Using non-standard int sizes requires regenerating the C/Fortran
+ # interface files with SWIG
+ conflicts('~swig', when='^metis+int64')
+ conflicts('~swig', when='^metis+real64')
+
+ def cmake_args(self):
+ from_variant = self.define_from_variant
+ args = [
+ from_variant('FORMETIS_USE_MPI', 'mpi'),
+ from_variant('BUILD_SHARED_LIBS', 'shared'),
+ from_variant('FORMETIS_USE_SWIG', 'swig'),
+ self.define('FORMETIS_BUILD_EXAMPLES', False),
+ ]
+ return args
+
+ examples_src_dir = 'example'
+
+ @run_after('install')
+ def setup_smoke_tests(self):
+ """Copy the example source files after the package is installed to an
+ install test subdirectory for use during `spack test run`."""
+ self.cache_extra_test_sources([self.examples_src_dir])
+
+ def test(self):
+ example_src_dir = join_path(self.install_test_root,
+ self.examples_src_dir)
+ test_build_dir = join_path(self.test_suite.stage,
+ 'build_example')
+
+ cmake_args = [
+ self.define('CMAKE_PREFIX_PATH', self.prefix),
+ self.define('CMAKE_Fortran_COMPILER', self.compiler.fc),
+ self.define('METIS_ROOT', self.spec['metis'].prefix),
+ ]
+ if '+mpi' in self.spec:
+ cmake_args.append(
+ self.define('ParMETIS_ROOT', self.spec['parmetis'].prefix))
+ cmake_args.append(example_src_dir)
+ with working_dir(test_build_dir, create=True):
+ cmake(*cmake_args)
+ make()
+ self.run_test('metis', [], [], installed=False,
+ purpose='test: installation')