Accepting request 1103217 from devel:libraries:c_c++

OBS-URL: https://build.opensuse.org/request/show/1103217
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/zxing-cpp?expand=0&rev=14
This commit is contained in:
Dominique Leuenberger 2023-08-10 13:33:12 +00:00 committed by Git OBS Bridge
commit 4295651e50
3 changed files with 60 additions and 4 deletions

35
cmake.patch Normal file
View File

@ -0,0 +1,35 @@
--- zxing-cpp-2.0.0/CMakeLists.txt 2023-08-08 13:26:51.918694430 +0200
+++ zxing-cpp-2.0.0/CMakeLists.txt 2023-08-08 13:38:00.669700216 +0200
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.14)
+cmake_minimum_required (VERSION 3.5)
project(ZXing)
@@ -42,8 +42,7 @@
set (CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()
-set (CMAKE_CXX_STANDARD 17)
-set (CMAKE_CXX_EXTENSIONS OFF)
+set (CMAKE_CXX_EXTENSIONS ON)
if (NOT (BUILD_READERS OR BUILD_WRITERS))
message(FATAL_ERROR "At least one of BUILD_READERS/BUILD_WRITERS must be enabled.")
--- zxing-cpp-2.0.0/core/CMakeLists.txt 2023-08-08 13:26:51.918694430 +0200
+++ zxing-cpp-2.0.0/core/CMakeLists.txt 2023-08-08 13:32:23.494204854 +0200
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.14)
+cmake_minimum_required (VERSION 3.5)
project (ZXing VERSION "2.0.0")
set (ZXING_SONAME 3) # see https://github.com/zxing-cpp/zxing-cpp/issues/333
@@ -457,8 +457,6 @@
)
endif()
-target_compile_features(ZXing PUBLIC cxx_std_17)
-
target_link_libraries (ZXing PRIVATE Threads::Threads)
add_library(ZXing::ZXing ALIAS ZXing)

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Wed Aug 9 15:07:38 UTC 2023 - Fridrich Strba <fstrba@suse.com>
- Restore support for building on SLE12
- Build with gcc7-c++ or gcc-c++ >= 7 because of C++17 requirements
- Added patch:
* cmake.patch
+ allow building with cmake 3.5 on SLE12SP5
-------------------------------------------------------------------
Tue Apr 25 08:56:24 UTC 2023 - Frederic Crozat <fcrozat@suse.com>

View File

@ -26,10 +26,16 @@ Group: Development/Languages/C and C++
URL: https://github.com/nu-book/zxing-cpp/
Source0: %{url}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source99: baselibs.conf
BuildRequires: cmake >= 3.10
BuildRequires: gcc-c++
Patch1: cmake.patch
BuildRequires: cmake >= 3.5
BuildRequires: pkgconfig
%if 0%{?suse_version} < 1500
BuildRequires: gcc7
BuildRequires: gcc7-c++
%else
BuildRequires: gcc >= 7
BuildRequires: gcc-c++ >= 7
%endif
# only TW has fmt
%if 0%{?suse_version} > 1500
# For blackbox tests
@ -65,6 +71,11 @@ other applications.
%autosetup -p1
%build
%if 0%{?suse_version} < 1500
export CC="gcc-7"
export CXX="g++-7"
%endif
export CXXFLAGS="-std=c++17"
# Examples require QT5-base/multimedia, but doing so creates a cycle
# Blackbox tests require fmt
%cmake \
@ -84,7 +95,8 @@ export LD_LIBRARY_PATH=%{buildroot}%{_libdir}
%endif
%ctest
%ldconfig_scriptlets -n libZXing%{sover}
%post -n libZXing%{sover} -p /sbin/ldconfig
%postun -n libZXing%{sover} -p /sbin/ldconfig
%files -n libZXing%{sover}
%doc README.md