summaryrefslogtreecommitdiff
path: root/sci-libs/pcl/pcl-9999.ebuild
blob: 0193c18726a961fde40b9c50c4c39935690ffc6c (plain)
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{13..14} )

inherit cmake cuda flag-o-matic python-any-r1 toolchain-funcs

if [[ ${PV} == *9999* ]]; then
	inherit git-r3
	EGIT_REPO_URI="https://github.com/PointCloudLibrary/pcl"
else
	SRC_URI="
		https://github.com/PointCloudLibrary/pcl/archive/${P}.tar.gz
	"
	S="${WORKDIR}/${PN}-${P}"
	KEYWORDS="~amd64 ~arm"
	CMAKE_QA_COMPAT_SKIP="true"
fi

DESCRIPTION="2D/3D image and point cloud processing"
HOMEPAGE="https://pointclouds.org/"

LICENSE="BSD"
SLOT="0/$(ver_cut 1-2)"
IUSE="apps cuda doc examples opengl openmp openni openni2 pcap png +qhull qt6 test tutorials usb vtk cpu_flags_x86_avx cpu_flags_x86_sse"

# vtk has a hard depend on png. so HAVE_PNG is true if you find vtk
REQUIRED_USE="
	openni? ( usb )
	openni2? ( usb )
	tutorials? ( doc )
	vtk? ( png qt6 )
	test? ( vtk )
"

RESTRICT="!test? ( test )"

RDEPEND="
	dev-cpp/eigen:=
	dev-libs/boost:=
	dev-libs/cJSON
	>=sci-libs/flann-1.7.1
	sci-libs/nanoflann
	virtual/zlib:=
	apps? (
		qt6? (
			dev-qt/qtbase:6[concurrent,gui,opengl]
			vtk? (
				sci-libs/vtk[qt6]
			)
		)
	)
	cuda? (
		dev-util/nvidia-cuda-toolkit:=
	)
	opengl? (
		media-libs/freeglut
		virtual/opengl
	)
	openni? (
		dev-libs/OpenNI
	)
	openni2? (
		dev-libs/OpenNI2
	)
	pcap? (
		net-libs/libpcap
	)
	png? (
		media-libs/libpng:=
	)
	qhull? (
		media-libs/qhull:=
	)
	usb? (
		virtual/libusb:1
	)
	vtk? (
		media-libs/glew:=
		sci-libs/vtk:=[imaging,rendering,views]
		virtual/glu
		x11-libs/libX11
	)
"
DEPEND="${RDEPEND}
	!!dev-cpp/metslib
	openmp? (
		|| (
			sys-devel/gcc[openmp]
			llvm-runtimes/clang-runtime[openmp]
		)
	)
	test? (
		dev-cpp/gtest
	)
