summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/liblas/package.py
blob: de77219900dca223de8095159e75ce64d5e74523 (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
# 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 Liblas(CMakePackage):
    """libLAS is a C/C++ library for reading and writing the very common
    LAS LiDAR format.
    """

    homepage = "https://liblas.org/"
    url = "https://download.osgeo.org/liblas/libLAS-1.8.1.tar.bz2"

    license("BSD-3-Clause")

    version("1.8.1", sha256="9adb4a98c63b461ed2bc82e214ae522cbd809cff578f28511122efe6c7ea4e76")

    # libLAS linkage of GDAL and libgeotiff enhances spatial coordinate system
    # description and provides data reprojection support.
    # Ref.: https://liblas.org/compilation.html#optional-libraries
    variant("endian", default=False, description='Build with "Endian-aware" option')
    variant("gdal", default=False, description="Build with GDAL for enhanced performance")
    variant("geotiff", default=True, description="Build with GeoTIFF for enhanced performance")
    variant("laszip", default=False, description="Build with LasZip")

    depends_on("cmake@2.6:", type="build")
    depends_on("libgeotiff@1.3:", when="+geotiff")
    depends_on("boost@1.42:1.72+program_options+thread+system+iostreams+filesystem")
    depends_on("laszip@2.0.1:", when="+laszip")
    depends_on("gdal@1.7:", when="+gdal")

    def cmake_args(self):
        args = []
        if "+endian" in self.spec:
            args.append("-DWITH_ENDIANAWARE=ON")
        else:
            args.append("-DWITH_ENDIANAWARE=OFF")

        if "+gdal" in self.spec:
            args.append("-DWITH_GDAL=ON")
        else:
            args.append("-DWITH_GDAL=OFF")

        if "+geotiff" in self.spec:
            args.append("-DWITH_GEOTIFF=ON")
        else:
            args.append("-DWITH_GEOTIFF=OFF")

        if "+laszip" in self.spec:
            args.append("-DWITH_LASZIP=ON")
        else:
            args.append("-DWITH_LASZIP=OFF")

        return args