[packages/zxing-cpp] - enchanced cmake patch: move opencv specific classes to libzxing-cv library

qboosh qboosh at pld-linux.org
Mon Apr 17 20:10:30 CEST 2017


commit c59a25dfb59eb0ead4cd671b08af3d50ddd3dda0
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Mon Apr 17 20:10:41 2017 +0200

    - enchanced cmake patch: move opencv specific classes to libzxing-cv library

 zxing-cpp-cmake.patch | 55 ++++++++++++++++++++++++++++++++++++++++++++++++---
 zxing-cpp.spec        | 43 ++++++++++++++++++++++++----------------
 2 files changed, 78 insertions(+), 20 deletions(-)
---
diff --git a/zxing-cpp.spec b/zxing-cpp.spec
index 8d1a320..924f624 100644
--- a/zxing-cpp.spec
+++ b/zxing-cpp.spec
@@ -27,18 +27,6 @@ C++ port of ZXing - 1D/2D barcode image processing library.
 %description -l pl.UTF-8
 Port C++ biblioteki ZXing, przetwarzającej kody paskowe 1D/2D
 
-%package opencv
-Summary:	OpenCV/ZXing based QR code recognizer
-Summary(pl.UTF-8):	Program do rozpoznawania kodów QR oparty na bibliotekach OpenCV/ZXing
-Group:		Applications/Graphics
-Requires:	%{name} = %{version}-%{release}
-
-%description opencv
-OpenCV/ZXing based QR code recognizer.
-
-%description opencv -l pl.UTF-8
-Program do rozpoznawania kodów QR oparty na bibliotekach OpenCV/ZXing.
-
 %package devel
 Summary:	Header files for ZXing library
 Summary(pl.UTF-8):	Pliki nagłówkowe biblioteki ZXing
@@ -52,6 +40,18 @@ Header files for ZXing library.
 %description devel -l pl.UTF-8
 Pliki nagłówkowe biblioteki ZXing.
 
+%package opencv
+Summary:	OpenCV/ZXing based QR code recognizer
+Summary(pl.UTF-8):	Program do rozpoznawania kodów QR oparty na bibliotekach OpenCV/ZXing
+Group:		Applications/Graphics
+Requires:	%{name} = %{version}-%{release}
+
+%description opencv
+OpenCV/ZXing based QR code recognizer.
+
+%description opencv -l pl.UTF-8
+Program do rozpoznawania kodów QR oparty na bibliotekach OpenCV/ZXing.
+
 %prep
 %setup -q -n %{name}-%{gitref}
 %patch0 -p1
@@ -70,25 +70,34 @@ rm -rf $RPM_BUILD_ROOT
 %{__make} -C build install \
 	DESTDIR=$RPM_BUILD_ROOT
 
+%if %{with opencv}
+# API (opencv/src/zxing/MatSource.h) not installed
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/libzxing-cv.so
+%endif
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %post	-p /sbin/ldconfig
 %postun	-p /sbin/ldconfig
 
+%post	opencv -p /sbin/ldconfig
+%postun	opencv -p /sbin/ldconfig
+
 %files
 %defattr(644,root,root,755)
 %doc AUTHORS README.md
 %attr(755,root,root) %{_bindir}/zxing
 %attr(755,root,root) %{_libdir}/libzxing.so.0
 
+%files devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libzxing.so
+%{_includedir}/zxing
+
 %if %{with opencv}
 %files opencv
 %defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libzxing-cv.so.0
 %attr(755,root,root) %{_bindir}/zxing-cv
 %endif
-
-%files devel
-%defattr(644,root,root,755)
-%attr(755,root,root) %{_libdir}/libzxing.so
-%{_includedir}/zxing
diff --git a/zxing-cpp-cmake.patch b/zxing-cpp-cmake.patch
index 0c9b25d..28a7d39 100644
--- a/zxing-cpp-cmake.patch
+++ b/zxing-cpp-cmake.patch
@@ -1,7 +1,21 @@
 --- zxing-cpp-6b3cbe02a332bff0f5ba0416f221d3d3876afdc2/CMakeLists.txt.orig	2016-11-22 04:34:19.000000000 +0100
-+++ zxing-cpp-6b3cbe02a332bff0f5ba0416f221d3d3876afdc2/CMakeLists.txt	2017-04-16 21:29:53.022165125 +0200
-@@ -65,7 +65,7 @@
++++ zxing-cpp-6b3cbe02a332bff0f5ba0416f221d3d3876afdc2/CMakeLists.txt	2017-04-17 09:00:41.098731903 +0200
+@@ -51,21 +51,9 @@
+     include_directories(SYSTEM "./core/lib/win32/")
+ endif()
  
+-# OpenCV classes
+-find_package(OpenCV)
+-if(OpenCV_FOUND)
+-    file(GLOB_RECURSE LIBZXING_OPENCV_FILES
+-        "./opencv/src/*.cpp"
+-        "./opencv/src/*.h"
+-    )
+-    set(LIBZXING_FILES ${LIBZXING_FILES} ${LIBZXING_OPENCV_FILES})
+-    include_directories(${OpenCV_INCLUDE_DIRS})
+-    include_directories("./opencv/src/")
+-endif()
+-
  include_directories("./core/src/")
  add_library(libzxing ${LIBZXING_FILES})
 -set_target_properties(libzxing PROPERTIES PREFIX "")
@@ -9,7 +23,42 @@
  
  find_package(Iconv)
  if(ICONV_FOUND)
-@@ -94,9 +94,9 @@
+@@ -75,14 +63,32 @@
+     add_definitions(-DNO_ICONV=1)
+ endif()
+ 
+-# Add OpenCV cli executable
++# OpenCV classes
++find_package(OpenCV)
+ if(OpenCV_FOUND)
++    file(GLOB_RECURSE LIBZXING_OPENCV_FILES
++        "./opencv/src/*.cpp"
++        "./opencv/src/*.h"
++    )
++    include_directories(${OpenCV_INCLUDE_DIRS})
++    include_directories("./opencv/src/")
++    add_library(libzxing-cv ${LIBZXING_OPENCV_FILES})
++    set_target_properties(libzxing-cv PROPERTIES PREFIX "" SOVERSION 0)
++    set(LIBZXING_FILES ${LIBZXING_FILES} ${LIBZXING_OPENCV_FILES})
++    target_link_libraries(libzxing-cv libzxing ${OpenCV_LIBRARIES})
++
++    # Add OpenCV cli executable
+     file(GLOB_RECURSE OPENCV_ZXING_FILES
+         "./opencv-cli/src/*.cpp"
+         "./opencv-cli/src/*.h"
+     )
+     add_executable(zxing-cv ${OPENCV_ZXING_FILES})
+-    target_link_libraries(zxing-cv libzxing ${OpenCV_LIBRARIES})
++    target_link_libraries(zxing-cv libzxing-cv libzxing ${OpenCV_LIBRARIES})
++
++    install(TARGETS libzxing-cv zxing-cv
++	LIBRARY DESTINATION lib${LIB_SUFFIX}
++	RUNTIME DESTINATION bin
++	ARCHIVE DESTINATION lib${LIB_SUFFIX})
+ endif()
+ 
+ # Add cli executable.
+@@ -94,9 +100,9 @@
  add_executable(zxing ${ZXING_FILES})
  target_link_libraries(zxing libzxing)
  install(TARGETS zxing libzxing
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/zxing-cpp.git/commitdiff/c59a25dfb59eb0ead4cd671b08af3d50ddd3dda0



More information about the pld-cvs-commit mailing list