-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconanfile.py
73 lines (61 loc) · 2.47 KB
/
conanfile.py
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
import os
from conans import ConanFile, CMake, tools
class LaszipConan(ConanFile):
name = "laszip"
description = "C++ library for lossless LiDAR compression."
license = "LGPL-2.1"
topics = ("conan", "laszip", "las", "laz", "lidar", "compression", "decompression")
homepage = "https://github.com/LASzip/LASzip"
url = "https://github.com/conan-io/conan-center-index"
exports_sources = "CMakeLists.txt"
generators = "cmake"
settings = "os", "arch", "compiler", "build_type"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": False, "fPIC": True}
_cmake = None
@property
def _source_subfolder(self):
return "source_subfolder"
@property
def _build_subfolder(self):
return "build_subfolder"
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def source(self):
tools.get(**self.conan_data["sources"][self.version])
os.rename("LASzip-" + self.version, self._source_subfolder)
def build(self):
# Do not build laszip_api, only laszip
tools.replace_in_file(os.path.join(self._source_subfolder, "dll", "CMakeLists.txt"),
"LASZIP_ADD_LIBRARY(${LASZIP_API_LIB_NAME} ${LASZIP_API_SOURCES})", "")
cmake = self._configure_cmake()
cmake.build()
def _configure_cmake(self):
if self._cmake:
return self._cmake
self._cmake = CMake(self)
self._cmake.definitions["LASZIP_BUILD_STATIC"] = not self.options.shared
self._cmake.configure(build_folder=self._build_subfolder)
return self._cmake
def package(self):
self.copy("COPYING", dst="licenses", src=self._source_subfolder)
cmake = self._configure_cmake()
cmake.install()
def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
if self.settings.os == "Linux":
self.cpp_info.system_libs.append("m")
if not self.options.shared and self._stdcpp_library:
self.cpp_info.system_libs.append(self._stdcpp_library)
if self.options.shared:
self.cpp_info.defines.append("LASZIP_DYN_LINK")
@property
def _stdcpp_library(self):
libcxx = self.settings.get_safe("compiler.libcxx")
if libcxx in ("libstdc++", "libstdc++11"):
return "stdc++"
elif libcxx in ("libc++",):
return "c++"
else:
return False