File pcl.spec of Package pcl

#
# spec file for package pcl
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


%global apiversion 1.11

Name:           pcl
Version:        1.11.1
Release:        0
Summary:        Library for point cloud processing
License:        BSD-3-Clause
Group:          System/Libraries
Url:            https://github.com/PointCloudLibrary/pcl.git
Source0:        pcl-%{version}.tar.gz
BuildRequires:  cmake
BuildRequires:  pkg-config
BuildRequires:  doxygen
BuildRequires:  eigen3-devel
BuildRequires:  fdupes
BuildRequires:  flann-devel
BuildRequires:  gcc-c++
BuildRequires:  gl2ps-devel
BuildRequires:  glew-devel
BuildRequires:  gtest
BuildRequires:  graphviz
BuildRequires:  hdf5-devel
BuildRequires:  java-1_8_0-openjdk-devel
BuildRequires:  python3-Sphinx
BuildRequires:  texlive-latex
BuildRequires:  libboost_date_time1_66_0-devel
BuildRequires:  libboost_filesystem1_66_0-devel
BuildRequires:  libboost_iostreams1_66_0-devel
BuildRequires:  libboost_system1_66_0-devel
BuildRequires:  libboost_thread1_66_0-devel
BuildRequires:  libboost_regex1_66_0-devel
BuildRequires:  libusb-1_0-devel
BuildRequires:  libxml2-devel
BuildRequires:  metslib-devel
BuildRequires:  openmpi3-devel
BuildRequires:  libproj-devel
BuildRequires:  python3-devel
BuildRequires:  qhull-devel
BuildRequires:  sqlite3-devel
BuildRequires:  vtk-devel
BuildRequires:  vtk-openmpi3-devel
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5Sql)
BuildRequires:  pkgconfig(Qt5Widgets)
BuildRequires:  pkgconfig(sm)
BuildRequires:  pkgconfig(xt)

%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}-%{version}

%build
%cmake \
  -DCMAKE_C_FLAGS:STRING="%{optflags}" \
  -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  -DCMAKE_SKIP_RPATH=ON \
  -DCMAKE_INSTALL_PREFIX=%{_prefix} \
  -DBUILD_SHARED_LIBS=ON \
  -DLIB_INSTALL_DIR=$(echo %{_libdir} | sed -e 's|%{_prefix}/||') \
%ifarch x86_64
  -DPCL_ENABLE_SSE=ON \
%else
  -DPCL_ENABLE_SSE=OFF \
%endif
  -DPCL_PKGCONFIG_SUFFIX:STRING="" \
  -DBUILD_documentation=ON

# %%jobs is defined by the OBS and in osc local builds
%define _jobs %(jobs_max=%{?jobs}; \\\
    if [ -z "$jobs_max" ] || [ "$jobs_max" -gt 2 ]; then \\\
        echo "2"; \\\
    else \\\
        echo "${jobs_max}"; \\\
    fi; )

make -j%{?_jobs}

%install
pushd build
%make_install
find %{buildroot} -name '*.la' -exec rm -vf {} ';'

rm -f %{buildroot}%{_bindir}/timed_trigger_test
popd
%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

# At the moment fails due to RPATH problem
# (RPATH not built into test apps as required)
%check
make -C build test || true

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

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

%files -n lib%{name}%{apiversion}
%doc AUTHORS.txt
%if 0%{?suse_version} >= 1500
%license LICENSE.txt
%else
%doc LICENSE.txt
%endif
%{_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