File pcl.spec of Package pcl

#
# spec file for package pcl
#
# Copyright (c) 2020 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.11

Name:           pcl
Version:        1.11.0
Release:        0
Summary:        Library for point cloud processing
License:        BSD-3-Clause
Group:          System/Libraries
URL:            http://pointclouds.org/
Source0:        https://github.com/PointCloudLibrary/pcl/archive/pcl-%{version}.tar.gz
# PATCH-FIX-UPSTREAM -- VTK 9.0 compatibility https://patch-diff.githubusercontent.com/raw/PointCloudLibrary/pcl/pull/4096.patch
Patch0:         pcl-vtk-9_0-compat.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_date_time-devel
BuildRequires:  libboost_filesystem-devel
BuildRequires:  libboost_iostreams-devel
BuildRequires:  libboost_regex-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-devel
BuildRequires:  sqlite3-devel
BuildRequires:  vtk-devel
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5Sql)
BuildRequires:  pkgconfig(Qt5Widgets)
BuildRequires:  pkgconfig(sm)
BuildRequires:  pkgconfig(xt)
# 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}%{apiversion}
Summary:        C++ library for %{name}
Group:          System/Libraries

%description -n lib%{name}%{apiversion}
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}%{apiversion} = %{version}-%{release}
Requires:       eigen3-devel
Requires:       flann-devel
Requires:       pkgconfig
Requires:       qhull-devel
Requires:       vtk-devel

%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}%{apiversion} = %{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
%setup -q -n %{name}-%{name}-%{version}
%patch0 -p1

%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 \
  -DBUILD_documentation=OFF

%limit_build -m 2500
%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}
make -C build tests

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

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

%files -n lib%{name}%{apiversion}
%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