summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/asagi/package.py
blob: 6caedab8c5641a029b6a3cb37a4417d9ebcb81ea (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
61
62
63
64
65
66
67
68
69
70
71
72
73
# 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)

# Author: Gilbert Brietzke
# Date: July 2, 2019

from spack import *


class Asagi(CMakePackage):
    """a pArallel Server for Adaptive GeoInformation."""

    homepage = "https://github.com/TUM-I5/ASAGI"
    git = "https://github.com/TUM-I5/ASAGI.git"

    # fetching the package via git with submodules
    # is preferred to satisfy internal-dependencies
    version('1.0.1', commit='f633f96931ae00805f599078d5a1a6a830881554',
            submodules=True)
    # fetching the package via git with submodules
    # is preferred to satisfy internal-dependencies
    version('1.0', commit='f67250798b435c308b9a1e7516f916f7855534ec',
            submodules=True)

    variant('link_type', default='shared',
            description='build shared and/or static libraries',
            values=('static', 'shared'), multi=True)

    variant('fortran', default=True, description="enable fortran support")
    variant('max_dimensions', default=4,
            description="max. number of dimensions supported")
    variant('numa', default=True, description="enable NUMA support")
    variant('mpi', default=True, description="enable MPI")
    variant('threadsafe', default=True,
            description="enable threadsafe ASAGI-functions")
    variant('threadsafe_counter', default=False,
            description="enable threadsafe access counters")
    variant('threadsafe_mpi', default=True,
            description="make MPI calls threadsafe")
    variant('mpi3', default=True,
            description="enable MPI-3 (enables additional features)")
    variant('tests', default=False, description="compile tests")
    variant('examples', default=False, description="compile examples")

    depends_on('mpi', when="+mpi")
    depends_on('mpi@3:', when="+mpi3")
    depends_on('netcdf-c +mpi', when="+mpi")
    depends_on('netcdf-c ~mpi', when="~mpi")
    depends_on('numactl', when="+numa")

    conflicts('%gcc@5:', when='@:1.0.0')

    def cmake_args(self):

        link_type = self.spec.variants['link_type'].value
        spec = self.spec
        args = ['-DMAX_DIMENSIONS=' + spec.variants['max_dimensions'].value,
                '-DSHARED_LIB=' + ('ON' if 'shared' in link_type else 'OFF'),
                '-DSTATIC_LIB=' + ('ON' if 'static' in link_type else 'OFF'),
                '-DFORTRAN_SUPPORT=' + ('ON' if '+fortran' in spec else 'OFF'),
                '-DTHREADSAFE=' + ('ON' if '+threadsafe' in spec else 'OFF'),
                '-DNOMPI=' + ('ON' if '~mpi' in spec else 'OFF'),
                '-DMPI3=' + ('ON' if '+mpi3' in spec else 'OFF'),
                '-DNONUMA=' + ('ON' if '~numa' in spec else 'OFF'),
                '-DTESTS=' + ('ON' if '+tests' in spec else 'OFF'),
                '-DEXAMPLES=' + ('ON' if '+examples' in spec else 'OFF'),
                '-DTHREADSAFE_COUNTER='
                + ('ON' if '+threadsafe_counter' in spec else 'OFF'),
                '-DTHREADSAFE_MPI='
                + ('ON' if '+threadsafe_mpi' in spec else 'OFF'), ]
        return args