summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/petaca/package.py
blob: 4c78092b1a8a1ecb57473dbde4f293a69405b062 (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
52
53
54
55
56
57
58
59
60
# 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 Petaca(CMakePackage):
    """A collection of modern Fortran modules.

    Modules include:
    - Parameter lists
    - map_any_type
    - fortran_dynamic_loader
    - timer_tree_type
    - yajl_fort
    - json
    """

    homepage = "https://petaca.readthedocs.io/en/master"
    git = "https://github.com/nncarlson/petaca.git"
    url = "https://github.com/nncarlson/petaca/archive/refs/tags/v22.03.tar.gz"

    maintainers("pbrady", "zjibben")

    license("MIT")

    version("develop", branch="master")
    version("22.03", sha256="e6559e928c7cca6017ef0582c204eee775f6bb3f927f1c224c515c2ad574cc32")
    version("21.03", commit="f17df95193ca1a3879687a59a91a123be25e3efa")

    depends_on("cmake@3.3:", type="build")
    depends_on("yajl@2.0.1:")

    # override RelWithDebugInfo since those flags aren't set in petaca
    variant(
        "build_type",
        default="Release",
        description="Type build type to build",
        values=("Debug", "Release"),
    )

    variant("shared", default=False, description="build shared libraries")

    variant("std_name", default=False, description="enables std_mod_proc_name with intel")

    # copied from openmpi/package.py to ensure fortran support
    @run_before("cmake")
    def die_without_fortran(self):
        if (self.compiler.f77 is None) or (self.compiler.fc is None):
            raise InstallError("petaca requires both C and Fortran compilers!")

    def cmake_args(self):
        return [
            self.define("ENABLE_TESTS", self.run_tests),
            self.define_from_variant("BUILD_SHARED_LIBS", "shared"),
            self.define_from_variant("ENABLE_STD_MOD_PROC_NAME", "std_name"),
        ]