From 17e71a675aed0695a27f3127291bd6028f40d3f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Fr=C3=A9rot?= Date: Wed, 4 May 2022 01:17:17 +0200 Subject: [PATCH] tamaas: new package (#30449) * tamaas: added new package * tamaas: passing dependency prefixes to build * tamaas: Python 3.7 dependency * tamaas: compiler conflicts and correct ~python * tamaas: no newline in docstring * tamaas: correct python build dep. when ~python --- .../repos/builtin/packages/tamaas/package.py | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 var/spack/repos/builtin/packages/tamaas/package.py diff --git a/var/spack/repos/builtin/packages/tamaas/package.py b/var/spack/repos/builtin/packages/tamaas/package.py new file mode 100644 index 0000000000..e4f51d820d --- /dev/null +++ b/var/spack/repos/builtin/packages/tamaas/package.py @@ -0,0 +1,75 @@ +# Copyright 2013-2022 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 Tamaas(SConsPackage): + """Tamaas is a C++ library with a Python interface that efficiently solves + contact mechanics problems with periodic rough surfaces, plasticity, + adhesion and friction.""" + + homepage = "https://gitlab.com/tamaas/tamaas" + url = "https://gitlab.com/tamaas/tamaas/-/archive/v2.4.0/tamaas-v2.4.0.tar.gz" + git = "https://gitlab.com/tamaas/tamaas.git" + maintainers = ["prs513rosewood"] + + version("master", branch="master") + version("2.4.0", sha256="38edba588ff3a6643523c28fb391e001dbafa9d0e58053b9e080eda70f8c71c9") + version("2.3.1", sha256="7d63e374cbc7b5b93578ece7be5c084d1c2f0dbe1d57c4f0c8abd5ff5fff9ab0") + version("2.3.0", sha256="0529e015c6cb5bbabaea5dce6efc5ec0f2aa76c00541f0d90ad0e2e3060a4520") + + variant("python", default=True, + description="Provide Python bindings for Tamaas") + variant("solvers", default=True, when="+python", + description="Enables extra Scipy-based nonlinear solvers") + + # Python 3.6 causes unicode issues with scons + depends_on("python@3.7:", type="build", when="~python") + depends_on("scons@3:", type="build") + + depends_on("thrust", type="build") + depends_on("boost", type="build") + depends_on("fftw-api@3:") + + # compilers that don't use C++14 by default cause configure issues + conflicts("%gcc@:5") + conflicts("%clang@:5") + conflicts("%intel") + + with when("+python"): + extends("python") + depends_on("python@3.7:", type=("build", "run")) + depends_on("py-numpy", type=("build", "run")) + depends_on("py-scipy", when="+solvers", type="run") + depends_on("py-pybind11", type="build") + depends_on("py-wheel", type="build") + + def build_args(self, spec, prefix): + args = [ + "build_type=release", + "use_mpi={}".format(spec["fftw-api"].satisfies("+mpi")), + "backend={}".format( + "omp" if spec["fftw-api"].satisfies("+openmp") else "cpp"), + "fftw_threads={}".format( + "omp" if spec["fftw-api"].satisfies("+openmp") else "none"), + "build_python={}".format(spec.satisfies("+python")), + "verbose=True", + "strip_info=True", + "real_type=double", + "integer_type=int", + "build_tests=False", + "prefix={}".format(prefix), + "BOOST_ROOT={}".format(spec['boost'].prefix), + "THRUST_ROOT={}".format(spec['thrust'].prefix), + "FFTW_ROOT={}".format(spec['fftw-api'].prefix), + ] + + if spec.satisfies("+python"): + args += [ + "PYBIND11_ROOT={}".format(spec['py-pybind11'].prefix), + ] + + return args