summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/masa/package.py
blob: b14b700bc9ab10283b43dbd6a6323f67f576a7be (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Copyright 2013-2024 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.package import *


class Masa(AutotoolsPackage):
    """MASA (Manufactured Analytical Solution Abstraction) is a library
    written in C++ (with C, python and Fortran90 interfaces) which
    provides a suite of manufactured solutions for the software
    verification of partial differential equation solvers in multiple
    dimensions."""

    homepage = "https://github.com/manufactured-solutions/MASA"
    git = "https://github.com/manufactured-solutions/MASA.git"

    license("LGPL-2.1-or-later")

    version("master", branch="master")

    variant("fortran", default=True, description="Compile with Fortran interfaces")
    variant("python", default=True, description="Compile with Python interfaces")

    depends_on("autoconf", type="build")
    depends_on("automake", type="build")
    depends_on("libtool", type="build")
    depends_on("swig", type="build")
    depends_on("python", when="+python")
    depends_on("metaphysicl")

    def configure_args(self):
        options = []

        options.extend(["--with-metaphysicl=%s" % self.spec["metaphysicl"].prefix])

        if "+fortran" in self.spec:
            options.extend(["--enable-fortran-interfaces"])

        if "+python" in self.spec:
            options.extend(["--enable-python-interfaces"])

        return options

    def setup_build_environment(self, env):
        # Unfortunately can't use this because MASA overwrites it
        # env.set('CXXFLAGS', self.compiler.cxx11_flag)
        env.set("CXX", "{0} {1}".format(self.compiler.cxx, self.compiler.cxx11_flag))
        if self.spec.satisfies("%apple-clang"):
            env.set("CFLAGS", "-Wno-implicit-function-declaration")