summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/textparser/package.py
blob: 6a9fdc2cd73b3d2337d96ce92b6653a3aa7c4bbd (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-2023 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 Textparser(CMakePackage):
    """Text Parser library allows us to describe and to parse JSON like
    simple parameter structure."""

    homepage = "https://github.com/avr-aics-riken/TextParser"
    git = "https://github.com/avr-aics-riken/TextParser.git"

    license("BSD-2-Clause")

    version("master", branch="master")
    version("1.8.8", commit="31ec1f23df21611d0765c27a6458fdbbf4cde66d")

    variant("mpi", default=True, description="Activate MPI support")
    variant("fapi", default=False, description="This option is for building Fortran API.")
    variant(
        "test",
        default=False,
        description="This option turns on compiling sample codes and" + " execute the tests.",
    )

    patch("fix_compiler_options.patch")

    depends_on("mpi", when="+mpi")

    parallel = False

    def cmake_args(self):
        spec = self.spec
        args = []
        args.append("-DINSTALL_DIR={0}".format(self.prefix))

        if "+mpi" in spec:
            args.append("-Dwith_MPI=yes")
            args.append("-DCMAKE_CXX_COMPILER=" + spec["mpi"].mpicxx)
        else:
            args.append("-Dwith_MPI=no")

        if "+fapi" in spec:
            args.append("-Denable_fapi=yes")
        else:
            args.append("-Denable_fapi=no")

        if "+test" in spec:
            args.append("-Denable_test=yes")
        else:
            args.append("-Denable_test=no")

        if "%fj" in spec:
            args.append("-DCMAKE_TOOLCHAIN_FILE=./cmake/Toolchain_fx100.cmake")

        return args