summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/libfms/package.py
blob: 354c11312dc064d5962c013c4c3720242496e877 (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
# 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.package import *


class Libfms(CMakePackage):
    """Field and Mesh Specification (FMS) library"""

    homepage = "https://github.com/CEED/FMS"
    git = "https://github.com/CEED/FMS.git"

    tags = ['FEM', 'Meshes', 'Fields', 'High-order', 'I/O', 'Data-exchange']

    maintainers = ['v-dobrev', 'tzanio', 'cwsmith']

    version('develop', branch='master')
    version('0.2.0', tag='v0.2')

    variant('conduit', default=True,
            description='Build with Conduit I/O support')
    variant('shared', default=True,
            description='Build shared libraries')

    depends_on('cmake@3.1:', type='build')
    depends_on('conduit@0.7.1:', when='+conduit')

    def cmake_args(self):
        args = []
        args.extend([
            self.define_from_variant('BUILD_SHARED_LIBS', 'shared'),
        ])
        if '+conduit' in self.spec:
            args.extend([
                self.define('CONDUIT_DIR', self.spec['conduit'].prefix)
            ])

        return args

    @property
    def headers(self):
        """Export the FMS headers.
           Sample usage: spec['libfms'].headers.cpp_flags
        """
        fms_h_names = ['fms', 'fmsio']
        hdrs = find_headers(fms_h_names, self.prefix.include, recursive=False)
        return hdrs or None  # Raise an error if no headers are found

    @property
    def libs(self):
        """Export the FMS library.
           Sample usage: spec['libfms'].libs.ld_flags
        """
        is_shared = '+shared' in self.spec
        libs = find_libraries('libfms', root=self.prefix, shared=is_shared,
                              recursive=True)
        return libs or None  # Raise an error if no libs are found