File pcl.spec of Package pcl

#
# spec file for package pcl
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%global apiversion 1.12
%global soversion 1_12

Name:           pcl
Version:        1.12.1
Release:        0
Summary:        Library for point cloud processing
License:        BSD-3-Clause
Group:          System/Libraries
URL:            https://pointclouds.org/
Source0:        https://github.com/PointCloudLibrary/pcl/archive/pcl-%{version}.tar.gz
# PATCH-FIX-UPSTREAM
Patch0:         https://github.com/PointCloudLibrary/pcl/pull/5110.patch#/remove_unsatisfiable_boost_pkgconfig_dep.patch
# PATCH-FIX-UPSTREAM
Patch1:         https://github.com/PointCloudLibrary/pcl/commit/f1a5291d7f9bf10ffed9921ef267a93f871df446.patch#/improve_model_precision.patch
BuildRequires:  cmake
BuildRequires:  eigen3-devel
BuildRequires:  fdupes
BuildRequires:  flann-devel
BuildRequires:  gcc-c++
BuildRequires:  glew-devel
BuildRequires:  googletest-devel
BuildRequires:  hdf5-devel
BuildRequires:  libboost_chrono-devel
BuildRequires:  libboost_date_time-devel
BuildRequires:  libboost_filesystem-devel
BuildRequires:  libboost_iostreams-devel
BuildRequires:  libboost_regex-devel
BuildRequires:  libboost_serialization-devel
BuildRequires:  libboost_system-devel
BuildRequires:  libusb-1_0-devel
BuildRequires:  libxml2-devel
BuildRequires:  memory-constraints
BuildRequires:  metslib-devel
BuildRequires:  proj-devel
BuildRequires:  python3-devel
BuildRequires:  qhull_r-devel
BuildRequires:  sqlite3-devel
BuildRequires:  vtk-devel
BuildRequires:  pkgconfig(Qt5Concurrent)
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5OpenGL)
BuildRequires:  pkgconfig(Qt5Qml)
BuildRequires:  pkgconfig(Qt5Quick)
BuildRequires:  pkgconfig(Qt5Sql)
BuildRequires:  pkgconfig(Qt5Widgets)
# i568 and other 32 bit archs exhaust virtual memory space
ExcludeArch:    %{ix86} %{arm}

%description
The Point Cloud Library (or PCL) is a large scale, open project for point
cloud processing.

The PCL framework contains numerous state-of-the art algorithms including
filtering, feature estimation, surface reconstruction, registration, model
fitting and segmentation.

%package -n     lib%{name}%{soversion}
Summary:        C++ library for %{name}
Group:          System/Libraries
Obsoletes:      libpcl1.12

%description -n lib%{name}%{soversion}
The Point Cloud Library (or PCL) is a large scale, open project for point
cloud processing.

The PCL framework contains numerous state-of-the art algorithms including
filtering, feature estimation, surface reconstruction, registration, model
fitting and segmentation.

%package        devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       lib%{name}%{soversion} = %{version}-%{release}
Requires:       eigen3-devel
Requires:       flann-devel
Requires:       vtk-devel
Requires:       pkgconfig
Requires:       pkgconfig(qhull_r)

%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%package        tools
Summary:        Point cloud tools and viewers
Group:          Development/Tools/Other
Requires:       lib%{name}%{soversion} = %{version}-%{release}

%description    tools
This package contains tools for point cloud file processing and viewers
for point cloud files and live Kinect data.

%package        doc
Summary:        PCL API documentation
Group:          Documentation/HTML
BuildArch:      noarch

%description    doc
The %{name}-doc package contains API documentation for the Point Cloud
Library.

%prep
%autosetup -p1 -n %{name}-%{name}-%{version}

%build
%cmake \
  -DCMAKE_SKIP_RPATH=ON \
  -DLIB_INSTALL_DIR=%{_lib} \
%ifarch x86_64
  -DPCL_ENABLE_SSE=ON \
%else
  -DPCL_ENABLE_SSE=OFF \
%endif
  -DPCL_PKGCONFIG_SUFFIX:STRING="" \
  -DBUILD_global_tests:BOOL=ON \
  -DPCL_DISABLE_GPU_TESTS:BOOL=OFF \
  -DPCL_DISABLE_VISUALIZATION_TESTS:BOOL=OFF \
  -DWITH_QT:STRING="QT5" \
  -DBUILD_documentation=OFF

%limit_build -m 2800
%cmake_build

%install
%cmake_install

%fdupes %{buildroot}%{_includedir}

# copy manually, so fdupes works
mkdir -p %{buildroot}%{_docdir}/%{name}-doc/
cp -r doc/doxygen doc/tutorials doc/advanced %{buildroot}%{_docdir}/%{name}-doc/
%fdupes %{buildroot}%{_docdir}/%{name}-doc

%check
export LD_LIBRARY_PATH=%{buildroot}%{_libdir}
%ifarch aarch64
# https://github.com/PointCloudLibrary/pcl/issues/5320
%define ctest_options "--exclude-regex 'common_pca'"
%endif
%ctest --test-dir test %{ctest_options}


%post -n lib%{name}%{soversion} -p /sbin/ldconfig

%postun -n lib%{name}%{soversion} -p /sbin/ldconfig

%files -n lib%{name}%{soversion}
%doc AUTHORS.txt
%license LICENSE.txt
%{_libdir}/*.so.*

%files devel
%dir %{_includedir}/%{name}-%{apiversion}
%{_includedir}/%{name}-%{apiversion}/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%dir %{_datadir}/%{name}-%{apiversion}
%dir %{_datadir}/%{name}-%{apiversion}/Modules
%{_datadir}/%{name}-%{apiversion}/Modules/*.cmake
%{_datadir}/%{name}-%{apiversion}/*.cmake

%files tools
%{_bindir}/%{name}_*
# There are no .desktop files because the GUI tools are rather examples
# to understand a particular feature of PCL.

%files doc
%{_docdir}/%{name}-doc

%changelog
openSUSE Build Service is sponsored by