From e2830d3e000395d50b82c91d840e5fb5c91e2fa5 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Fri, 12 Mar 2021 15:33:02 +0100 Subject: [PATCH] Update with_cuda options Initial patch from "Eric Sandeen " See rhbz#1938054 --- opencv.spec | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/opencv.spec b/opencv.spec index 942ba86..259efe1 100644 --- a/opencv.spec +++ b/opencv.spec @@ -40,6 +40,12 @@ %global srcname opencv +# If _cuda_version is unset +%if 0%{!?_cuda_version:1} && 0%{?with_cuda:1} +%global _cuda_version 11.2 +%global _cuda_rpm_version 11-2 +%global _cuda_prefix /usr/local/cuda-%{_cuda_version} +%endif Name: opencv Version: 4.5.1 @@ -71,9 +77,10 @@ BuildRequires: libtool BuildRequires: cmake >= 2.6.3 BuildRequires: chrpath %{?with_cuda: -BuildRequires: pkgconfig(cublas-%{?_cuda_rpm_version}) -BuildRequires: pkgconfig(cufft-%{?_cuda_rpm_version}) -BuildRequires: pkgconfig(nppc-%{?_cuda_rpm_version}) +BuildRequires: cuda-minimal-build-%{?_cuda_rpm_version} +BuildRequires: pkgconfig(cublas-%{?_cuda_version}) +BuildRequires: pkgconfig(cufft-%{?_cuda_version}) +BuildRequires: pkgconfig(nppc-%{?_cuda_version}) } %{?with_eigen2:BuildRequires: eigen2-devel} %{?with_eigen3:BuildRequires: eigen3-devel} @@ -293,6 +300,7 @@ install -pm 0644 %{SOURCE4} .cache/ade/ -DCUDA_TOOLKIT_ROOT_DIR=%{?_cuda_prefix} \ -DCUDA_VERBOSE_BUILD=ON \ -DCUDA_PROPAGATE_HOST_FLAGS=OFF \ + -DCUDA_NVCC_FLAGS="-Xcompiler -fPIC" \ } \ %{?with_openni: -DWITH_OPENNI=ON } \ %{!?with_xine: -DWITH_XINE=OFF } \ @@ -424,6 +432,10 @@ ln -s -r %{buildroot}%{_jnidir}/opencv-%{javaver}.jar %{buildroot}%{_jnidir}/ope %{_libdir}/libopencv_bgsegm.so.%{abiver}* %{_libdir}/libopencv_bioinspired.so.%{abiver}* %{_libdir}/libopencv_ccalib.so.%{abiver}* +%{?with_cuda: +%{_libdir}/libopencv_cuda*.so.%{abiver}* +%{_libdir}/libopencv_cudev.so.%{abiver}* +} %{_libdir}/libopencv_cvv.so.%{abiver}* %{_libdir}/libopencv_datasets.so.%{abiver}* %{_libdir}/libopencv_dnn_objdetect.so.%{abiver}*