"
# dev-texlive/texlive-latexextra for anyfontsize.sty
BDEPEND="
	doc? (
		app-text/doxygen[dot]
		$(python_gen_any_dep '
			dev-python/sphinxcontrib-doxylink[${PYTHON_USEDEP}]
		')
		virtual/latex-base
		dev-texlive/texlive-latexextra
	)
	tutorials? (
		$(python_gen_any_dep '
			dev-python/sphinx[${PYTHON_USEDEP}]
			dev-python/sphinx-rtd-theme[${PYTHON_USEDEP}]
			dev-python/sphinxcontrib-doxylink[${PYTHON_USEDEP}]
		')
	)
	virtual/pkgconfig
"

PATCHES=(
	"${FILESDIR}/${PN}-1.12.1-allow-configuration-of-install-dirs.patch"
	"${FILESDIR}/${PN}-1.12.1-fix-hardcoded-relative-directory-of-the-installed-cmake-files.patch"
	"${FILESDIR}/${PN}-1.14.1-tests.patch"
	"${FILESDIR}/${PN}-1.15.1-ASSERT_FLOAT_EQ.patch"
	"${FILESDIR}/${PN}-1.15.1-update-find-vtk.patch"
)

pkg_pretend() {
	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
}

pkg_setup() {
	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp

	if use doc || use tutorials; then
		python-any-r1_pkg_setup
	fi
}

python_check_deps() {
	{
		use doc &&
			python_has_version "dev-python/sphinxcontrib-doxylink[${PYTHON_USEDEP}]";
	} &&
	{
		use tutorials &&
			python_has_version \
				"dev-python/sphinx[${PYTHON_USEDEP}]" \
				"dev-python/sphinx-rtd-theme[${PYTHON_USEDEP}]" \
				"dev-python/sphinxcontrib-doxylink[${PYTHON_USEDEP}]" \
			;
	}
}

src_prepare() {
	if use cuda; then
		cuda_src_prepare
	fi

	cmake_src_prepare
}

src_configure() {
	append-flags -fno-strict-aliasing

	local mycmakeargs=(
		-DDOC_INSTALL_DIR="share/doc/${PF}"
		-DLIB_INSTALL_DIR="$(get_libdir)"

		# we are mixing static and shared libraries...
		-DCMAKE_POSITION_INDEPENDENT_CODE="yes"
		-DPCL_ALLOW_BOTH_SHARED_AND_STATIC_DEPENDENCIES="no"

		-DPCLCONFIG_INSTALL_DIR="share/cmake/${PN}-$(ver_cut 1-2)"

		-DBUILD_CUDA="$(usex cuda)"
		-DBUILD_GPU="$(usex cuda)"

		-DBUILD_apps="$(usex apps)"

		-DBUILD_benchmarks="no"

		-DBUILD_examples="$(usex examples)"
		-DBUILD_global_tests="$(usex test)"

		-DBUILD_simulation="yes"
		-DBUILD_surface="yes"
		-DBUILD_surface_on_nurbs="yes"
		-DBUILD_tools="yes"
		-DBUILD_tracking="yes"
		-DBUILD_visualization="$(usex vtk)"

		-DPCL_ENABLE_CCACHE="no"

		-DPCL_ENABLE_MARCHNATIVE="no"
		-DPCL_ENABLE_AVX="$(usex cpu_flags_x86_avx)"
		-DPCL_ENABLE_SSE="$(usex cpu_flags_x86_sse)"

		-DPCL_DISABLE_GPU_TESTS="$(usex !cuda)"
		-DPCL_DISABLE_VISUALIZATION_TESTS="$(usex !vtk)"

		-DWITH_CUDA="$(usex cuda)"
		-DWITH_DAVIDSDK="no"
		-DWITH_DOCS="$(usex doc)"
		-DWITH_DSSDK="no"
		-DWITH_ENSENSO="no"
		-DWITH_GLEW="yes"
		-DWITH_LIBUSB="$(usex usb)"
		-DWITH_OPENGL="$(usex opengl)"
		-DWITH_OPENMP="$(usex openmp)"
		-DWITH_OPENNI2="$(usex openni2)"
		-DWITH_OPENNI="$(usex openni)"
		-DWITH_PCAP="$(usex pcap)"
		-DWITH_PNG="$(usex png)"
		-DWITH_QHULL="$(usex qhull)"
		-DWITH_QT="$(usex qt6 QT6 NO)"
		-DWITH_RSSDK2="no"
		-DWITH_RSSDK="no"
		-DWITH_SYSTEM_CJSON="yes"
		-DWITH_SYSTEM_ZLIB="yes"
		-DWITH_TUTORIALS="$(usex tutorials)"
		-DWITH_VTK="$(usex vtk)"

		# TODO expects <suitesparse/cholmod.h> #979607
		# surface/src/on_nurbs/on_nurbs.cmake
		-DUSE_UMFPACK="no"
	)

	if use apps; then
		mycmakeargs+=(
			-DBUILD_apps_3d_rec_framework="$(usex vtk "$(usex openni)")"
			-DBUILD_apps_cloud_composer="yes"
			-DBUILD_apps_in_hand_scanner="$(usex qt6 "$(usex opengl "$(usex openni)")")"
			-DBUILD_apps_modeler="yes"
			-DBUILD_apps_point_cloud_editor="yes"
		)

		if use cuda; then
			mycmakeargs+=(
				-DBUILD_cuda_common="yes"
				-DBUILD_cuda_features="yes"
				-DBUILD_cuda_sample_consensus="yes"
				-DBUILD_cuda_segmentation="yes"

				-DBUILD_gpu_features="yes"
				-DBUILD_gpu_kinfu="no" # uses textures which was removed in CUDA 12
				-DBUILD_gpu_kinfu_large_scale="no" # uses textures which was removed in CUDA 12
				-DBUILD_gpu_people="no" # uses textures which was removed in CUDA 12
			)
		fi
	fi

	if use cuda; then
		mycmakeargs+=(
			-DBUILD_cuda_apps="$(usex openni "$(usex vtk)")" # Requires cuda_io.
			-DBUILD_cuda_io="$(usex openni)" # Requires external library openni.
			-DBUILD_gpu_surface="yes"
			-DBUILD_gpu_tracking="yes"
		)

		cuda_add_sandbox
		addpredict "/dev/char/"

		local -x CUDAHOSTCXX="$(cuda_gccdir)"

		if [[ -v CUDAARCHS ]]; then
			mycmakeargs+=(
				-DCUDA_ARCH_BIN="${CUDAARCHS}"
			)
		fi
	fi

	cmake_src_configure
}

src_test() {
	if use cuda; then
		cuda_add_sandbox -w
	fi

	BUILD_DIR="${BUILD_DIR}/test" cmake_src_test
}