[bigint/zxing-cpp] Adapter xcode 5.1.1 and set it as a dependency of zxing-cpp (#13129)

* [bigint] Adapter xcode 5.1.1

* [bigint] Add vcpkg-cmake-wrapper

* [zxing-cpp] use vcpkg bigint instead
This commit is contained in:
Jack·Boos·Yu 2020-08-27 20:24:39 -07:00 committed by GitHub
parent 69f57ef4e0
commit 9211f80ed7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 115 additions and 4 deletions

View File

@ -1,4 +1,5 @@
Source: bigint
Version: 2010.04.30-4
Version: 2010.04.30
Port-Version: 5
Homepage: https://mattmccutchen.net/bigint
Description: C++ Big Integer Library

View File

@ -0,0 +1,39 @@
diff --git a/BigUnsigned.hh b/BigUnsigned.hh
index adf1c00..9228753 100644
--- a/BigUnsigned.hh
+++ b/BigUnsigned.hh
@@ -20,7 +20,7 @@ public:
typedef unsigned long Blk;
typedef NumberlikeArray<Blk>::Index Index;
- NumberlikeArray<Blk>::N;
+ using NumberlikeArray<Blk>::N;
protected:
// Creates a BigUnsigned with a capacity; for internal use.
@@ -84,8 +84,8 @@ public:
// BIT/BLOCK ACCESSORS
// Expose these from NumberlikeArray directly.
- NumberlikeArray<Blk>::getCapacity;
- NumberlikeArray<Blk>::getLength;
+ using NumberlikeArray<Blk>::getCapacity;
+ using NumberlikeArray<Blk>::getLength;
/* Returns the requested block, or 0 if it is beyond the length (as if
* the number had 0s infinitely to the left). */
diff --git a/BigUnsignedInABase.hh b/BigUnsignedInABase.hh
index 8f9bdce..0ea89c6 100644
--- a/BigUnsignedInABase.hh
+++ b/BigUnsignedInABase.hh
@@ -100,8 +100,8 @@ public:
Base getBase() const { return base; }
// Expose these from NumberlikeArray directly.
- NumberlikeArray<Digit>::getCapacity;
- NumberlikeArray<Digit>::getLength;
+ using NumberlikeArray<Digit>::getCapacity;
+ using NumberlikeArray<Digit>::getLength;
/* Returns the requested digit, or 0 if it is beyond the length (as if
* the number had 0s infinitely to the left). */

View File

@ -1,5 +1,3 @@
include(vcpkg_common_functions)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_download_distfile(ARCHIVE
@ -11,6 +9,7 @@ vcpkg_download_distfile(ARCHIVE
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
PATCHES fix-osx-usage.patch
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
@ -23,4 +22,6 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
configure_file(${CURRENT_PORT_DIR}/usage ${CURRENT_PACKAGES_DIR}/share/${PORT}/usage @ONLY)
file(INSTALL ${CURRENT_PORT_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(INSTALL ${SOURCE_PATH}/README DESTINATION ${CURRENT_PACKAGES_DIR}/share/bigint RENAME copyright)

5
ports/bigint/usage Normal file
View File

@ -0,0 +1,5 @@
The package @PORT@:@TARGET_TRIPLET@ provides CMake targets:
find_package(@PORT@ CONFIG REQUIRED)
target_include_directories(main PRIVATE ${BIGINT_INCLUDE_DIRS})
target_link_libraries(main PRIVATE ${BIGINT_LIBRARIES})

View File

@ -0,0 +1,10 @@
include(SelectLibraryConfigurations)
find_path(BIGINT_INCLUDE_DIR BigInteger.hh PATH_SUFFIXES bigint)
find_library(BIGINT_LIBRARY_DEBUG NAMES bigint NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug" NO_DEFAULT_PATH REQUIRED)
find_library(BIGINT_LIBRARY_RELEASE NAMES bigint NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH REQUIRED)
select_library_configurations(BIGINT)
set(BIGINT_INCLUDE_DIRS ${BIGINT_INCLUDE_DIR})
set(BIGINT_LIBRARIES ${BIGINT_LIBRARY})

View File

@ -0,0 +1,50 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 54071bd..0edd0e9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,6 +44,12 @@ if(WIN32)
set(CMAKE_DEBUG_POSTFIX -debug)
endif()
+# Bigint
+find_package(bigint CONFIG REQUIRED)
+
+include_directories(${BIGINT_INCLUDE_DIRS})
+link_libraries(${BIGINT_LIBRARIES})
+
# OpenCV classes
if(WITH_OPENCV)
find_package(OpenCV REQUIRED)
diff --git a/source_files.cmake b/source_files.cmake
index db3d8d4..39abe82 100644
--- a/source_files.cmake
+++ b/source_files.cmake
@@ -1,28 +1,4 @@
set(LIBZXING_FILES
- core/src/bigint/BigInteger.cc
- core/src/bigint/BigInteger.cc
- core/src/bigint/BigInteger.hh
- core/src/bigint/BigInteger.hh
- core/src/bigint/BigIntegerAlgorithms.cc
- core/src/bigint/BigIntegerAlgorithms.cc
- core/src/bigint/BigIntegerAlgorithms.hh
- core/src/bigint/BigIntegerAlgorithms.hh
- core/src/bigint/BigIntegerLibrary.hh
- core/src/bigint/BigIntegerLibrary.hh
- core/src/bigint/BigIntegerUtils.cc
- core/src/bigint/BigIntegerUtils.cc
- core/src/bigint/BigIntegerUtils.hh
- core/src/bigint/BigIntegerUtils.hh
- core/src/bigint/BigUnsigned.cc
- core/src/bigint/BigUnsigned.cc
- core/src/bigint/BigUnsigned.hh
- core/src/bigint/BigUnsigned.hh
- core/src/bigint/BigUnsignedInABase.cc
- core/src/bigint/BigUnsignedInABase.cc
- core/src/bigint/BigUnsignedInABase.hh
- core/src/bigint/BigUnsignedInABase.hh
- core/src/bigint/NumberlikeArray.hh
- core/src/bigint/NumberlikeArray.hh
core/src/zxing/aztec/AztecDetectorResult.cpp
core/src/zxing/aztec/AztecDetectorResult.h
core/src/zxing/aztec/AztecReader.cpp

View File

@ -1,7 +1,9 @@
Source: zxing-cpp
Version: 3.3.3-7
Version: 3.3.3
Port-Version: 8
Homepage: https://github.com/glassechidna/zxing-cpp
Description: Barcode detection and decoding library.
Build-Depends: bigint
Default-Features: opencv, iconv
Feature: opencv

View File

@ -9,9 +9,12 @@ vcpkg_from_github(
PATCHES
0001-opencv4-compat.patch
0002-improve-features.patch
0003-fix-dependency-bigint.patch
)
file(REMOVE ${SOURCE_PATH}/cmake/FindModules/FindIconv.cmake)
# Depends on port bigint
file(REMOVE_RECURSE ${SOURCE_PATH}/core/src/bigint)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES