forked from TUM-CONAN/conan-pcl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
169 lines (146 loc) · 6.62 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
import os
import shutil
from conans import ConanFile, CMake, tools, AutoToolsBuildEnvironment
from conans.util import files
from fnmatch import fnmatch
class LibPCLConan(ConanFile):
name = "pcl"
upstream_version = "1.9.1"
package_revision = ""
version = "{0}{1}".format(upstream_version, package_revision)
generators = "cmake"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"cuda": ["9.2", "10.0", "None"]
}
default_options = [
"shared=True",
"cuda=None"
]
default_options = tuple(default_options)
exports = [
"patches/CMakeProjectWrapper.txt",
"patches/clang_macos.diff",
"patches/kinfu.diff",
"patches/pcl_eigen.diff",
"patches/pcl_gpu_error.diff"
]
url = "https://git.ircad.fr/conan/conan-pcl"
license = "BSD License"
description = "The Point Cloud Library is a standalone, large scale, open project for 2D/3D image and point cloud processing."
source_subfolder = "source_subfolder"
build_subfolder = "build_subfolder"
short_paths = True
def configure(self):
del self.settings.compiler.libcxx
self.options["Boost"].shared=True
if 'CI' not in os.environ:
os.environ["CONAN_SYSREQUIRES_MODE"] = "verify"
def requirements(self):
self.requires("qt/5.12.2@sight/stable")
self.requires("eigen/3.3.7@camposs/stable")
self.requires("Boost/1.64.0@camposs/stable")
self.requires("vtk/8.2.0-r1@camposs/stable")
self.requires("openni/2.2.0-r3@camposs/stable")
self.requires("flann/1.9.1-r2@camposs/stable")
if tools.os_info.is_windows:
self.requires("zlib/1.2.11-r1@sight/stable")
def build_requirements(self):
if tools.os_info.linux_distro == "linuxmint":
installer = tools.SystemPackageTool()
installer.install("zlib1g-dev")
def system_requirements(self):
if tools.os_info.linux_distro == "linuxmint":
installer = tools.SystemPackageTool()
installer.install("zlib1g")
def source(self):
tools.get("https://github.com/PointCloudLibrary/pcl/archive/pcl-{0}.tar.gz".format(self.upstream_version))
os.rename("pcl-pcl-{0}".format(self.upstream_version), self.source_subfolder)
def build(self):
pcl_source_dir = os.path.join(self.source_folder, self.source_subfolder)
shutil.move("patches/CMakeProjectWrapper.txt", "CMakeLists.txt")
tools.patch(pcl_source_dir, "patches/clang_macos.diff")
tools.patch(pcl_source_dir, "patches/kinfu.diff")
tools.patch(pcl_source_dir, "patches/pcl_eigen.diff")
tools.patch(pcl_source_dir, "patches/pcl_gpu_error.diff")
# Use our own FindFLANN which take care of conan..
os.remove(os.path.join(pcl_source_dir, 'cmake', 'Modules', 'FindFLANN.cmake'))
cmake = CMake(self)
cmake.definitions["BUILD_apps"] = "OFF"
cmake.definitions["BUILD_examples"] = "OFF"
cmake.definitions["BUILD_common"] = "ON"
cmake.definitions["BUILD_2d"] = "ON"
cmake.definitions["BUILD_features"] = "ON"
cmake.definitions["BUILD_filters"] = "ON"
cmake.definitions["BUILD_geometry"] = "ON"
cmake.definitions["BUILD_io"] = "ON"
cmake.definitions["BUILD_kdtree"] = "ON"
cmake.definitions["BUILD_octree"] = "ON"
cmake.definitions["BUILD_sample_consensus"] = "ON"
cmake.definitions["BUILD_search"] = "ON"
cmake.definitions["BUILD_tools"] = "OFF"
cmake.definitions["PCL_BUILD_WITH_BOOST_DYNAMIC_LINKING_WIN32"] = "ON"
cmake.definitions["PCL_SHARED_LIBS"] = "ON"
cmake.definitions["WITH_PCAP"] = "OFF"
cmake.definitions["WITH_DAVIDSDK"] = "OFF"
cmake.definitions["WITH_ENSENSO"] = "OFF"
cmake.definitions["WITH_OPENNI"] = "OFF"
cmake.definitions["WITH_OPENNI2"] = "OFF"
cmake.definitions["WITH_RSSDK"] = "OFF"
cmake.definitions["WITH_QHULL"] = "OFF"
cmake.definitions["BUILD_TESTS"] = "OFF"
cmake.definitions["BUILD_ml"] = "ON"
cmake.definitions["BUILD_simulation"] = "OFF"
cmake.definitions["BUILD_segmentation"] = "ON"
cmake.definitions["BUILD_registration"] = "ON"
if self.options.cuda != "None":
cmake.definitions["BUILD_CUDA"] = "ON"
cmake.definitions["BUILD_GPU"] = "ON"
cmake.definitions["BUILD_gpu_kinfu"] = "ON"
cmake.definitions["BUILD_gpu_kinfu_large_scale"] = "ON"
cmake.definitions["BUILD_visualization"] = "ON"
cmake.definitions["BUILD_surface"] = "ON"
cmake.definitions["CUDA_ARCH_BIN"] = "3.0 3.5 5.0 5.2 6.1"
if tools.os_info.is_macos:
cmake.definitions["BUILD_gpu_features"] = "OFF"
if tools.os_info.is_windows:
cmake.definitions["CUDA_PROPAGATE_HOST_FLAGS"] = "ON"
else:
# Clang >= 3.8 is not supported by CUDA 7.5
cmake.definitions["CUDA_HOST_COMPILER"] = "/usr/bin/gcc"
cmake.definitions["CUDA_PROPAGATE_HOST_FLAGS"] = "OFF"
if not tools.os_info.is_windows:
cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = "ON"
cmake.configure(build_folder=self.build_subfolder)
cmake.build()
cmake.install()
def cmake_fix_path(self, file_path, package_name):
try:
tools.replace_in_file(
file_path,
self.deps_cpp_info[package_name].rootpath.replace('\\', '/'),
"${CONAN_" + package_name.upper() + "_ROOT}",
strict=False
)
except:
self.output.info("Ignoring {0}...".format(package_name))
def package(self):
for path, subdirs, names in os.walk(self.package_folder):
for name in names:
if fnmatch(name, '*.cmake'):
cmake_file = os.path.join(path, name)
tools.replace_in_file(
cmake_file,
self.package_folder.replace('\\', '/'),
'${CONAN_PCL_ROOT}',
strict=False
)
self.cmake_fix_path(cmake_file, "boost")
self.cmake_fix_path(cmake_file, "eigen")
self.cmake_fix_path(cmake_file, "flann")
self.cmake_fix_path(cmake_file, "vtk")
self.cmake_fix_path(cmake_file, "openni")
def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
self.cpp_info.includedirs = ['include/pcl-1.9'];